Commit 4982307e authored by Joanne Hugé's avatar Joanne Hugé

Fix all compilation warnings

parent f4d04550
...@@ -35,7 +35,7 @@ typedef struct rtt_stat { ...@@ -35,7 +35,7 @@ typedef struct rtt_stat {
typedef struct thread_param { typedef struct thread_param {
int interval; int interval;
int max_cycles; unsigned int max_cycles;
int priority; int priority;
int etf_offset; int etf_offset;
...@@ -55,10 +55,10 @@ static void sighand(int sig_num); ...@@ -55,10 +55,10 @@ static void sighand(int sig_num);
// Static variables // Static variables
static int64_t kernel_latency_hist[MAX_KERNEL_LATENCY]; static uint64_t kernel_latency_hist[MAX_KERNEL_LATENCY];
static int64_t rtt_hist[MAX_RTT]; static uint64_t rtt_hist[MAX_RTT];
static int nb_cycles; static uint64_t nb_cycles;
static main_param_t main_params; static main_param_t main_params;
static thread_param_t thread_params; static thread_param_t thread_params;
...@@ -103,6 +103,7 @@ static void help(char *argv[]) { ...@@ -103,6 +103,7 @@ static void help(char *argv[]) {
// Real-time thread // Real-time thread
// Sends packets at a regular intervall // Sends packets at a regular intervall
static void *packet_sending_thread(void *p) { static void *packet_sending_thread(void *p) {
(void) p;
struct timespec next; struct timespec next;
uint64_t next_txtime; uint64_t next_txtime;
struct sched_param priority; struct sched_param priority;
...@@ -135,10 +136,10 @@ static void *packet_sending_thread(void *p) { ...@@ -135,10 +136,10 @@ static void *packet_sending_thread(void *p) {
// Packet sending loop // Packet sending loop
for (nb_cycles = 0;; nb_cycles++) { for (nb_cycles = 0;; nb_cycles++) {
if (thread_params.max_cycles) if (thread_params.max_cycles)
if (nb_cycles >= thread_params.max_cycles) if (nb_cycles >= ((unsigned int)thread_params.max_cycles))
break; break;
sprintf(send_data, "%d", nb_cycles % 1000); sprintf(send_data, "%d", (int)(nb_cycles % 1000));
do_tsn_task(send_data, next_txtime); do_tsn_task(send_data, next_txtime);
add_ns(&next, thread_params.interval); add_ns(&next, thread_params.interval);
...@@ -186,8 +187,8 @@ int main(int argc, char *argv[]) { ...@@ -186,8 +187,8 @@ int main(int argc, char *argv[]) {
if (enable_histograms) { if (enable_histograms) {
// Init histograms // Init histograms
memset(kernel_latency_hist, 0, MAX_KERNEL_LATENCY); memset(kernel_latency_hist, 0, sizeof(kernel_latency_hist));
memset(rtt_hist, 0, MAX_RTT); memset(rtt_hist, 0, sizeof(rtt_hist));
} }
// Catch breaks with sighand to print the histograms // Catch breaks with sighand to print the histograms
...@@ -217,13 +218,13 @@ int main(int argc, char *argv[]) { ...@@ -217,13 +218,13 @@ int main(int argc, char *argv[]) {
if (main_params.verbose) { if (main_params.verbose) {
if (tsn_task == RTT_TASK) { if (tsn_task == RTT_TASK) {
printf("%10d: RTT: %4d %4d %4d\n", nb_cycles, rtt_stats.min_rtt, printf("%10" PRIu64 ": RTT: %4d %4d %4d\n", nb_cycles, rtt_stats.min_rtt,
rtt_stats.avg_rtt, rtt_stats.avg_rtt,
rtt_stats.max_rtt); rtt_stats.max_rtt);
printf("\033[%dA", 1); printf("\033[%dA", 1);
} else if (enable_timestamps) { } else if (enable_timestamps) {
printf("%10d: K: %4d %4d %4d\n", printf("%10" PRIu64 ": K: %4d %4d %4d\n",
nb_cycles, egress_stats.min_kernel_latency, nb_cycles, egress_stats.min_kernel_latency,
egress_stats.avg_kernel_latency, egress_stats.avg_kernel_latency,
egress_stats.max_kernel_latency); egress_stats.max_kernel_latency);
...@@ -278,7 +279,7 @@ static void print_histograms() { ...@@ -278,7 +279,7 @@ static void print_histograms() {
uint64_t duration; uint64_t duration;
int duration_hour, duration_minutes, interval; int duration_hour, duration_minutes, interval;
int max_hist_val, nb_hists; int max_hist_val;
uint64_t *histogram; uint64_t *histogram;
clock_gettime(CLOCK_MONOTONIC, &measures_end); clock_gettime(CLOCK_MONOTONIC, &measures_end);
...@@ -307,7 +308,7 @@ static void print_histograms() { ...@@ -307,7 +308,7 @@ static void print_histograms() {
if (histogram[j]) if (histogram[j])
max_hist_val = j > max_hist_val ? j : max_hist_val; max_hist_val = j > max_hist_val ? j : max_hist_val;
} else if (tsn_task == RTT_TASK) { } else {
printf("{\"measure_sets\": [{" printf("{\"measure_sets\": [{"
"\"measure_type\": \"packet_rtt\"," "\"measure_type\": \"packet_rtt\","
"\"props_names\": [\"rtt\"]," "\"props_names\": [\"rtt\"],"
...@@ -329,7 +330,7 @@ static void print_histograms() { ...@@ -329,7 +330,7 @@ static void print_histograms() {
printf("["); printf("[");
for (int j = 0; j < max_hist_val; j++) for (int j = 0; j < max_hist_val; j++)
printf("%" PRIi64 "%s", histogram[j], (j + 1 < max_hist_val ? ", " : "")); printf("%" PRIi64 "%s", histogram[j], (j + 1 < max_hist_val ? ", " : ""));
printf("%s]"); printf("]");
printf("]}]}\n"); printf("]}]}\n");
} }
......
...@@ -48,8 +48,8 @@ static void sighand(int sig_num); ...@@ -48,8 +48,8 @@ static void sighand(int sig_num);
// Static variables // Static variables
static int64_t kernel_latency_hist[MAX_KERNEL_LATENCY]; static uint64_t kernel_latency_hist[MAX_KERNEL_LATENCY];
static int64_t jitter_hist[MAX_JITTER]; static uint64_t jitter_hist[MAX_JITTER];
static main_param_t main_params; static main_param_t main_params;
static thread_param_t thread_params; static thread_param_t thread_params;
...@@ -87,6 +87,7 @@ static void help(char *argv[]) { ...@@ -87,6 +87,7 @@ static void help(char *argv[]) {
// Real-time thread // Real-time thread
// Measures intervals between packet receptions // Measures intervals between packet receptions
static void *packet_receiving_thread(void *p) { static void *packet_receiving_thread(void *p) {
(void) p;
struct timespec current, previous; struct timespec current, previous;
struct sched_param priority; struct sched_param priority;
cpu_set_t mask; cpu_set_t mask;
...@@ -189,8 +190,8 @@ int main(int argc, char *argv[]) { ...@@ -189,8 +190,8 @@ int main(int argc, char *argv[]) {
if (enable_histograms) { if (enable_histograms) {
// Init histograms // Init histograms
memset(kernel_latency_hist, 0, MAX_KERNEL_LATENCY); memset(kernel_latency_hist, 0, sizeof(kernel_latency_hist));
memset(jitter_hist, 0, MAX_JITTER); memset(jitter_hist, 0, sizeof(jitter_hist));
} }
// Catch breaks with sighand to print the histograms // Catch breaks with sighand to print the histograms
...@@ -223,7 +224,7 @@ int main(int argc, char *argv[]) { ...@@ -223,7 +224,7 @@ int main(int argc, char *argv[]) {
int jitter = ingress_stats.max_interval - ingress_stats.min_interval; int jitter = ingress_stats.max_interval - ingress_stats.min_interval;
printf("%10d: J: %4d, I: %4d %4d %4d", printf("%10" PRIu64 ": J: %4d, I: %4d %4d %4d",
ingress_stats.packets_received, ingress_stats.packets_received,
jitter, jitter,
ingress_stats.min_interval, ingress_stats.min_interval,
...@@ -253,7 +254,7 @@ static void print_histograms() { ...@@ -253,7 +254,7 @@ static void print_histograms() {
uint64_t duration; uint64_t duration;
int duration_hour, duration_minutes, interval; int duration_hour, duration_minutes, interval;
int max_latency, min_latency, max_jitter, min_jitter; int max_latency, max_jitter, min_jitter;
clock_gettime(CLOCK_MONOTONIC, &measures_end); clock_gettime(CLOCK_MONOTONIC, &measures_end);
...@@ -283,7 +284,7 @@ static void print_histograms() { ...@@ -283,7 +284,7 @@ static void print_histograms() {
printf("["); printf("[");
for (int j = 0; j < max_latency; j++) for (int j = 0; j < max_latency; j++)
printf("%" PRIi64 "%s", kernel_latency_hist[j], (j + 1 < max_latency ? ", " : "")); printf("%" PRIi64 "%s", kernel_latency_hist[j], (j + 1 < max_latency ? ", " : ""));
printf("%s]"); printf("]");
} }
max_jitter = 0; max_jitter = 0;
......
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