Commit b47dc228 authored by Joanne Hugé's avatar Joanne Hugé

Fill histograms only if histogram option enabled

parent d43cd8ec
...@@ -245,7 +245,7 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) { ...@@ -245,7 +245,7 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
clock_gettime(CLOCK_MONOTONIC, &t1); clock_gettime(CLOCK_MONOTONIC, &t1);
send_udp_packet(0, 0, next_txtime, send_udp_packet(0, 0, next_txtime,
network_config.ip_address, NULL); network_config.ip_address, NULL);
recv_udp_packet(0, NULL); recv_udp_packet(0, 0, NULL);
clock_gettime(CLOCK_MONOTONIC, &t2); clock_gettime(CLOCK_MONOTONIC, &t2);
param->stats.rtt = calcdiff_ns(t2, t1); param->stats.rtt = calcdiff_ns(t2, t1);
......
...@@ -106,7 +106,7 @@ int init_udp_recv(int use_timestamps, char *network_if) { ...@@ -106,7 +106,7 @@ int init_udp_recv(int use_timestamps, char *network_if) {
/* /*
* Receives udp packets * Receives udp packets
*/ */
packet_timestamps_t recv_udp_packet(int use_timestamps, int64_t histograms[NB_HISTOGRAMS][MAX_HIST_VAL]) { packet_timestamps_t recv_udp_packet(int use_timestamps, int use_histograms, int64_t histograms[NB_HISTOGRAMS][MAX_HIST_VAL]) {
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
struct msghdr msg; // Message hardware, sent to the socket struct msghdr msg; // Message hardware, sent to the socket
...@@ -154,8 +154,8 @@ packet_timestamps_t recv_udp_packet(int use_timestamps, int64_t histograms[NB_HI ...@@ -154,8 +154,8 @@ packet_timestamps_t recv_udp_packet(int use_timestamps, int64_t histograms[NB_HI
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg); struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
packet_ts.leave_kernel = ts_to_uint(*stamp); packet_ts.leave_kernel = ts_to_uint(*stamp);
fill_histograms(&packet_ts, histograms); if(use_histograms)
fill_histograms(&packet_ts, histograms);
} }
} }
} }
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
#include "utilities.h" #include "utilities.h"
int init_udp_recv(int use_timestamps, char *network_if); int init_udp_recv(int use_timestamps, char *network_if);
packet_timestamps_t recv_udp_packet(int use_timestamps, int64_t histograms[NB_HISTOGRAMS][MAX_HIST_VAL]); packet_timestamps_t recv_udp_packet(int use_timestamps, int use_histograms, int64_t histograms[NB_HISTOGRAMS][MAX_HIST_VAL]);
#endif #endif
...@@ -131,12 +131,12 @@ static void *packet_receiving_thread(void *p) { ...@@ -131,12 +131,12 @@ static void *packet_receiving_thread(void *p) {
if (tsn_task == RTT_TASK) { if (tsn_task == RTT_TASK) {
recv_udp_packet(0, NULL); recv_udp_packet(0, 0, NULL);
send_udp_packet(0, 0, 0, network_config.ip_address, NULL); send_udp_packet(0, 0, 0, network_config.ip_address, NULL);
} else if (tsn_task == RECV_PACKET_TASK) { } else if (tsn_task == RECV_PACKET_TASK) {
param->stats.packet_ts = recv_udp_packet(enable_timestamps, histograms); param->stats.packet_ts = recv_udp_packet(enable_timestamps, enable_histograms, histograms);
clock_gettime(CLOCK_MONOTONIC, &current); clock_gettime(CLOCK_MONOTONIC, &current);
......
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