Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

delayacct: improve the average delay precision of getdelay tool to microsecond

Improve the average delay precision of getdelay tool to microsecond. When
using the getdelay tool, it is sometimes found that the average delay
except CPU is not 0, but display is 0, because the precison is too low.
For example, see delay average of SWAP below when using ZRAM.

print delayacct stats ON
PID 32915
CPU count real total virtual total delay total delay average
339202 2793871936 9233585504 7951112 0.000ms
IO count delay total delay average
41 419296904 10ms
SWAP count delay total delay average
242589 1045792384 0ms

This wrong display is misleading, so improve the millisecond precision of
the average delay to microsecond just like CPU. Then user would get more
accurate information of delay time.

Link: https://lkml.kernel.org/r/202302131408087983857@zte.com.cn
Signed-off-by: Wang Yong <wang.yong12@zte.com.cn>
Reviewed-by: Yang Yang <yang.yang29@zte.com.cn>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Wang Yong and committed by
Andrew Morton
eca7de7c aa318c48

+24 -24
+7 -7
Documentation/accounting/delay-accounting.rst
··· 109 109 CPU count real total virtual total delay total delay average 110 110 8 7000000 6872122 3382277 0.423ms 111 111 IO count delay total delay average 112 - 0 0 0ms 112 + 0 0 0.000ms 113 113 SWAP count delay total delay average 114 - 0 0 0ms 114 + 0 0 0.000ms 115 115 RECLAIM count delay total delay average 116 - 0 0 0ms 116 + 0 0 0.000ms 117 117 THRASHING count delay total delay average 118 - 0 0 0ms 118 + 0 0 0.000ms 119 119 COMPACT count delay total delay average 120 - 0 0 0ms 121 - WPCOPY count delay total delay average 122 - 0 0 0ms 120 + 0 0 0.000ms 121 + WPCOPY count delay total delay average 122 + 0 0 0.000ms 123 123 124 124 Get IO accounting for pid 1, it works only with -p:: 125 125
+5 -5
Documentation/translations/zh_CN/accounting/delay-accounting.rst
··· 92 92 CPU count real total virtual total delay total delay average 93 93 8 7000000 6872122 3382277 0.423ms 94 94 IO count delay total delay average 95 - 0 0 0ms 95 + 0 0 0.000ms 96 96 SWAP count delay total delay average 97 - 0 0 0ms 97 + 0 0 0.000ms 98 98 RECLAIM count delay total delay average 99 - 0 0 0ms 99 + 0 0 0.000ms 100 100 THRASHING count delay total delay average 101 - 0 0 0ms 101 + 0 0 0.000ms 102 102 COMPACT count delay total delay average 103 - 0 0 0ms 103 + 0 0 0.000ms 104 104 WPCOPY count delay total delay average 105 105 0 0 0ms 106 106
+12 -12
tools/accounting/getdelays.c
··· 198 198 printf("\n\nCPU %15s%15s%15s%15s%15s\n" 199 199 " %15llu%15llu%15llu%15llu%15.3fms\n" 200 200 "IO %15s%15s%15s\n" 201 - " %15llu%15llu%15llums\n" 201 + " %15llu%15llu%15.3fms\n" 202 202 "SWAP %15s%15s%15s\n" 203 - " %15llu%15llu%15llums\n" 203 + " %15llu%15llu%15.3fms\n" 204 204 "RECLAIM %12s%15s%15s\n" 205 - " %15llu%15llu%15llums\n" 205 + " %15llu%15llu%15.3fms\n" 206 206 "THRASHING%12s%15s%15s\n" 207 - " %15llu%15llu%15llums\n" 207 + " %15llu%15llu%15.3fms\n" 208 208 "COMPACT %12s%15s%15s\n" 209 - " %15llu%15llu%15llums\n" 209 + " %15llu%15llu%15.3fms\n" 210 210 "WPCOPY %12s%15s%15s\n" 211 - " %15llu%15llu%15llums\n", 211 + " %15llu%15llu%15.3fms\n", 212 212 "count", "real total", "virtual total", 213 213 "delay total", "delay average", 214 214 (unsigned long long)t->cpu_count, ··· 219 219 "count", "delay total", "delay average", 220 220 (unsigned long long)t->blkio_count, 221 221 (unsigned long long)t->blkio_delay_total, 222 - average_ms(t->blkio_delay_total, t->blkio_count), 222 + average_ms((double)t->blkio_delay_total, t->blkio_count), 223 223 "count", "delay total", "delay average", 224 224 (unsigned long long)t->swapin_count, 225 225 (unsigned long long)t->swapin_delay_total, 226 - average_ms(t->swapin_delay_total, t->swapin_count), 226 + average_ms((double)t->swapin_delay_total, t->swapin_count), 227 227 "count", "delay total", "delay average", 228 228 (unsigned long long)t->freepages_count, 229 229 (unsigned long long)t->freepages_delay_total, 230 - average_ms(t->freepages_delay_total, t->freepages_count), 230 + average_ms((double)t->freepages_delay_total, t->freepages_count), 231 231 "count", "delay total", "delay average", 232 232 (unsigned long long)t->thrashing_count, 233 233 (unsigned long long)t->thrashing_delay_total, 234 - average_ms(t->thrashing_delay_total, t->thrashing_count), 234 + average_ms((double)t->thrashing_delay_total, t->thrashing_count), 235 235 "count", "delay total", "delay average", 236 236 (unsigned long long)t->compact_count, 237 237 (unsigned long long)t->compact_delay_total, 238 - average_ms(t->compact_delay_total, t->compact_count), 238 + average_ms((double)t->compact_delay_total, t->compact_count), 239 239 "count", "delay total", "delay average", 240 240 (unsigned long long)t->wpcopy_count, 241 241 (unsigned long long)t->wpcopy_delay_total, 242 - average_ms(t->wpcopy_delay_total, t->wpcopy_count)); 242 + average_ms((double)t->wpcopy_delay_total, t->wpcopy_count)); 243 243 } 244 244 245 245 static void task_context_switch_counts(struct taskstats *t)