scottchiefbaker / dool

Python3 compatible fork of dstat
GNU General Public License v3.0
332 stars 64 forks source link

/dev/ramX devices do not work with --disk #62

Closed KJ7LNW closed 5 months ago

KJ7LNW commented 10 months ago
SUMMARY

sda works, ram0 doesn't show:

dool  -D sda,ram0
┄┄total┄cpu┄usage┄┄┬┄┄dsk/sda┄┄┬┄net/total┄┬┄┄┄load┄avg┄┄┄┬┄┄┄┄┄system┄┄┄┄
usr sys idl wai stl│ read  writ│ recv  send│ 1m   5m  15m │      time     
  0   1  99   0   0│  27k  116k│   0     0 │0.21 0.28 0.27│Nov-30 13:51:05
ISSUE TYPE
DOOL VERSION

~1.3.1 (dool-next)

OS / ENVIRONMENT

oracle linux 9

STEPS TO REPRODUCE
modprobe brd rd_size=$((1 * 1024*1024)) rd_nr=2
dool  -D sda,ram0
EXPECTED RESULTS

ram0 IO stats

ACTUAL RESULTS

ram0 is not listed.

scottchiefbaker commented 10 months ago

It looks like this is related to a line in the dool_disk plugin:

if set(l[3:]) == {'0'}: continue

I'm not familiar with this but it landed in commit fa079a43c97f772a4809304386dbed5f4afa9a54. Looks like we're purposely skipping devices that have all zeros in /proc/disktats. If I comment out this line dool will read ram0 as a disk. I don't know how to get it to generate IO though, so I can't test if dool actually reads it.

Can you try commenting out the line and seeing if you see IO in dool afterwards?

scottchiefbaker commented 10 months ago

@leahneukirchen since you wrote the fix mentioned above do you mind commenting on this issue? Maybe between the three of us we can come up with a good solution.

KJ7LNW commented 10 months ago

Comment where? I tried these, but still doesn't show:

dool_disk_avgqu.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_avgqu.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_avgrq.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_avgrq.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_svctm.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_svctm.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_tps.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_tps.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_util.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_util.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_wait.py:            #if set(l[3:]) == {'0'}: continue
dool_disk_wait.py:            #if set(l[3:]) == {'0'}: continue
dool.py:            #if set(l[3:]) == {'0'}: continue
dool.py:            #if set(l[3:]) == {'0'}: continue
dool.py:            #if set(l[3:]) == {'0'}: continue
dool.py:            #if set(l[3:]) == {'0'}: continue
scottchiefbaker commented 10 months ago

Comment out line 868 in dool.py. When I comment out that line and run ./dool --more -D sda,ram0 I see ram0 in the output.

I cannot get it to increment any stats though. Not sure how/if the kernel updates /proc/diskstats for those ram disks.

KJ7LNW commented 10 months ago

it shows, but I cant get stats out of it:

modprobe brd rd_size=$((1024*1024))
dd if=/dev/zero of=/dev/ram0 bs=1M & ./dool -D ram0

I opened a stack exchange question on the subject in case somebody else has seen this before.

scottchiefbaker commented 10 months ago

If we can get it to populate /proc/diskstats I think it will just automagically work. Hopefully someone on StackExhange will know.

KJ7LNW commented 10 months ago

I think you are right, this is not a dool problem.

However, it would save me (and others?) from opening a ticket if dool gave a warning about /dev/ram0 not having any data and thus being excluded.

Maybe this could be fixed by printing a warning instead of by implementation.

scottchiefbaker commented 10 months ago

Is iostat able to read stats for ram disks? I kind of doubt it since nothing is showing up in /proc/diskstats but it might be worth double checking.

leahneukirchen commented 10 months ago

Yes, ram0 doesn't keep track of any disk stats (but e.g. zram does, and dool works for it).

I don't think this is a dool issue therefore.

KJ7LNW commented 10 months ago

Is iostat able to read stats for ram disks?

It does not.

scottchiefbaker commented 5 months ago

Closing this as CANTFIX because it's a kernel issue. If/when the kernel tracks stats for these ram disks dool will automatically work.