-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate Linux disk bytes read/written based on sector size #180
Calculate Linux disk bytes read/written based on sector size #180
Conversation
f2473bc
to
333afa7
Compare
It should be possible to make this work for partitions by walking up the sysfs tree if that's desirable, and that would avoid the hacky line size check in |
333afa7
to
099b8be
Compare
return parseDiskSectorSize(file) | ||
} | ||
|
||
func parseDiskSectorSize(r io.Reader) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conntrack module has a function for this already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, can move this out to helpers.go
Logical sector size appears to be fixed at 512B for the foreseeable future in the kernel, so for now we just hard-code it.
099b8be
to
09e610a
Compare
Hard-coding the sector size certainly simplifies things, though I wonder if it's worth including this if we're going just going to make this assumption, since it can be fairly easily scaled by query. |
I think it's worthwhile. We generally want things to be in bytes, and users not having to worry about the nitty-gritty of kernel internals is good. |
Calculate Linux disk bytes read/written based on sector size
Thanks! |
This is only calculated for raw devices, since determinining the parent
device for partitions would require additional work, and partitions are
excluded from collection by default.