Skip to content

Commit 248676d

Browse files
committed
stat: Increase depth levels to log latency
Previously latency log depth levels are 10 for nsec and usec and 12 for msec. But to measure latency variation on a finer granularity required to increase. So increase the depth levels as 20 for nsec and usec and 22 for msec. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 8bfe330 commit 248676d

File tree

4 files changed

+151
-45
lines changed

4 files changed

+151
-45
lines changed

HOWTO

+6-2
Original file line numberDiff line numberDiff line change
@@ -3881,13 +3881,17 @@ field was introduced or whether it's specific to some terse version):
38813881

38823882
<=1, 2, 4, 8, 16, 32, >=64
38833883

3884+
I/O latencies nanoseconds::
3885+
3886+
<=2, 3, 4, 6, 8, 10, 15, 20, 35, 50, 75, 100, 175, 250, 375, 500, 625, 750, 875, 1000
3887+
38843888
I/O latencies microseconds::
38853889

3886-
<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
3890+
<=2, 3, 4, 6, 8, 10, 15, 20, 35, 50, 75, 100, 175, 250, 375, 500, 625, 750, 875, 1000
38873891

38883892
I/O latencies milliseconds::
38893893

3890-
<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000, 2000, >=2000
3894+
<=2, 3, 4, 6, 8, 10, 15, 20, 35, 50, 75, 100, 175, 250, 375, 500, 625, 750, 875, 1000, 2000, >=2000
38913895

38923896
Disk utilization [v3]::
38933897

io_u.c

+118-28
Original file line numberDiff line numberDiff line change
@@ -1050,31 +1050,61 @@ static void io_u_mark_lat_nsec(struct thread_data *td, unsigned long long nsec)
10501050
assert(nsec < 1000);
10511051

10521052
switch (nsec) {
1053-
case 750 ... 999:
1053+
case 875 ... 999:
1054+
idx = 19;
1055+
break;
1056+
case 750 ... 874:
1057+
idx = 18;
1058+
break;
1059+
case 625 ... 749:
1060+
idx = 17;
1061+
break;
1062+
case 500 ... 624:
1063+
idx = 16;
1064+
break;
1065+
case 375 ... 499:
1066+
idx = 15;
1067+
break;
1068+
case 250 ... 374:
1069+
idx = 14;
1070+
break;
1071+
case 175 ... 249:
1072+
idx = 13;
1073+
break;
1074+
case 100 ... 174:
1075+
idx = 12;
1076+
break;
1077+
case 75 ... 99:
1078+
idx = 11;
1079+
break;
1080+
case 50 ... 74:
1081+
idx = 10;
1082+
break;
1083+
case 35 ... 49:
10541084
idx = 9;
10551085
break;
1056-
case 500 ... 749:
1086+
case 20 ... 34:
10571087
idx = 8;
10581088
break;
1059-
case 250 ... 499:
1089+
case 15 ... 19:
10601090
idx = 7;
10611091
break;
1062-
case 100 ... 249:
1092+
case 10 ... 14:
10631093
idx = 6;
10641094
break;
1065-
case 50 ... 99:
1095+
case 8 ... 9:
10661096
idx = 5;
10671097
break;
1068-
case 20 ... 49:
1098+
case 6 ... 7:
10691099
idx = 4;
10701100
break;
1071-
case 10 ... 19:
1101+
case 4 ... 5:
10721102
idx = 3;
10731103
break;
1074-
case 4 ... 9:
1104+
case 3:
10751105
idx = 2;
10761106
break;
1077-
case 2 ... 3:
1107+
case 2:
10781108
idx = 1;
10791109
fallthrough;
10801110
case 0 ... 1:
@@ -1092,31 +1122,61 @@ static void io_u_mark_lat_usec(struct thread_data *td, unsigned long long usec)
10921122
assert(usec < 1000 && usec >= 1);
10931123

10941124
switch (usec) {
1095-
case 750 ... 999:
1125+
case 875 ... 999:
1126+
idx = 19;
1127+
break;
1128+
case 750 ... 874:
1129+
idx = 18;
1130+
break;
1131+
case 625 ... 749:
1132+
idx = 17;
1133+
break;
1134+
case 500 ... 624:
1135+
idx = 16;
1136+
break;
1137+
case 375 ... 499:
1138+
idx = 15;
1139+
break;
1140+
case 250 ... 374:
1141+
idx = 14;
1142+
break;
1143+
case 175 ... 249:
1144+
idx = 13;
1145+
break;
1146+
case 100 ... 174:
1147+
idx = 12;
1148+
break;
1149+
case 75 ... 99:
1150+
idx = 11;
1151+
break;
1152+
case 50 ... 74:
1153+
idx = 10;
1154+
break;
1155+
case 35 ... 49:
10961156
idx = 9;
10971157
break;
1098-
case 500 ... 749:
1158+
case 20 ... 34:
10991159
idx = 8;
11001160
break;
1101-
case 250 ... 499:
1161+
case 15 ... 19:
11021162
idx = 7;
11031163
break;
1104-
case 100 ... 249:
1164+
case 10 ... 14:
11051165
idx = 6;
11061166
break;
1107-
case 50 ... 99:
1167+
case 8 ... 9:
11081168
idx = 5;
11091169
break;
1110-
case 20 ... 49:
1170+
case 6 ... 7:
11111171
idx = 4;
11121172
break;
1113-
case 10 ... 19:
1173+
case 4 ... 5:
11141174
idx = 3;
11151175
break;
1116-
case 4 ... 9:
1176+
case 3:
11171177
idx = 2;
11181178
break;
1119-
case 2 ... 3:
1179+
case 2:
11201180
idx = 1;
11211181
fallthrough;
11221182
case 0 ... 1:
@@ -1135,36 +1195,66 @@ static void io_u_mark_lat_msec(struct thread_data *td, unsigned long long msec)
11351195

11361196
switch (msec) {
11371197
default:
1138-
idx = 11;
1198+
idx = 21;
11391199
break;
11401200
case 1000 ... 1999:
1201+
idx = 20;
1202+
break;
1203+
case 875 ... 999:
1204+
idx = 19;
1205+
break;
1206+
case 750 ... 874:
1207+
idx = 18;
1208+
break;
1209+
case 625 ... 749:
1210+
idx = 17;
1211+
break;
1212+
case 500 ... 624:
1213+
idx = 16;
1214+
break;
1215+
case 375 ... 499:
1216+
idx = 15;
1217+
break;
1218+
case 250 ... 374:
1219+
idx = 14;
1220+
break;
1221+
case 175 ... 249:
1222+
idx = 13;
1223+
break;
1224+
case 100 ... 174:
1225+
idx = 12;
1226+
break;
1227+
case 75 ... 99:
1228+
idx = 11;
1229+
break;
1230+
case 50 ... 74:
11411231
idx = 10;
11421232
break;
1143-
case 750 ... 999:
1233+
case 35 ... 49:
11441234
idx = 9;
11451235
break;
1146-
case 500 ... 749:
1236+
case 20 ... 34:
11471237
idx = 8;
11481238
break;
1149-
case 250 ... 499:
1239+
case 15 ... 19:
11501240
idx = 7;
11511241
break;
1152-
case 100 ... 249:
1242+
case 10 ... 14:
11531243
idx = 6;
11541244
break;
1155-
case 50 ... 99:
1245+
case 8 ... 9:
11561246
idx = 5;
11571247
break;
1158-
case 20 ... 49:
1248+
case 6 ... 7:
11591249
idx = 4;
11601250
break;
1161-
case 10 ... 19:
1251+
case 4 ... 5:
11621252
idx = 3;
11631253
break;
1164-
case 4 ... 9:
1254+
case 3:
11651255
idx = 2;
11661256
break;
1167-
case 2 ... 3:
1257+
case 2:
11681258
idx = 1;
11691259
fallthrough;
11701260
case 0 ... 1:

stat.c

+24-12
Original file line numberDiff line numberDiff line change
@@ -625,24 +625,30 @@ static bool show_lat(double *io_u_lat, int nr, const char **ranges,
625625

626626
static void show_lat_n(double *io_u_lat_n, struct buf_output *out)
627627
{
628-
const char *ranges[] = { "2=", "4=", "10=", "20=", "50=", "100=",
629-
"250=", "500=", "750=", "1000=", };
628+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
629+
"15=", "20=", "35=", "50=", "75=", "100=",
630+
"175=", "250=", "375=", "500=",
631+
"625=", "750=", "875=", "1000=", };
630632

631633
show_lat(io_u_lat_n, FIO_IO_U_LAT_N_NR, ranges, "nsec", out);
632634
}
633635

634636
static void show_lat_u(double *io_u_lat_u, struct buf_output *out)
635637
{
636-
const char *ranges[] = { "2=", "4=", "10=", "20=", "50=", "100=",
637-
"250=", "500=", "750=", "1000=", };
638+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
639+
"15=", "20=", "35=", "50=", "75=", "100=",
640+
"175=", "250=", "375=", "500=",
641+
"625=", "750=", "875=", "1000=", };
638642

639643
show_lat(io_u_lat_u, FIO_IO_U_LAT_U_NR, ranges, "usec", out);
640644
}
641645

642646
static void show_lat_m(double *io_u_lat_m, struct buf_output *out)
643647
{
644-
const char *ranges[] = { "2=", "4=", "10=", "20=", "50=", "100=",
645-
"250=", "500=", "750=", "1000=", "2000=",
648+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
649+
"15=", "20=", "35=", "50=", "75=", "100=",
650+
"175=", "250=", "375=", "500=",
651+
"625=", "750=", "875=", "1000=", "2000=",
646652
">=2000=", };
647653

648654
show_lat(io_u_lat_m, FIO_IO_U_LAT_M_NR, ranges, "msec", out);
@@ -1620,24 +1626,30 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
16201626
tmp = json_create_object();
16211627
json_object_add_value_object(root, "latency_ns", tmp);
16221628
for (i = 0; i < FIO_IO_U_LAT_N_NR; i++) {
1623-
const char *ranges[] = { "2", "4", "10", "20", "50", "100",
1624-
"250", "500", "750", "1000", };
1629+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
1630+
"15=", "20=", "35=", "50=", "75=", "100=",
1631+
"175=", "250=", "375=", "500=",
1632+
"625=", "750=", "875=", "1000=", };
16251633
json_object_add_value_float(tmp, ranges[i], io_u_lat_n[i]);
16261634
}
16271635
/* Microsecond latency */
16281636
tmp = json_create_object();
16291637
json_object_add_value_object(root, "latency_us", tmp);
16301638
for (i = 0; i < FIO_IO_U_LAT_U_NR; i++) {
1631-
const char *ranges[] = { "2", "4", "10", "20", "50", "100",
1632-
"250", "500", "750", "1000", };
1639+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
1640+
"15=", "20=", "35=", "50=", "75=", "100=",
1641+
"175=", "250=", "375=", "500=",
1642+
"625=", "750=", "875=", "1000=", };
16331643
json_object_add_value_float(tmp, ranges[i], io_u_lat_u[i]);
16341644
}
16351645
/* Millisecond latency */
16361646
tmp = json_create_object();
16371647
json_object_add_value_object(root, "latency_ms", tmp);
16381648
for (i = 0; i < FIO_IO_U_LAT_M_NR; i++) {
1639-
const char *ranges[] = { "2", "4", "10", "20", "50", "100",
1640-
"250", "500", "750", "1000", "2000",
1649+
const char *ranges[] = { "2=", "3=", "4=", "6=", "8=", "10=",
1650+
"15=", "20=", "35=", "50=", "75=", "100=",
1651+
"175=", "250=", "375=", "500=",
1652+
"625=", "750=", "875=", "1000=", "2000",
16411653
">=2000", };
16421654
json_object_add_value_float(tmp, ranges[i], io_u_lat_m[i]);
16431655
}

stat.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ struct group_run_stats {
2222
* How many depth levels to log
2323
*/
2424
#define FIO_IO_U_MAP_NR 7
25-
#define FIO_IO_U_LAT_N_NR 10
26-
#define FIO_IO_U_LAT_U_NR 10
27-
#define FIO_IO_U_LAT_M_NR 12
25+
#define FIO_IO_U_LAT_N_NR 20
26+
#define FIO_IO_U_LAT_U_NR 20
27+
#define FIO_IO_U_LAT_M_NR 22
2828

2929
/*
3030
* Constants for clat percentiles

0 commit comments

Comments
 (0)