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) {
clock_gettime(CLOCK_MONOTONIC, &t1);
send_udp_packet(0, 0, next_txtime,
network_config.ip_address, NULL);
recv_udp_packet(0, NULL);
recv_udp_packet(0, 0, NULL);
clock_gettime(CLOCK_MONOTONIC, &t2);
param->stats.rtt = calcdiff_ns(t2, t1);
......
......@@ -106,7 +106,7 @@ int init_udp_recv(int use_timestamps, char *network_if) {
/*
* 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 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
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
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 @@
#include "utilities.h"
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
......@@ -131,12 +131,12 @@ static void *packet_receiving_thread(void *p) {
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);
} 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);
......
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