j-schulz / p5-Sys-Statistics-Linux

Front-end module to collect system statistics
Other
1 stars 0 forks source link

diskstats bytes to kbytes #3

Closed sparvu closed 9 years ago

sparvu commented 9 years ago

Can we default to KB instead of bytes per second ? Is there any reason we still report bytes instead of KB for:

    rdbyt - Number of bytes that were read from physical disk per second.
    wrtbyt - Number of bytes that were written to physical disk per second.
    ttbyt - Total number of bytes transmitted from/to physical disk per second.

I agree we should have a smaller unit for small disk IO size but reporting to KB would make sense.

    $x->{rdkbyt}   = ( $5 * $bksz ) / 1024;
    $x->{wrkbyt}  = ( $7 * $bksz ) / 1024; treq};
    $x->{ttkbyt}  += $x->{rdkbyt} + $x->{wrtkbyt};

under DiskStats.pm

j-schulz commented 9 years ago

No, sorry. You should be able to convert it yourself with 2-3 lines of code. Tomorrow the next one asks me to convert it to MB by default...

sparvu commented 9 years ago

Imagine, I do that already Jonny. I was thinking that we could have for NIC and disks same unit as KBytes instead of bytes. No worries. I will keep it in my code.

j-schulz commented 9 years ago

Don't forget that S:S:L is just an interface to the proc-filesystem and to Linux system statistics. The data from the proc-filesystem will not be manipulated. As example the values of /proc/meminfo are in kilobytes, so S:S:L:MemStats returns the data in kilobytes; /proc/net/dev is in bytes, so S:S:L:NetStats returns the data in bytes. The only exception is that data in blocks (diskstats) or pages (memory) will be converted to bytes.

As example for diskstats... one block has a size of 512 bytes. If you want to convert it to kilobytes, just set the blocksize to 512 / 1024. Example:

my $sys = Sys::Statistics::Linux->new(diskstats => { blocksize => 512/1024 });

Another reason is... I cannot change the default behavior of a module without a serious cause.

sparvu commented 9 years ago

yep. I was thinking we could offer a 'standard' KB unit within S:S:L no matter what. But in one sense its probable worse since it is natural to offer whatever /proc is offering and we let to other consumers to set it what they please.