Skip to content

Commit

Permalink
Fix compiling error with rtt-5.0 (#92)
Browse files Browse the repository at this point in the history
- Fixed compiling error when enabling LOG with rt-thread 5.0

Signed-off-by: Fan YANG <[email protected]>
  • Loading branch information
helloeagleyang authored May 16, 2023
1 parent badddbb commit dc7d6c5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions iperf/iperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#define IPERF_MODE_SERVER 1
#define IPERF_MODE_CLIENT 2

#if (RT_VER_NUM >= 0x50000)
#define IPERF_GET_THREAD_NAME(th) (th->parent.name)
#else
#define IPERF_GET_THREAD_NAME(th) (th->name)
#endif

typedef struct
{
int mode;
Expand Down Expand Up @@ -156,7 +162,7 @@ static void iperf_udp_server(void *thread_param)
data = sentlen * RT_TICK_PER_SECOND / 125 / (tick2 - tick1);
integer = data/1000;
decimal = data%1000;
LOG_I("%s: %d.%03d0 Mbps! lost:%d total:%d\n", tid->name, integer, decimal, lost, total);
LOG_I("%s: %d.%03d0 Mbps! lost:%d total:%d\n", IPERF_GET_THREAD_NAME(tid), integer, decimal, lost, total);
}
}
rt_free(buffer);
Expand Down Expand Up @@ -235,7 +241,7 @@ static void iperf_client(void *thread_param)
data = sentlen * RT_TICK_PER_SECOND / 125 / (tick2 - tick1);
integer = data/1000;
decimal = data%1000;
LOG_I("%s: %d.%03d0 Mbps!", tid->name, integer, decimal);
LOG_I("%s: %d.%03d0 Mbps!", IPERF_GET_THREAD_NAME(tid), integer, decimal);
tick1 = tick2;
sentlen = 0;
}
Expand Down

0 comments on commit dc7d6c5

Please sign in to comment.