| 1 | // SPDX-License-Identifier: BSD-2-Clausecxx . . $ `<file>/src/print.c`/ |
| 2 | /* |
| 3 | * Copyright (C) 2025 Linutronix GmbH |
| 4 | * Author Kurt Kanzenbach <[email protected]> |
| 5 | */ |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | #include <unistd.h> |
| 9 | |
| 10 | #include "config.h"cxx . . $ `<file>/src/config.h`/ |
| 11 | #include "print.h"cxx . . $ `<file>/src/print.h`/ |
| 12 | #include "stat.h"cxx . . $ `<file>/src/stat.h`/ |
| 13 | |
| 14 | volatile int print_stopcxx . . $ print_stop. = 0; |
| 15 | |
| 16 | void print_statscxx . . $ print_stats(49f6e7a06ebc5aa8).(void) |
| 17 | { |
| 18 | while (!print_stopcxx . . $ print_stop.) { |
| 19 | struct statisticscxx . . $ statistics# global_statistics[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 20 | int active = 0; |
| 21 | |
| 22 | stat_get_global_statscxx . . $ stat_get_global_stats(36543745c1651445).(global_statistics, sizeof(global_statistics)); |
| 23 | |
| 24 | for (int i = 0; i < NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.; i++) { |
| 25 | const char *name = i == GENERICL2_FRAME_TYPEcxx . . $ GENERICL2_FRAME_TYPE. |
| 26 | ? app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[GENERICL2_FRAME_TYPEcxx . . $ GENERICL2_FRAME_TYPE.].namecxx . . $ traffic_class_config#name. |
| 27 | : stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(i); |
| 28 | const struct statisticscxx . . $ statistics# *stat = &global_statistics[i]; |
| 29 | uint64_tcxx . . $ uint64_t# errors; |
| 30 | |
| 31 | errors = stat->frame_id_errorscxx . . $ statistics#frame_id_errors. + stat->out_of_order_errorscxx . . $ statistics#out_of_order_errors. + |
| 32 | stat->payload_errorscxx . . $ statistics#payload_errors.; |
| 33 | |
| 34 | if (config_is_traffic_class_activecxx . . $ config_is_traffic_class_active(c5f7da30cbc0f4e9).(stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(i))) { |
| 35 | printfcxx . . $ printf(581fddd72a8db8fc).("%-8s: Tx:%10" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " Rx:%10" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! |
| 36 | " RttMin[us]:%10" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! |
| 37 | " RttAvg[us]:%10lf RttMax[us]:%10" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " Err:%8" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! |
| 38 | " Outlier:%8" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "\n", |
| 39 | name, stat->frames_sentcxx . . $ statistics#frames_sent., stat->frames_receivedcxx . . $ statistics#frames_received., |
| 40 | stat->round_trip_mincxx . . $ statistics#round_trip_min., stat->round_trip_avgcxx . . $ statistics#round_trip_avg., |
| 41 | stat->round_trip_maxcxx . . $ statistics#round_trip_max., errors, stat->round_trip_outlierscxx . . $ statistics#round_trip_outliers.); |
| 42 | ++active; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | printfcxx . . $ printf(581fddd72a8db8fc).("-------------------------------------------------------------------" |
| 47 | "-------------\n"); |
| 48 | |
| 49 | printfcxx . . $ printf(581fddd72a8db8fc).("\033[%dA", active + 1); |
| 50 | |
| 51 | sleepcxx . . $ sleep(2141b656ce2cc063).(1); |
| 52 | } |
| 53 | } |