[PATCH 0/2 v2] rtla osnoise hist average calculation

From: Andreas Ziegler
Date: Tue Jan 03 2023 - 05:34:43 EST


Version 2 of the proposed patch, with changes split in two separate commits,
as suggested by Daniel Bristot de Oliveira

rtla osnoise hist always outputs '0' as average duration value. Example:

# rtla osnoise hist -P F:1 -c 0-1 -r 900000 -d 1M -b 1 -E 5000 -T 1
# RTLA osnoise histogram
# Time unit is microseconds (us)
# Duration: 0 00:01:00
...
count: 5629 1364
min: 1 1
avg: 0 0
max: 2955 56

This is due to sum_sample in osnoise_hist_update_multiple() being calculated
as the sum (duration), not as sum (duration * count).

Truncating of the average value in final output suggests too optimistic
results; display floating point value instead.

Andreas Ziegler (2):
tools/tracing/rtla: osnoise_hist: use total duration for average
calculation
tools/tracing/rtla: osnoise_hist: display average with two-digit
precision

tools/tracing/rtla/src/osnoise_hist.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

--
2.34.1