Skip to content

Change disk example read/write unit to bytes

ToMe25 requested to merge ToMe25/libgtop:disk_example_bytes into master

Change the unit of the Read and Write column of the disk example from unix sectors to bytes.
I believe this makes the example program more user-friendly.

This MR also adds the units to the header names of that example.
However I would consider that an optional part of this MR, if it is preferred without that I will undo this change.

I also considered formatting the output in a more human readable format, however I came to the conclusion that a solution without a loss of precision is more in line with this example.

In addition this MR fixes a warning about the format code in the sysinfo example.

Here is how the disk example output looks before and after this MR:

Before:

ELAPSE                  Read    Time Read        Write   Time Write
-------------------------------------------------------------------------------------------
DISK   0      :      1787952      3156492       221210        53424
DISK   1      :        13854         1140            2            0
DISK   2      :        10882         2340           64          737
DISK   3      :      1758584      3152956       221144        52477
-------------------------------------------------------------------------------------------

After:

ELAPSE                 Read (b)  Time Read (ms)       Write (b) Time Write (ms)
-------------------------------------------------------------------------------------------
DISK   0      :      1438498816         3393482       284840960           81103
DISK   1      :         7093248            1140            1024               0
DISK   2      :         5587968            2356          143360             876
DISK   3      :      1423446016         3389930       284696576           80017
-------------------------------------------------------------------------------------------

Merge request reports