Show diff output

This commit is contained in:
Mark Nellemann 2022-11-11 12:21:46 +01:00
parent 065aa29f7b
commit 9a69ee1a41
2 changed files with 57 additions and 30 deletions

View file

@ -6,13 +6,24 @@ Example from PowerVS AIX 7.3
```
# ./test
hdisk0 => reads [ blocks: 1207502, bytes 618241024, diff 0 ], writes [ blocks: 93033, bytes: 47632896, diff: 0 ]
hdisk0 => reads [ blocks: 1211712, bytes 620396544, diff 2155520 ], writes [ blocks: 93105, bytes: 47669760, diff: 36864 ]
hdisk0 => reads [ blocks: 1215922, bytes 622552064, diff 2155520 ], writes [ blocks: 93185, bytes: 47710720, diff: 40960 ]
hdisk0 => reads [ blocks: 1220132, bytes 624707584, diff 2155520 ], writes [ blocks: 93625, bytes: 47936000, diff: 225280 ]
hdisk0 => reads [ blocks: 1224342, bytes 626863104, diff 2155520 ], writes [ blocks: 93697, bytes: 47972864, diff: 36864 ]
hdisk0 => reads [ blocks: 1228560, bytes 629022720, diff 2159616 ], writes [ blocks: 93777, bytes: 48013824, diff: 40960 ]
hdisk0 => reads [ blocks: 1232770, bytes 631178240, diff 2155520 ], writes [ blocks: 93849, bytes: 48050688, diff: 36864 ]
hdisk0 => reads [ blocks: 1236980, bytes 633333760, diff 2155520 ], writes [ blocks: 93921, bytes: 48087552, diff: 36864 ]
hdisk0 => reads: [ blocks: 1995768 ( 0 ), bytes: 1021833216 ( 0 ) ], writes: [ blocks: 126169 ( 0 ), bytes: 64598528 ( 0 ) ]
hdisk0 => reads: [ blocks: 1999986 ( 4218 ), bytes: 1023992832 ( 2159616 ) ], writes: [ blocks: 126241 ( 72 ), bytes: 64635392 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2004196 ( 4210 ), bytes: 1026148352 ( 2155520 ) ], writes: [ blocks: 126321 ( 80 ), bytes: 64676352 ( 40960 ) ]
hdisk0 => reads: [ blocks: 2008406 ( 4210 ), bytes: 1028303872 ( 2155520 ) ], writes: [ blocks: 126393 ( 72 ), bytes: 64713216 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2012616 ( 4210 ), bytes: 1030459392 ( 2155520 ) ], writes: [ blocks: 127321 ( 928 ), bytes: 65188352 ( 475136 ) ]
hdisk0 => reads: [ blocks: 2016826 ( 4210 ), bytes: 1032614912 ( 2155520 ) ], writes: [ blocks: 127393 ( 72 ), bytes: 65225216 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2021036 ( 4210 ), bytes: 1034770432 ( 2155520 ) ], writes: [ blocks: 127465 ( 72 ), bytes: 65262080 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2025246 ( 4210 ), bytes: 1036925952 ( 2155520 ) ], writes: [ blocks: 127537 ( 72 ), bytes: 65298944 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2029456 ( 4210 ), bytes: 1039081472 ( 2155520 ) ], writes: [ blocks: 127617 ( 80 ), bytes: 65339904 ( 40960 ) ]
hdisk0 => reads: [ blocks: 2033666 ( 4210 ), bytes: 1041236992 ( 2155520 ) ], writes: [ blocks: 127689 ( 72 ), bytes: 65376768 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2037876 ( 4210 ), bytes: 1043392512 ( 2155520 ) ], writes: [ blocks: 128033 ( 344 ), bytes: 65552896 ( 176128 ) ]
hdisk0 => reads: [ blocks: 2042094 ( 4218 ), bytes: 1045552128 ( 2159616 ) ], writes: [ blocks: 128113 ( 80 ), bytes: 65593856 ( 40960 ) ]
hdisk0 => reads: [ blocks: 2046304 ( 4210 ), bytes: 1047707648 ( 2155520 ) ], writes: [ blocks: 128185 ( 72 ), bytes: 65630720 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2050514 ( 4210 ), bytes: 1049863168 ( 2155520 ) ], writes: [ blocks: 128257 ( 72 ), bytes: 65667584 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2054724 ( 4210 ), bytes: 1052018688 ( 2155520 ) ], writes: [ blocks: 128329 ( 72 ), bytes: 65704448 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2058934 ( 4210 ), bytes: 1054174208 ( 2155520 ) ], writes: [ blocks: 128441 ( 112 ), bytes: 65761792 ( 57344 ) ]
hdisk0 => reads: [ blocks: 2063152 ( 4218 ), bytes: 1056333824 ( 2159616 ) ], writes: [ blocks: 129297 ( 856 ), bytes: 66200064 ( 438272 ) ]
hdisk0 => reads: [ blocks: 2067362 ( 4210 ), bytes: 1058489344 ( 2155520 ) ], writes: [ blocks: 129369 ( 72 ), bytes: 66236928 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2071572 ( 4210 ), bytes: 1060644864 ( 2155520 ) ], writes: [ blocks: 129441 ( 72 ), bytes: 66273792 ( 36864 ) ]
hdisk0 => reads: [ blocks: 2075782 ( 4210 ), bytes: 1062800384 ( 2155520 ) ], writes: [ blocks: 129521 ( 80 ), bytes: 66314752 ( 40960 ) ]
```

46
test.c
View file

@ -29,7 +29,7 @@ int main(int argc, char* argv[]) {
}
long history[32][8];
long history[32][8] = { 0 };
while(1) {
@ -62,33 +62,49 @@ int main(int argc, char* argv[]) {
rbytes = rblks * bsize;
}
unsigned long rdiff = 0;
if(history[i][0] > 0) {
rdiff = rbytes - history[i][0];
}
unsigned long wbytes = 0;
if (wblks > 0) {
wbytes = wblks * bsize;
}
unsigned long wdiff = 0;
if(history[i][1] > 0) {
wdiff = wbytes - history[i][1];
unsigned long drblbks = 0;
if (history[i][0] > 0) {
drblbks = rblks - history[i][0];
}
printf("%s => reads [ blocks: %10u, bytes %10u, diff %8u ], writes [ blocks: %10u, bytes: %10u, diff: %8u ]\n",
unsigned long drbytes = 0;
if(history[i][1] > 0) {
drbytes = rbytes - history[i][1];
}
unsigned long dwblbks = 0;
if (history[i][2] > 0) {
dwblbks = wblks - history[i][2];
}
unsigned long dwbytes = 0;
if(history[i][3] > 0) {
dwbytes = wbytes - history[i][3];
}
printf("%s => reads: [ blocks: %10u (%8u ), bytes: %10u (%8u ) ], writes: [ blocks: %10u (%8u ), bytes: %10u (%8u ) ]\n",
statp[i].name,
rblks,
drblbks,
rbytes,
rdiff,
drbytes,
wblks,
dwblbks,
wbytes,
wdiff
);
dwbytes);
history[i][0] = rbytes;
history[i][1] = wbytes;
history[i][0] = rblks;
history[i][1] = rbytes;
history[i][2] = wblks;
history[i][3] = wbytes;
}
sleep(10);