Commit 904167ed authored by Joanne Hugé's avatar Joanne Hugé

Fix segmentation fault

parent 488c0671
......@@ -232,6 +232,7 @@ int main(int argc, char *argv[]) {
// Critical TSN task
static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
struct timespec t1, t2;
uint64_t rtt_us;
// One way packet sending
if (tsn_task == SEND_PACKET_TASK) {
......@@ -251,9 +252,15 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
param->stats.rtt = calcdiff_ns(t2, t1);
if(enable_histograms)
if(enable_histograms) {
rtt_us = param->stats.rtt / 1000;
if(rtt_us > MAX_HIST_VAL) {
fprintf(stderr, "RTT value higher than MAX_HIST_VAL : %" PRIu64 " ( > %" PRIu64 ")\n", rtt_us, MAX_HIST_VAL);
exit(EXIT_FAILURE);
}
histograms[0][param->stats.rtt]++;
}
}
}
// Print histograms in .json format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment