| 1 | // SPDX-License-Identifier: BSD-2-Clausecxx . . $ `<file>/src/stat.c`/ |
| 2 | /* |
| 3 | * Copyright (C) 2021-2025 Linutronix GmbH |
| 4 | * Author Kurt Kanzenbach <[email protected]> |
| 5 | */ |
| 6 | |
| 7 | #include <errno.h> |
| 8 | #include <inttypes.h> |
| 9 | #include <memory.h> |
| 10 | #include <stdbool.h> |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <time.h> |
| 14 | |
| 15 | #include "config.h"cxx . . $ `<file>/src/config.h`/ |
| 16 | #include "hist.h"cxx . . $ `<file>/src/hist.h`/ |
| 17 | #include "log.h"cxx . . $ `<file>/src/log.h`/ |
| 18 | #include "log_mqtt.h"cxx . . $ `<file>/src/log_mqtt.h`/ |
| 19 | #include "stat.h"cxx . . $ `<file>/src/stat.h`/ |
| 20 | #include "thread.h"cxx . . $ `<file>/src/thread.h`/ |
| 21 | #include "utils.h"cxx . . $ `<file>/src/utils.h`/ |
| 22 | |
| 23 | /* |
| 24 | * This is used by all real time Tx and Rx threads. However, all threads have their own portion |
| 25 | * within that struct so that it can be accessed without taking any locks. That is a must, because |
| 26 | * Tx and Rx are hot paths and we do not want to wait for logging or such. |
| 27 | */ |
| 28 | static struct statisticscxx . . $ statistics# global_statisticscxx . . $ global_statistics.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 29 | |
| 30 | /* |
| 31 | * Once per stat collection interval the global_statistics are copied to global_statistics_for_log |
| 32 | * for the log threads. That is used for file Log at the moment. |
| 33 | */ |
| 34 | static struct statisticscxx . . $ statistics# global_statistics_for_logcxx . . $ global_statistics_for_log.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 35 | static pthread_mutex_tcxx . . $ pthread_mutex_t# global_statistics_mutexcxx . . $ global_statistics_mutex.; |
| 36 | |
| 37 | /* |
| 38 | * These structs contains only the statistics for current stat interval. This is used by MQTT. |
| 39 | */ |
| 40 | static struct statisticscxx . . $ statistics# statistics_per_periodcxx . . $ statistics_per_period.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 41 | static struct statisticscxx . . $ statistics# statistics_per_period_for_logcxx . . $ statistics_per_period_for_log.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 42 | |
| 43 | struct round_trip_contextcxx . . $ round_trip_context# round_trip_contextscxx . . $ round_trip_contexts.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.]; |
| 44 | static uint64_tcxx . . $ uint64_t# rtt_expected_rt_limitcxx . . $ rtt_expected_rt_limit.; |
| 45 | int log_stat_user_selectedcxx . . $ log_stat_user_selected.; |
| 46 | static FILEcxx . . $ FILE# *file_tracing_oncxx . . $ file_tracing_on.; |
| 47 | static FILEcxx . . $ FILE# *file_trace_markercxx . . $ file_trace_marker.; |
| 48 | |
| 49 | const char *stat_frame_type_namescxx . . $ stat_frame_type_names.[NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.] = { |
| 50 | "TsnHigh", "TsnLow", "Rtc", "Rta", "Dcp", "Lldp", "UdpHigh", "UdpLow", "GenericL2"}; |
| 51 | |
| 52 | /* |
| 53 | * Keep 1024 periods of backlog available. If a frame is received later than 1024 periods after |
| 54 | * sending, it's a bug in any case. |
| 55 | * |
| 56 | * E.g. A period of 500us results in a backlog of 500ms. |
| 57 | */ |
| 58 | #define STAT_MAX_BACKLOGcxx . . $ `src/stat.c:58:9`! 1024 |
| 59 | |
| 60 | /* |
| 61 | * If SIGUSR1 signal is received, reset the global statistics. |
| 62 | */ |
| 63 | volatile sig_atomic_tcxx . . $ sig_atomic_t# reset_statscxx . . $ reset_stats. = 0; |
| 64 | |
| 65 | static void stat_resetcxx . . $ stat_reset(8384f39c9cf29b2f).(struct statisticscxx . . $ statistics# *stats) |
| 66 | { |
| 67 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(stats, 0, sizeof(struct statisticscxx . . $ statistics#)); |
| 68 | stats->round_trip_mincxx . . $ statistics#round_trip_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 69 | stats->oneway_mincxx . . $ statistics#oneway_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 70 | stats->rx_mincxx . . $ statistics#rx_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 71 | stats->rx_hw2xdp_mincxx . . $ statistics#rx_hw2xdp_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 72 | stats->rx_xdp2app_mincxx . . $ statistics#rx_xdp2app_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 73 | stats->rx_workload_mincxx . . $ statistics#rx_workload_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 74 | stats->tx_mincxx . . $ statistics#tx_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 75 | stats->proc_first_mincxx . . $ statistics#proc_first_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 76 | stats->proc_batch_mincxx . . $ statistics#proc_batch_min. = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!; |
| 77 | } |
| 78 | |
| 79 | int stat_initcxx . . $ stat_init(227e9c8ece8b273d).(enum log_stat_optionscxx . . $ log_stat_options# log_selection) |
| 80 | { |
| 81 | int i; |
| 82 | |
| 83 | if (log_selection >= LOG_NUM_OPTIONScxx . . $ LOG_NUM_OPTIONS.) |
| 84 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 85 | |
| 86 | init_mutexcxx . . $ init_mutex(4f83bfebf4bb9c8b).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 87 | |
| 88 | if (log_selection == LOG_REFERENCEcxx . . $ LOG_REFERENCE. || log_selection == LOG_TX_TIMESTAMPScxx . . $ LOG_TX_TIMESTAMPS.) { |
| 89 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allocation_error = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 90 | |
| 91 | for (i = 0; i < NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.; i++) { |
| 92 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! needs_backlog = (log_selection == LOG_REFERENCEcxx . . $ LOG_REFERENCE.) || |
| 93 | (log_selection == LOG_TX_TIMESTAMPScxx . . $ LOG_TX_TIMESTAMPS. && |
| 94 | app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[i].tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.); |
| 95 | |
| 96 | if (needs_backlog) { |
| 97 | struct round_trip_contextcxx . . $ round_trip_context# *current_context = |
| 98 | &round_trip_contextscxx . . $ round_trip_contexts.[i]; |
| 99 | |
| 100 | current_context->backlog_lencxx . . $ round_trip_context#backlog_len. = |
| 101 | STAT_MAX_BACKLOGcxx . . $ `src/stat.c:58:9`! * |
| 102 | app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[i].num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.; |
| 103 | |
| 104 | current_context->backlogcxx . . $ round_trip_context#backlog. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(current_context->backlog_lencxx . . $ round_trip_context#backlog_len., |
| 105 | sizeof(struct rtt_entrycxx . . $ rtt_entry#)); |
| 106 | allocation_error |= !current_context->backlogcxx . . $ round_trip_context#backlog.; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | if (allocation_error) |
| 111 | return -ENOMEMcxx . . $ `<external>/8987895939074593727/errno-base.h:16:9`!; |
| 112 | } |
| 113 | |
| 114 | for (i = 0; i < NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.; i++) { |
| 115 | stat_resetcxx . . $ stat_reset(8384f39c9cf29b2f).(&global_statisticscxx . . $ global_statistics.[i]); |
| 116 | stat_resetcxx . . $ stat_reset(8384f39c9cf29b2f).(&statistics_per_periodcxx . . $ statistics_per_period.[i]); |
| 117 | } |
| 118 | |
| 119 | if (app_configcxx . . $ app_config..debug_stop_trace_on_outliercxx . . $ application_config#debug_stop_trace_on_outlier.) { |
| 120 | file_tracing_oncxx . . $ file_tracing_on. = fopencxx . . $ fopen(82ec0787cd37e0a3).("/sys/kernel/debug/tracing/tracing_on", "w"); |
| 121 | if (!file_tracing_oncxx . . $ file_tracing_on.) |
| 122 | return -errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!; |
| 123 | file_trace_markercxx . . $ file_trace_marker. = fopencxx . . $ fopen(82ec0787cd37e0a3).("/sys/kernel/debug/tracing/trace_marker", "w"); |
| 124 | if (!file_trace_markercxx . . $ file_trace_marker.) { |
| 125 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file_tracing_oncxx . . $ file_tracing_on.); |
| 126 | return -errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /* |
| 131 | * The expected round trip limit for RT traffic classes is below < 2 * cycle time. |
| 132 | * Stored in us. |
| 133 | */ |
| 134 | rtt_expected_rt_limitcxx . . $ rtt_expected_rt_limit. = app_configcxx . . $ app_config..application_base_cycle_time_nscxx . . $ application_config#application_base_cycle_time_ns. * 2; |
| 135 | rtt_expected_rt_limitcxx . . $ rtt_expected_rt_limit. /= 1000; |
| 136 | |
| 137 | log_stat_user_selectedcxx . . $ log_stat_user_selected. = log_selection; |
| 138 | |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | void stat_freecxx . . $ stat_free(49f6e7a06ebc5aa8).(void) |
| 143 | { |
| 144 | |
| 145 | for (int i = 0; i < NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.; i++) |
| 146 | freecxx . . $ free(5d22bdacc48458e8).(round_trip_contextscxx . . $ round_trip_contexts.[i].backlogcxx . . $ round_trip_context#backlog.); |
| 147 | |
| 148 | if (app_configcxx . . $ app_config..debug_stop_trace_on_outliercxx . . $ application_config#debug_stop_trace_on_outlier.) { |
| 149 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file_tracing_oncxx . . $ file_tracing_on.); |
| 150 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file_trace_markercxx . . $ file_trace_marker.); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | * This function will be called once per cycle after all Tx threads have been finished. At this |
| 156 | * point in time no one touches global_statistics, because all networking is done. |
| 157 | * |
| 158 | * It copies all *statistics to *statistics_for_log. |
| 159 | */ |
| 160 | void stat_updatecxx . . $ stat_update(49f6e7a06ebc5aa8).(void) |
| 161 | { |
| 162 | static uint64_tcxx . . $ uint64_t# last_ts = 0; |
| 163 | uint64_tcxx . . $ uint64_t# elapsed, curr_time; |
| 164 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! proceed = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 165 | struct timespeccxx . . $ timespec# now; |
| 166 | |
| 167 | clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., &now); |
| 168 | curr_time = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&now); |
| 169 | |
| 170 | if (!last_ts) |
| 171 | last_ts = curr_time; |
| 172 | |
| 173 | elapsed = curr_time - last_ts; |
| 174 | if (elapsed >= app_configcxx . . $ app_config..stats_collection_interval_nscxx . . $ application_config#stats_collection_interval_ns.) { |
| 175 | proceed = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 176 | last_ts = curr_time; |
| 177 | } |
| 178 | |
| 179 | if (!proceed) |
| 180 | return; |
| 181 | |
| 182 | /* Update stats for logging facilities. */ |
| 183 | pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 184 | memcpycxx . . $ memcpy(cc817cb175f282d).(&global_statistics_for_logcxx . . $ global_statistics_for_log., &global_statisticscxx . . $ global_statistics., sizeof(global_statisticscxx . . $ global_statistics.)); |
| 185 | #if defined(WITH_MQTT) |
| 186 | memcpy(&statistics_per_period_for_log, &statistics_per_period, |
| 187 | sizeof(statistics_per_period)); |
| 188 | for (int i = 0; i < NUM_FRAME_TYPES; i++) |
| 189 | stat_reset(&statistics_per_period[i]); |
| 190 | #endif |
| 191 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 192 | |
| 193 | /* Perform reset of global statistics if requested by user. */ |
| 194 | if (reset_statscxx . . $ reset_stats.) { |
| 195 | for (int i = 0; i < NUM_FRAME_TYPEScxx . . $ NUM_FRAME_TYPES.; i++) |
| 196 | stat_resetcxx . . $ stat_reset(8384f39c9cf29b2f).(&global_statisticscxx . . $ global_statistics.[i]); |
| 197 | reset_statscxx . . $ reset_stats. = 0; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | void stat_get_global_statscxx . . $ stat_get_global_stats(36543745c1651445).(struct statisticscxx . . $ statistics# *stats, size_t len) |
| 202 | { |
| 203 | if (len < sizeof(global_statistics_for_logcxx . . $ global_statistics_for_log.)) |
| 204 | return; |
| 205 | |
| 206 | pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 207 | memcpycxx . . $ memcpy(cc817cb175f282d).(stats, &global_statistics_for_logcxx . . $ global_statistics_for_log., sizeof(global_statistics_for_logcxx . . $ global_statistics_for_log.)); |
| 208 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 209 | } |
| 210 | |
| 211 | void stat_get_stats_per_periodcxx . . $ stat_get_stats_per_period(36543745c1651445).(struct statisticscxx . . $ statistics# *stats, size_t len) |
| 212 | { |
| 213 | if (len < sizeof(statistics_per_period_for_logcxx . . $ statistics_per_period_for_log.)) |
| 214 | return; |
| 215 | |
| 216 | pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 217 | memcpycxx . . $ memcpy(cc817cb175f282d).(stats, &statistics_per_period_for_logcxx . . $ statistics_per_period_for_log., sizeof(statistics_per_period_for_logcxx . . $ statistics_per_period_for_log.)); |
| 218 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&global_statistics_mutexcxx . . $ global_statistics_mutex.); |
| 219 | } |
| 220 | |
| 221 | static inline void stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(uint64_tcxx . . $ uint64_t# new_value, uint64_tcxx . . $ uint64_t# *min, uint64_tcxx . . $ uint64_t# *max) |
| 222 | { |
| 223 | *max = (new_value > *max) ? new_value : *max; |
| 224 | *min = (new_value < *min) ? new_value : *min; |
| 225 | } |
| 226 | |
| 227 | static inline size_t get_first_frame_backlog_idxcxx . . $ get_first_frame_backlog_idx(b1aa7907885b8693).(uint64_tcxx . . $ uint64_t# cycle_number, |
| 228 | enum stat_frame_typecxx . . $ stat_frame_type# frame_type, |
| 229 | size_t backlog_len) |
| 230 | { |
| 231 | uint64_tcxx . . $ uint64_t# first_frame_in_cycle = |
| 232 | (cycle_number / app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.) * |
| 233 | app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.; |
| 234 | return first_frame_in_cycle % backlog_len; |
| 235 | } |
| 236 | |
| 237 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! stat_frame_received_commoncxx . . $ stat_frame_received_common(df4ddfbc0e0323a6).(struct statisticscxx . . $ statistics# *stat, enum stat_frame_typecxx . . $ stat_frame_type# frame_type, |
| 238 | uint64_tcxx . . $ uint64_t# rt_time, uint64_tcxx . . $ uint64_t# oneway_time, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! out_of_order, |
| 239 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! payload_mismatch, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! frame_id_mismatch, |
| 240 | uint64_tcxx . . $ uint64_t# rx_hw2app_time, uint64_tcxx . . $ uint64_t# rx_hw2xdp_time, |
| 241 | uint64_tcxx . . $ uint64_t# rx_xdp2app_time) |
| 242 | { |
| 243 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! outlier = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 244 | |
| 245 | if (log_stat_user_selectedcxx . . $ log_stat_user_selected. == LOG_REFERENCEcxx . . $ LOG_REFERENCE.) { |
| 246 | if (stat_frame_type_is_real_timecxx . . $ stat_frame_type_is_real_time(e6c3649086ff187f).(frame_type) && rt_time > rtt_expected_rt_limitcxx . . $ rtt_expected_rt_limit.) { |
| 247 | stat->round_trip_outlierscxx . . $ statistics#round_trip_outliers.++; |
| 248 | outlier = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 249 | } |
| 250 | |
| 251 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(rt_time, &stat->round_trip_mincxx . . $ statistics#round_trip_min., &stat->round_trip_maxcxx . . $ statistics#round_trip_max.); |
| 252 | |
| 253 | stat->round_trip_countcxx . . $ statistics#round_trip_count.++; |
| 254 | stat->round_trip_sumcxx . . $ statistics#round_trip_sum. += rt_time; |
| 255 | stat->round_trip_avgcxx . . $ statistics#round_trip_avg. = stat->round_trip_sumcxx . . $ statistics#round_trip_sum. / (double)stat->round_trip_countcxx . . $ statistics#round_trip_count.; |
| 256 | } |
| 257 | |
| 258 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(oneway_time, &stat->oneway_mincxx . . $ statistics#oneway_min., &stat->oneway_maxcxx . . $ statistics#oneway_max.); |
| 259 | |
| 260 | if (stat_frame_type_is_real_timecxx . . $ stat_frame_type_is_real_time(e6c3649086ff187f).(frame_type) && oneway_time > rtt_expected_rt_limitcxx . . $ rtt_expected_rt_limit. / 2) { |
| 261 | stat->oneway_outlierscxx . . $ statistics#oneway_outliers.++; |
| 262 | outlier = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 263 | } |
| 264 | stat->oneway_countcxx . . $ statistics#oneway_count.++; |
| 265 | stat->oneway_sumcxx . . $ statistics#oneway_sum. += oneway_time; |
| 266 | stat->oneway_avgcxx . . $ statistics#oneway_avg. = stat->oneway_sumcxx . . $ statistics#oneway_sum. / (double)stat->oneway_countcxx . . $ statistics#oneway_count.; |
| 267 | |
| 268 | if (rx_hw2app_time != 0 && rx_hw2xdp_time != 0 && rx_xdp2app_time != 0) { |
| 269 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(rx_hw2app_time, &stat->rx_mincxx . . $ statistics#rx_min., &stat->rx_maxcxx . . $ statistics#rx_max.); |
| 270 | stat->rx_sumcxx . . $ statistics#rx_sum. += rx_hw2app_time; |
| 271 | stat->rx_avgcxx . . $ statistics#rx_avg. = stat->rx_sumcxx . . $ statistics#rx_sum. / (double)stat->oneway_countcxx . . $ statistics#oneway_count.; |
| 272 | |
| 273 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(rx_hw2xdp_time, &stat->rx_hw2xdp_mincxx . . $ statistics#rx_hw2xdp_min., &stat->rx_hw2xdp_maxcxx . . $ statistics#rx_hw2xdp_max.); |
| 274 | stat->rx_hw2xdp_sumcxx . . $ statistics#rx_hw2xdp_sum. += rx_hw2xdp_time; |
| 275 | stat->rx_hw2xdp_avgcxx . . $ statistics#rx_hw2xdp_avg. = stat->rx_hw2xdp_sumcxx . . $ statistics#rx_hw2xdp_sum. / (double)stat->oneway_countcxx . . $ statistics#oneway_count.; |
| 276 | |
| 277 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(rx_xdp2app_time, &stat->rx_xdp2app_mincxx . . $ statistics#rx_xdp2app_min., &stat->rx_xdp2app_maxcxx . . $ statistics#rx_xdp2app_max.); |
| 278 | stat->rx_xdp2app_sumcxx . . $ statistics#rx_xdp2app_sum. += rx_xdp2app_time; |
| 279 | stat->rx_xdp2app_avgcxx . . $ statistics#rx_xdp2app_avg. = stat->rx_xdp2app_sumcxx . . $ statistics#rx_xdp2app_sum. / (double)stat->oneway_countcxx . . $ statistics#oneway_count.; |
| 280 | } |
| 281 | |
| 282 | stat->frames_receivedcxx . . $ statistics#frames_received.++; |
| 283 | stat->out_of_order_errorscxx . . $ statistics#out_of_order_errors. += out_of_order; |
| 284 | stat->payload_errorscxx . . $ statistics#payload_errors. += payload_mismatch; |
| 285 | stat->frame_id_errorscxx . . $ statistics#frame_id_errors. += frame_id_mismatch; |
| 286 | |
| 287 | return outlier; |
| 288 | } |
| 289 | |
| 290 | #ifdef TX_TIMESTAMP |
| 291 | static void stat_frame_sent_latency_common(struct statistics *stat, enum stat_frame_type frame_type, |
| 292 | uint64_t tx_latency_us) |
| 293 | { |
| 294 | stat_update_min_max(tx_latency_us, &stat->tx_min, &stat->tx_max); |
| 295 | |
| 296 | stat->tx_count++; |
| 297 | stat->tx_sum += tx_latency_us; |
| 298 | stat->tx_avg = stat->tx_sum / (double)stat->tx_count; |
| 299 | } |
| 300 | |
| 301 | static void stat_frame_proc_first_common(struct statistics *stat, enum stat_frame_type frame_type, |
| 302 | uint64_t proc_first_us) |
| 303 | { |
| 304 | stat_update_min_max(proc_first_us, &stat->proc_first_min, &stat->proc_first_max); |
| 305 | stat->proc_first_count++; |
| 306 | stat->proc_first_sum += proc_first_us; |
| 307 | stat->proc_first_avg = stat->proc_first_sum / (double)stat->proc_first_count; |
| 308 | } |
| 309 | |
| 310 | static void stat_frame_proc_batch_common(struct statistics *stat, enum stat_frame_type frame_type, |
| 311 | uint64_t proc_batch_us) |
| 312 | { |
| 313 | stat_update_min_max(proc_batch_us, &stat->proc_batch_min, &stat->proc_batch_max); |
| 314 | stat->proc_batch_count++; |
| 315 | stat->proc_batch_sum += proc_batch_us; |
| 316 | stat->proc_batch_avg = stat->proc_batch_sum / (double)stat->proc_batch_count; |
| 317 | } |
| 318 | #endif |
| 319 | |
| 320 | #if defined(WITH_MQTT) |
| 321 | static void stat_frame_received_per_period(enum stat_frame_type frame_type, uint64_t curr_time, |
| 322 | uint64_t rt_time, uint64_t oneway_time, |
| 323 | bool out_of_order, bool payload_mismatch, |
| 324 | bool frame_id_mismatch, uint64_t rx_hw2app_time, |
| 325 | uint64_t rx_hw2xdp_time, uint64_t rx_xdp2app_time) |
| 326 | { |
| 327 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 328 | |
| 329 | stat_per_period->time_stamp = curr_time; |
| 330 | stat_frame_received_common(stat_per_period, frame_type, rt_time, oneway_time, out_of_order, |
| 331 | payload_mismatch, frame_id_mismatch, rx_hw2app_time, |
| 332 | rx_hw2xdp_time, rx_xdp2app_time); |
| 333 | } |
| 334 | |
| 335 | static void stat_frame_sent_per_period(enum stat_frame_type frame_type) |
| 336 | { |
| 337 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 338 | |
| 339 | /* Just increment the Tx counter. The reset per period is done by the Rx part. */ |
| 340 | stat_per_period->frames_sent++; |
| 341 | } |
| 342 | |
| 343 | static void stat_frame_workload_per_period(enum stat_frame_type frame_type, uint64_t workload_time) |
| 344 | { |
| 345 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 346 | |
| 347 | if (stat_per_period->rx_workload_count > |
| 348 | app_config.classes[frame_type].rx_workload_skip_count) { |
| 349 | stat_update_min_max(workload_time, &stat_per_period->rx_workload_min, |
| 350 | &stat_per_period->rx_workload_max); |
| 351 | } |
| 352 | |
| 353 | stat_per_period->rx_workload_count++; |
| 354 | stat_per_period->rx_workload_sum += workload_time; |
| 355 | stat_per_period->rx_workload_avg = |
| 356 | stat_per_period->rx_workload_sum / (double)stat_per_period->rx_workload_count; |
| 357 | } |
| 358 | |
| 359 | #ifdef TX_TIMESTAMP |
| 360 | static void stat_frame_sent_latency_per_period(enum stat_frame_type frame_type, |
| 361 | uint64_t tx_latency_us) |
| 362 | { |
| 363 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 364 | |
| 365 | stat_frame_sent_latency_common(stat_per_period, frame_type, tx_latency_us); |
| 366 | } |
| 367 | |
| 368 | static void stat_frame_proc_first_per_period(enum stat_frame_type frame_type, |
| 369 | uint64_t proc_first_us) |
| 370 | { |
| 371 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 372 | |
| 373 | stat_frame_proc_first_common(stat_per_period, frame_type, proc_first_us); |
| 374 | } |
| 375 | |
| 376 | static void stat_frame_proc_batch_per_period(enum stat_frame_type frame_type, |
| 377 | uint64_t proc_batch_us) |
| 378 | { |
| 379 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 380 | |
| 381 | stat_frame_proc_batch_common(stat_per_period, frame_type, proc_batch_us); |
| 382 | } |
| 383 | #endif |
| 384 | #else |
| 385 | static void stat_frame_received_per_periodcxx . . $ stat_frame_received_per_period(75257b897bae9d05).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# curr_time, |
| 386 | uint64_tcxx . . $ uint64_t# rt_time, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! out_of_order, |
| 387 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! payload_mismatch, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! frame_id_mismatch, |
| 388 | uint64_tcxx . . $ uint64_t# tx_timestamp, uint64_tcxx . . $ uint64_t# rx_hw2app_time, |
| 389 | uint64_tcxx . . $ uint64_t# rx_hw2xdp_time, uint64_tcxx . . $ uint64_t# rx_xdp2app_time) |
| 390 | { |
| 391 | } |
| 392 | |
| 393 | static void stat_frame_sent_per_periodcxx . . $ stat_frame_sent_per_period(163d8b1aefebb495).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type) |
| 394 | { |
| 395 | } |
| 396 | |
| 397 | static void stat_frame_workload_per_periodcxx . . $ stat_frame_workload_per_period(ca48c151307d73b6).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# workload_time) |
| 398 | { |
| 399 | } |
| 400 | #ifdef TX_TIMESTAMP |
| 401 | static void stat_frame_sent_latency_per_period(enum stat_frame_type frame_type, |
| 402 | uint64_t tx_latency_us) |
| 403 | { |
| 404 | } |
| 405 | |
| 406 | static void stat_frame_proc_first_per_period(enum stat_frame_type frame_type, |
| 407 | uint64_t proc_first_us) |
| 408 | { |
| 409 | } |
| 410 | |
| 411 | static void stat_frame_proc_batch_per_period(enum stat_frame_type frame_type, |
| 412 | uint64_t proc_batch_us) |
| 413 | { |
| 414 | } |
| 415 | #endif |
| 416 | #endif |
| 417 | |
| 418 | void stat_frame_sentcxx . . $ stat_frame_sent(ca48c151307d73b6).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# cycle_number) |
| 419 | { |
| 420 | /* Single frame is just a batch operation with count=1 */ |
| 421 | stat_frames_sent_batchcxx . . $ stat_frames_sent_batch(1b9110cae93061b5).(frame_type, cycle_number, 1); |
| 422 | } |
| 423 | |
| 424 | void stat_frames_sent_batchcxx . . $ stat_frames_sent_batch(1b9110cae93061b5).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# cycle_number, |
| 425 | uint64_tcxx . . $ uint64_t# frame_count) |
| 426 | { |
| 427 | struct round_trip_contextcxx . . $ round_trip_context# *rtt = &round_trip_contextscxx . . $ round_trip_contexts.[frame_type]; |
| 428 | struct statisticscxx . . $ statistics# *stat = &global_statisticscxx . . $ global_statistics.[frame_type]; |
| 429 | size_t idx = cycle_number % rtt->backlog_lencxx . . $ round_trip_context#backlog_len.; |
| 430 | struct timespeccxx . . $ timespec# tx_time = {}; |
| 431 | |
| 432 | if (frame_count == 1) { |
| 433 | log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "%s: frame[%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "] sent\n", |
| 434 | stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), cycle_number); |
| 435 | } else { |
| 436 | log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "%s: %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " frames[%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "] sent\n", |
| 437 | stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), frame_count, cycle_number); |
| 438 | } |
| 439 | |
| 440 | if ((log_stat_user_selectedcxx . . $ log_stat_user_selected. == LOG_REFERENCEcxx . . $ LOG_REFERENCE. || |
| 441 | log_stat_user_selectedcxx . . $ log_stat_user_selected. == LOG_TX_TIMESTAMPScxx . . $ LOG_TX_TIMESTAMPS.) && |
| 442 | rtt->backlogcxx . . $ round_trip_context#backlog.) { |
| 443 | /* Record Tx SW timestamp for the first frame in the cycle */ |
| 444 | clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., &tx_time); |
| 445 | rtt->backlogcxx . . $ round_trip_context#backlog.[idx].sw_tscxx . . $ rtt_entry#sw_ts. = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&tx_time); |
| 446 | } |
| 447 | |
| 448 | /* Increment stats by frame_count */ |
| 449 | for (uint64_tcxx . . $ uint64_t# i = 0; i < frame_count; i++) { |
| 450 | stat_frame_sent_per_periodcxx . . $ stat_frame_sent_per_period(163d8b1aefebb495).(frame_type); |
| 451 | } |
| 452 | stat->frames_sentcxx . . $ statistics#frames_sent. += frame_count; |
| 453 | } |
| 454 | |
| 455 | #ifdef TX_TIMESTAMP |
| 456 | void stat_frame_sent_latency(enum stat_frame_type frame_type, uint64_t seq) |
| 457 | { |
| 458 | bool hwtstamp_enabled = app_config.classes[frame_type].tx_hwtstamp_enabled; |
| 459 | struct statistics *stat_per_period = &statistics_per_period[frame_type]; |
| 460 | struct round_trip_context *rtt = &round_trip_contexts[frame_type]; |
| 461 | struct statistics *stat = &global_statistics[frame_type]; |
| 462 | size_t idx = seq % rtt->backlog_len; |
| 463 | uint64_t sw_ts = rtt->backlog[idx].sw_ts; |
| 464 | uint64_t hw_ts = rtt->backlog[idx].hw_ts; |
| 465 | |
| 466 | if (!hwtstamp_enabled) { |
| 467 | log_message(LOG_LEVEL_INFO, |
| 468 | "TxLatency [%s] HW timestamping disabled — skipping Tx latency stat\n", |
| 469 | stat_frame_type_to_string(frame_type)); |
| 470 | return; |
| 471 | } |
| 472 | |
| 473 | /* Check if we've already processed this timestamp (hw_ts was cleared) */ |
| 474 | if (sw_ts != 0 && hw_ts == 0) { |
| 475 | log_message(LOG_LEVEL_DEBUG, |
| 476 | "TxLatency [%s] Seq %" PRIu64 ": Already processed, skipping\n", |
| 477 | stat_frame_type_to_string(frame_type), seq); |
| 478 | return; |
| 479 | } |
| 480 | |
| 481 | if (hw_ts > sw_ts) { |
| 482 | int64_t latency = (int64_t)(hw_ts - sw_ts); |
| 483 | |
| 484 | latency /= 1000; |
| 485 | |
| 486 | log_message(LOG_LEVEL_DEBUG, |
| 487 | "TxLatency [%s] Seq %" PRIu64 |
| 488 | ": SW %llu ns, HW %llu ns, latency %lld us, idx=%zu\n", |
| 489 | stat_frame_type_to_string(frame_type), seq, (unsigned long long)sw_ts, |
| 490 | (unsigned long long)hw_ts, (long long)latency, idx); |
| 491 | |
| 492 | /* Update global stats */ |
| 493 | stat_frame_sent_latency_common(stat, frame_type, latency); |
| 494 | |
| 495 | /* Update stats per collection interval */ |
| 496 | stat_frame_sent_latency_per_period(frame_type, latency); |
| 497 | |
| 498 | /* Clear HW timestamp to prevent double processing */ |
| 499 | rtt->backlog[idx].hw_ts = 0; |
| 500 | |
| 501 | } else { |
| 502 | /* If HW timestamp isn't available after 1 cycle, consider it a miss */ |
| 503 | stat->tx_hw_timestamp_missing++; |
| 504 | stat_per_period->tx_hw_timestamp_missing++; |
| 505 | |
| 506 | log_message(LOG_LEVEL_DEBUG, |
| 507 | "TxLatency [%s] Seq %" PRIu64 |
| 508 | ": No HW timestamp available after 1 cycle (SW %llu ns), idx=%zu\n", |
| 509 | stat_frame_type_to_string(frame_type), seq, (unsigned long long)sw_ts, |
| 510 | idx); |
| 511 | } |
| 512 | } |
| 513 | #endif |
| 514 | |
| 515 | void stat_frame_receivedcxx . . $ stat_frame_received(5534a29e0120fff).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# cycle_number, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! out_of_order, |
| 516 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! payload_mismatch, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! frame_id_mismatch, uint64_tcxx . . $ uint64_t# tx_timestamp, |
| 517 | uint64_tcxx . . $ uint64_t# rx_hw_timestamp, uint64_tcxx . . $ uint64_t# rx_sw_timestamp) |
| 518 | { |
| 519 | struct round_trip_contextcxx . . $ round_trip_context# *rtt = &round_trip_contextscxx . . $ round_trip_contexts.[frame_type]; |
| 520 | const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! histogram = app_configcxx . . $ app_config..stats_histogram_enabledcxx . . $ application_config#stats_histogram_enabled.; |
| 521 | struct statisticscxx . . $ statistics# *stat = &global_statisticscxx . . $ global_statistics.[frame_type]; |
| 522 | uint64_tcxx . . $ uint64_t# rt_time = 0, curr_time, oneway_time, rx_hw2app_time, rx_hw2xdp_time, |
| 523 | rx_xdp2app_time; |
| 524 | struct timespeccxx . . $ timespec# rx_time = {}; |
| 525 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! outlier = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 526 | |
| 527 | log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "%s: frame[%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "] received\n", |
| 528 | stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), cycle_number); |
| 529 | |
| 530 | /* Record Rx timestamp in us */ |
| 531 | clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., &rx_time); |
| 532 | curr_time = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&rx_time); |
| 533 | |
| 534 | /* Store RX HW timestamp for ProFirst and ProBatch latency measurement at Mirror */ |
| 535 | if (log_stat_user_selectedcxx . . $ log_stat_user_selected. == LOG_TX_TIMESTAMPScxx . . $ LOG_TX_TIMESTAMPS. && |
| 536 | app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled. && config_have_rx_timestampcxx . . $ config_have_rx_timestamp(c9857a73d68e59ba).() && |
| 537 | rx_hw_timestamp != 0 && rtt->backlogcxx . . $ round_trip_context#backlog.) { |
| 538 | /* Check if this is the first frame of the cycle */ |
| 539 | uint64_tcxx . . $ uint64_t# frame_in_cycle = |
| 540 | cycle_number % app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].num_frames_per_cyclecxx . . $ traffic_class_config#num_frames_per_cycle.; |
| 541 | if (frame_in_cycle == 0) { |
| 542 | size_t idx = get_first_frame_backlog_idxcxx . . $ get_first_frame_backlog_idx(b1aa7907885b8693).(cycle_number, frame_type, |
| 543 | rtt->backlog_lencxx . . $ round_trip_context#backlog_len.); |
| 544 | rtt->backlogcxx . . $ round_trip_context#backlog.[idx].rx_hw_tscxx . . $ rtt_entry#rx_hw_ts. = rx_hw_timestamp; |
| 545 | |
| 546 | log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., |
| 547 | "%s: Stored RX HW timestamp %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " for cycle %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! |
| 548 | ", idx=%zu\n", |
| 549 | stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), rx_hw_timestamp, |
| 550 | cycle_number, idx); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | if (log_stat_user_selectedcxx . . $ log_stat_user_selected. == LOG_REFERENCEcxx . . $ LOG_REFERENCE.) { |
| 555 | uint64_tcxx . . $ uint64_t# tx_sw_ts; |
| 556 | size_t backlog_idx; |
| 557 | |
| 558 | /* Determine which timestamp to use based on TX HW timestamp configuration */ |
| 559 | if (app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].tx_hwtstamp_enabledcxx . . $ traffic_class_config#tx_hwtstamp_enabled.) { |
| 560 | /* |
| 561 | * When TX HW timestamping is enabled, only first frame of each cycle has |
| 562 | * timestamp |
| 563 | */ |
| 564 | backlog_idx = get_first_frame_backlog_idxcxx . . $ get_first_frame_backlog_idx(b1aa7907885b8693).(cycle_number, frame_type, |
| 565 | rtt->backlog_lencxx . . $ round_trip_context#backlog_len.); |
| 566 | tx_sw_ts = rtt->backlogcxx . . $ round_trip_context#backlog.[backlog_idx].sw_tscxx . . $ rtt_entry#sw_ts.; |
| 567 | } else { |
| 568 | /* When TX HW timestamping is disabled, each frame has its own timestamp */ |
| 569 | backlog_idx = cycle_number % rtt->backlog_lencxx . . $ round_trip_context#backlog_len.; |
| 570 | tx_sw_ts = rtt->backlogcxx . . $ round_trip_context#backlog.[backlog_idx].sw_tscxx . . $ rtt_entry#sw_ts.; |
| 571 | } |
| 572 | |
| 573 | /* Calc Round Trip Time */ |
| 574 | if (tx_sw_ts != 0) { |
| 575 | rt_time = curr_time - tx_sw_ts; |
| 576 | rt_time /= 1000; |
| 577 | } else { |
| 578 | rt_time = 0; |
| 579 | } |
| 580 | |
| 581 | /* Update histogram */ |
| 582 | if (histogram) |
| 583 | histogram_updatecxx . . $ histogram_update(ca48c151307d73b6).(frame_type, rt_time); |
| 584 | } |
| 585 | |
| 586 | /* Calc Oneway Time */ |
| 587 | oneway_time = curr_time - tx_timestamp; |
| 588 | oneway_time /= 1000; |
| 589 | |
| 590 | if (rx_hw_timestamp != 0 && rx_sw_timestamp != 0) { |
| 591 | /* Calculate Rx times */ |
| 592 | rx_hw2app_time = curr_time - rx_hw_timestamp; |
| 593 | rx_hw2app_time /= 1000; |
| 594 | rx_hw2xdp_time = rx_sw_timestamp - rx_hw_timestamp; |
| 595 | rx_hw2xdp_time /= 1000; |
| 596 | rx_xdp2app_time = curr_time - rx_sw_timestamp; |
| 597 | rx_xdp2app_time /= 1000; |
| 598 | } else { |
| 599 | /* If one of the timestamp is not available, set them to zero */ |
| 600 | rx_hw2app_time = 0; |
| 601 | rx_hw2xdp_time = 0; |
| 602 | rx_xdp2app_time = 0; |
| 603 | } |
| 604 | |
| 605 | /* Update global stats */ |
| 606 | outlier = stat_frame_received_commoncxx . . $ stat_frame_received_common(df4ddfbc0e0323a6).(stat, frame_type, rt_time, oneway_time, out_of_order, |
| 607 | payload_mismatch, frame_id_mismatch, rx_hw2app_time, |
| 608 | rx_hw2xdp_time, rx_xdp2app_time); |
| 609 | |
| 610 | /* Update stats per collection interval */ |
| 611 | stat_frame_received_per_periodcxx . . $ stat_frame_received_per_period(75257b897bae9d05).(frame_type, curr_time, rt_time, oneway_time, out_of_order, |
| 612 | payload_mismatch, frame_id_mismatch, rx_hw2app_time, |
| 613 | rx_hw2xdp_time, rx_xdp2app_time); |
| 614 | |
| 615 | /* Stop tracing after certain amount of time */ |
| 616 | if (app_configcxx . . $ app_config..debug_stop_trace_on_outliercxx . . $ application_config#debug_stop_trace_on_outlier. && outlier) { |
| 617 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(file_trace_markercxx . . $ file_trace_marker., |
| 618 | "Outlier hit: %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " [us] -- Type: %s -- Cycle Counter: %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "\n", |
| 619 | rt_time ? rt_time : oneway_time, stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), |
| 620 | cycle_number); |
| 621 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(file_tracing_oncxx . . $ file_tracing_on., "0\n"); |
| 622 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 623 | "Outlier hit: %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! " [us] -- Type: %s -- Cycle Counter: %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "\n", |
| 624 | rt_time ? rt_time : oneway_time, stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), |
| 625 | cycle_number); |
| 626 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file_trace_markercxx . . $ file_trace_marker.); |
| 627 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file_tracing_oncxx . . $ file_tracing_on.); |
| 628 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | #ifdef TX_TIMESTAMP |
| 633 | void stat_proc_first_latency(enum stat_frame_type frame_type, uint64_t cycle_number, |
| 634 | uint64_t tx_hw_timestamp) |
| 635 | { |
| 636 | struct round_trip_context *rtt = &round_trip_contexts[frame_type]; |
| 637 | struct statistics *stat = &global_statistics[frame_type]; |
| 638 | size_t idx = get_first_frame_backlog_idx(cycle_number, frame_type, rtt->backlog_len); |
| 639 | uint64_t rx_hw_ts = rtt->backlog[idx].rx_hw_ts; |
| 640 | |
| 641 | /* Ensure both RX and TX hardware timestamps are enabled */ |
| 642 | if (!config_have_rx_timestamp() || !app_config.classes[frame_type].tx_hwtstamp_enabled) { |
| 643 | log_message(LOG_LEVEL_DEBUG, |
| 644 | "ProcFirst [%s] Cycle %" PRIu64 |
| 645 | ": Hardware timestamping not fully enabled (RX: %s, TX: %s)\n", |
| 646 | stat_frame_type_to_string(frame_type), cycle_number, |
| 647 | config_have_rx_timestamp() ? "enabled" : "disabled", |
| 648 | app_config.classes[frame_type].tx_hwtstamp_enabled ? "enabled" |
| 649 | : "disabled"); |
| 650 | return; |
| 651 | } |
| 652 | |
| 653 | if (rx_hw_ts == 0 || tx_hw_timestamp == 0) { |
| 654 | log_message(LOG_LEVEL_DEBUG, |
| 655 | "ProcFirst [%s] Cycle %" PRIu64 ": Missing timestamp (RX HW: %" PRIu64 |
| 656 | ", TX HW: %" PRIu64 ")\n", |
| 657 | stat_frame_type_to_string(frame_type), cycle_number, rx_hw_ts, |
| 658 | tx_hw_timestamp); |
| 659 | return; |
| 660 | } |
| 661 | |
| 662 | if (tx_hw_timestamp > rx_hw_ts) { |
| 663 | uint64_t proc_first_latency = (tx_hw_timestamp - rx_hw_ts) / 1000; |
| 664 | |
| 665 | log_message(LOG_LEVEL_DEBUG, |
| 666 | "ProcFirst [%s] Cycle %" PRIu64 ": %" PRIu64 " us (RX HW: %" PRIu64 |
| 667 | ", TX HW: %" PRIu64 ")\n", |
| 668 | stat_frame_type_to_string(frame_type), cycle_number, proc_first_latency, |
| 669 | rx_hw_ts, tx_hw_timestamp); |
| 670 | |
| 671 | /* Update global stats */ |
| 672 | stat_frame_proc_first_common(stat, frame_type, proc_first_latency); |
| 673 | |
| 674 | /* Update stats per collection interval */ |
| 675 | stat_frame_proc_first_per_period(frame_type, proc_first_latency); |
| 676 | |
| 677 | /* Not clearing RX HW timestamp here - it will be cleared by ProcBatch */ |
| 678 | } else { |
| 679 | log_message(LOG_LEVEL_DEBUG, |
| 680 | "ProcFirst [%s] Cycle %" PRIu64 ": TX HW timestamp (%" PRIu64 |
| 681 | ") <= RX HW timestamp (%" PRIu64 ")\n", |
| 682 | stat_frame_type_to_string(frame_type), cycle_number, tx_hw_timestamp, |
| 683 | rx_hw_ts); |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | void stat_proc_batch_latency(enum stat_frame_type frame_type, uint64_t cycle_number, |
| 688 | uint64_t last_tx_hw_timestamp) |
| 689 | { |
| 690 | struct round_trip_context *rtt = &round_trip_contexts[frame_type]; |
| 691 | struct statistics *stat = &global_statistics[frame_type]; |
| 692 | size_t idx = get_first_frame_backlog_idx(cycle_number, frame_type, rtt->backlog_len); |
| 693 | uint64_t rx_hw_ts = rtt->backlog[idx].rx_hw_ts; |
| 694 | |
| 695 | /* Clear RX HW timestamp after both ProcFirst and ProcBatch are processed. */ |
| 696 | rtt->backlog[idx].rx_hw_ts = 0; |
| 697 | |
| 698 | /* Ensure both RX and TX hardware timestamps are enabled */ |
| 699 | if (!config_have_rx_timestamp() || !app_config.classes[frame_type].tx_hwtstamp_enabled) { |
| 700 | log_message(LOG_LEVEL_DEBUG, |
| 701 | "ProcBatch [%s] Cycle %" PRIu64 |
| 702 | ": Hardware timestamping not fully enabled (RX: %s, TX: %s)\n", |
| 703 | stat_frame_type_to_string(frame_type), cycle_number, |
| 704 | config_have_rx_timestamp() ? "enabled" : "disabled", |
| 705 | app_config.classes[frame_type].tx_hwtstamp_enabled ? "enabled" |
| 706 | : "disabled"); |
| 707 | return; |
| 708 | } |
| 709 | |
| 710 | if (rx_hw_ts == 0 || last_tx_hw_timestamp == 0) { |
| 711 | log_message(LOG_LEVEL_DEBUG, |
| 712 | "ProcBatch [%s] Cycle %" PRIu64 ": Missing timestamp (RX HW: %" PRIu64 |
| 713 | ", Last TX HW: %" PRIu64 ")\n", |
| 714 | stat_frame_type_to_string(frame_type), cycle_number, rx_hw_ts, |
| 715 | last_tx_hw_timestamp); |
| 716 | return; |
| 717 | } |
| 718 | |
| 719 | if (last_tx_hw_timestamp > rx_hw_ts) { |
| 720 | uint64_t proc_batch_latency = (last_tx_hw_timestamp - rx_hw_ts) / 1000; |
| 721 | |
| 722 | log_message(LOG_LEVEL_DEBUG, |
| 723 | "ProcBatch [%s] Cycle %" PRIu64 ": %" PRIu64 " us (1st RX HW: %" PRIu64 |
| 724 | ", Last TX HW: %" PRIu64 ")\n", |
| 725 | stat_frame_type_to_string(frame_type), cycle_number, proc_batch_latency, |
| 726 | rx_hw_ts, last_tx_hw_timestamp); |
| 727 | |
| 728 | /* Update global stats */ |
| 729 | stat_frame_proc_batch_common(stat, frame_type, proc_batch_latency); |
| 730 | |
| 731 | /* Update stats per collection interval */ |
| 732 | stat_frame_proc_batch_per_period(frame_type, proc_batch_latency); |
| 733 | } else { |
| 734 | log_message(LOG_LEVEL_DEBUG, |
| 735 | "ProcBatch [%s] Cycle %" PRIu64 ": Last TX HW timestamp (%" PRIu64 |
| 736 | ") <= RX HW timestamp (%" PRIu64 ")\n", |
| 737 | stat_frame_type_to_string(frame_type), cycle_number, |
| 738 | last_tx_hw_timestamp, rx_hw_ts); |
| 739 | } |
| 740 | } |
| 741 | #endif |
| 742 | |
| 743 | void stat_frame_workloadcxx . . $ stat_frame_workload(de8748302dcb85c).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type, uint64_tcxx . . $ uint64_t# cycle_number, |
| 744 | struct timespeccxx . . $ timespec# start_ts) |
| 745 | { |
| 746 | struct statisticscxx . . $ statistics# *stat = &global_statisticscxx . . $ global_statistics.[frame_type]; |
| 747 | uint64_tcxx . . $ uint64_t# workload_time = 0, curr_time, start_time; |
| 748 | struct timespeccxx . . $ timespec# clk_time = {}; |
| 749 | |
| 750 | log_messagecxx . . $ log_message(171546b8a219727a).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "%s: frame[%" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "] workload_complete\n", |
| 751 | stat_frame_type_to_stringcxx . . $ stat_frame_type_to_string(413bfe925ee921da).(frame_type), cycle_number); |
| 752 | |
| 753 | clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(app_configcxx . . $ app_config..application_clock_idcxx . . $ application_config#application_clock_id., &clk_time); |
| 754 | curr_time = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&clk_time); |
| 755 | start_time = ts_to_nscxx . . $ ts_to_ns(3d5e857b70563169).(&start_ts); |
| 756 | |
| 757 | workload_time = curr_time - start_time; |
| 758 | workload_time /= 1000; |
| 759 | |
| 760 | if (stat->rx_workload_countcxx . . $ statistics#rx_workload_count. > app_configcxx . . $ app_config..classescxx . . $ application_config#classes.[frame_type].rx_workload_skip_countcxx . . $ traffic_class_config#rx_workload_skip_count.) { |
| 761 | stat_update_min_maxcxx . . $ stat_update_min_max(c9f1a433d85a5e7c).(workload_time, &stat->rx_workload_mincxx . . $ statistics#rx_workload_min., &stat->rx_workload_maxcxx . . $ statistics#rx_workload_max.); |
| 762 | } |
| 763 | |
| 764 | stat->rx_workload_countcxx . . $ statistics#rx_workload_count.++; |
| 765 | stat->rx_workload_sumcxx . . $ statistics#rx_workload_sum. += workload_time; |
| 766 | stat->rx_workload_avgcxx . . $ statistics#rx_workload_avg. = stat->rx_workload_sumcxx . . $ statistics#rx_workload_sum. / (double)stat->rx_workload_countcxx . . $ statistics#rx_workload_count.; |
| 767 | |
| 768 | /* Update stats per collection interval */ |
| 769 | stat_frame_workload_per_periodcxx . . $ stat_frame_workload_per_period(ca48c151307d73b6).(frame_type, workload_time); |
| 770 | } |
| 771 | |
| 772 | void stat_inc_workload_outliercxx . . $ stat_inc_workload_outlier(163d8b1aefebb495).(enum stat_frame_typecxx . . $ stat_frame_type# frame_type) |
| 773 | { |
| 774 | struct statisticscxx . . $ statistics# *stat = &global_statisticscxx . . $ global_statistics.[frame_type]; |
| 775 | |
| 776 | stat->rx_workload_outlierscxx . . $ statistics#rx_workload_outliers.++; |
| 777 | } |
| 778 | |
| 779 | static int json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(char **buffer, size_t *len, int ret) |
| 780 | { |
| 781 | /* Error? */ |
| 782 | if (ret < 0) |
| 783 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 784 | |
| 785 | /* Buffer too small? */ |
| 786 | if (ret >= *len) |
| 787 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 788 | |
| 789 | /* All good */ |
| 790 | *buffer += ret; |
| 791 | *len -= ret; |
| 792 | |
| 793 | return 0; |
| 794 | } |
| 795 | |
| 796 | static int append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(char **buffer, size_t *len, const char *stat, uint64_tcxx . . $ uint64_t# value) |
| 797 | { |
| 798 | int ret; |
| 799 | |
| 800 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(*buffer, *len, "\"%s\": %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! ",\n", stat, value); |
| 801 | |
| 802 | return json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(buffer, len, ret); |
| 803 | } |
| 804 | |
| 805 | static int last_jlog_u64cxx . . $ last_jlog_u64(6770e22e10bfb8bf).(char **buffer, size_t *len, const char *stat, uint64_tcxx . . $ uint64_t# value) |
| 806 | { |
| 807 | int ret; |
| 808 | |
| 809 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(*buffer, *len, "\"%s\": %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! "\n", stat, value); |
| 810 | |
| 811 | return json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(buffer, len, ret); |
| 812 | } |
| 813 | |
| 814 | static int append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(char **buffer, size_t *len, const char *stat, float value) |
| 815 | { |
| 816 | int ret; |
| 817 | |
| 818 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(*buffer, *len, "\"%s\": %lf,\n", stat, value); |
| 819 | |
| 820 | return json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(buffer, len, ret); |
| 821 | } |
| 822 | |
| 823 | int stat_to_jsoncxx . . $ stat_to_json(fc2a9ca47478af75).(char *json, size_t len, const struct statisticscxx . . $ statistics# *stat, const char *tc, |
| 824 | const char *measurement) |
| 825 | { |
| 826 | int ret; |
| 827 | |
| 828 | /* JSON header */ |
| 829 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(json, len, |
| 830 | "{\"reference\" :\n" |
| 831 | "{\"Timestamp\" : %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! ",\n" |
| 832 | "\"MeasurementName\" : \"%s\",\n" |
| 833 | "\"stats\" : \n" |
| 834 | "{\n" |
| 835 | "\"TCName\" : \"%s\",\n", |
| 836 | stat->time_stampcxx . . $ statistics#time_stamp., measurement, tc); |
| 837 | ret = json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(&json, &len, ret); |
| 838 | if (ret) |
| 839 | return ret; |
| 840 | |
| 841 | /* JSON statistics */ |
| 842 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "FramesSent", stat->frames_sentcxx . . $ statistics#frames_sent.); |
| 843 | if (ret) |
| 844 | return ret; |
| 845 | |
| 846 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "FramesReceived", stat->frames_receivedcxx . . $ statistics#frames_received.); |
| 847 | if (ret) |
| 848 | return ret; |
| 849 | |
| 850 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RoundTripTimeMin", stat->round_trip_mincxx . . $ statistics#round_trip_min.); |
| 851 | if (ret) |
| 852 | return ret; |
| 853 | |
| 854 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RoundTripMax", stat->round_trip_maxcxx . . $ statistics#round_trip_max.); |
| 855 | if (ret) |
| 856 | return ret; |
| 857 | |
| 858 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "RoundTripAv", stat->round_trip_avgcxx . . $ statistics#round_trip_avg.); |
| 859 | if (ret) |
| 860 | return ret; |
| 861 | |
| 862 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "OnewayMin", stat->oneway_mincxx . . $ statistics#oneway_min.); |
| 863 | if (ret) |
| 864 | return ret; |
| 865 | |
| 866 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "OnewayMax", stat->oneway_maxcxx . . $ statistics#oneway_max.); |
| 867 | if (ret) |
| 868 | return ret; |
| 869 | |
| 870 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "OnewayAv", stat->oneway_avgcxx . . $ statistics#oneway_avg.); |
| 871 | if (ret) |
| 872 | return ret; |
| 873 | |
| 874 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "ProcFirstMin", stat->proc_first_mincxx . . $ statistics#proc_first_min.); |
| 875 | if (ret) |
| 876 | return ret; |
| 877 | |
| 878 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "ProcFirstMax", stat->proc_first_maxcxx . . $ statistics#proc_first_max.); |
| 879 | if (ret) |
| 880 | return ret; |
| 881 | |
| 882 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "ProcFirstAv", stat->proc_first_avgcxx . . $ statistics#proc_first_avg.); |
| 883 | if (ret) |
| 884 | return ret; |
| 885 | |
| 886 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "ProcBatchMin", stat->proc_batch_mincxx . . $ statistics#proc_batch_min.); |
| 887 | if (ret) |
| 888 | return ret; |
| 889 | |
| 890 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "ProcBatchMax", stat->proc_batch_maxcxx . . $ statistics#proc_batch_max.); |
| 891 | if (ret) |
| 892 | return ret; |
| 893 | |
| 894 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "ProcBatchAv", stat->proc_batch_avgcxx . . $ statistics#proc_batch_avg.); |
| 895 | if (ret) |
| 896 | return ret; |
| 897 | |
| 898 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxMin", stat->rx_mincxx . . $ statistics#rx_min.); |
| 899 | if (ret) |
| 900 | return ret; |
| 901 | |
| 902 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxMax", stat->rx_maxcxx . . $ statistics#rx_max.); |
| 903 | if (ret) |
| 904 | return ret; |
| 905 | |
| 906 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "RxAv", stat->rx_avgcxx . . $ statistics#rx_avg.); |
| 907 | if (ret) |
| 908 | return ret; |
| 909 | |
| 910 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxHw2XdpMin", stat->rx_hw2xdp_mincxx . . $ statistics#rx_hw2xdp_min.); |
| 911 | if (ret) |
| 912 | return ret; |
| 913 | |
| 914 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxHw2XdpMax", stat->rx_hw2xdp_maxcxx . . $ statistics#rx_hw2xdp_max.); |
| 915 | if (ret) |
| 916 | return ret; |
| 917 | |
| 918 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "RxHw2XdpAv", stat->rx_hw2xdp_avgcxx . . $ statistics#rx_hw2xdp_avg.); |
| 919 | if (ret) |
| 920 | return ret; |
| 921 | |
| 922 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxXdp2AppMin", stat->rx_xdp2app_mincxx . . $ statistics#rx_xdp2app_min.); |
| 923 | if (ret) |
| 924 | return ret; |
| 925 | |
| 926 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxXdp2AppMax", stat->rx_xdp2app_maxcxx . . $ statistics#rx_xdp2app_max.); |
| 927 | if (ret) |
| 928 | return ret; |
| 929 | |
| 930 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "RxXdp2AppAv", stat->rx_xdp2app_avgcxx . . $ statistics#rx_xdp2app_avg.); |
| 931 | if (ret) |
| 932 | return ret; |
| 933 | |
| 934 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxWorkloadMin", stat->rx_workload_mincxx . . $ statistics#rx_workload_min.); |
| 935 | if (ret) |
| 936 | return ret; |
| 937 | |
| 938 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RxWorkloadMax", stat->rx_workload_maxcxx . . $ statistics#rx_workload_max.); |
| 939 | if (ret) |
| 940 | return ret; |
| 941 | |
| 942 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "RxWorkloadAv", stat->rx_workload_avgcxx . . $ statistics#rx_workload_avg.); |
| 943 | if (ret) |
| 944 | return ret; |
| 945 | |
| 946 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "TxMin", stat->tx_mincxx . . $ statistics#tx_min.); |
| 947 | if (ret) |
| 948 | return ret; |
| 949 | |
| 950 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "TxMax", stat->tx_maxcxx . . $ statistics#tx_max.); |
| 951 | if (ret) |
| 952 | return ret; |
| 953 | |
| 954 | ret = append_jlog_floatcxx . . $ append_jlog_float(72d09aa602598688).(&json, &len, "TxAv", stat->tx_avgcxx . . $ statistics#tx_avg.); |
| 955 | if (ret) |
| 956 | return ret; |
| 957 | |
| 958 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "TxHwTimestampMissing", stat->tx_hw_timestamp_missingcxx . . $ statistics#tx_hw_timestamp_missing.); |
| 959 | if (ret) |
| 960 | return ret; |
| 961 | |
| 962 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "OutofOrderErrors", stat->out_of_order_errorscxx . . $ statistics#out_of_order_errors.); |
| 963 | if (ret) |
| 964 | return ret; |
| 965 | |
| 966 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "FrameIdErrors", stat->frame_id_errorscxx . . $ statistics#frame_id_errors.); |
| 967 | if (ret) |
| 968 | return ret; |
| 969 | |
| 970 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "PayloadErrors", stat->payload_errorscxx . . $ statistics#payload_errors.); |
| 971 | if (ret) |
| 972 | return ret; |
| 973 | |
| 974 | ret = append_jlog_u64cxx . . $ append_jlog_u64(6770e22e10bfb8bf).(&json, &len, "RoundTripOutliers", stat->round_trip_outlierscxx . . $ statistics#round_trip_outliers.); |
| 975 | if (ret) |
| 976 | return ret; |
| 977 | |
| 978 | ret = last_jlog_u64cxx . . $ last_jlog_u64(6770e22e10bfb8bf).(&json, &len, "OnewayOutliers", stat->oneway_outlierscxx . . $ statistics#oneway_outliers.); |
| 979 | if (ret) |
| 980 | return ret; |
| 981 | |
| 982 | /* JSON footer */ |
| 983 | ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(json, len, "}\n}\n}\n"); |
| 984 | |
| 985 | return json_err_handlingcxx . . $ json_err_handling(253e95a56e616191).(&json, &len, ret); |
| 986 | } |