Re: (OT) Get the number of blocks per second by reading the proc diskstats file
by keszler (Priest) on Nov 13, 2011 at 15:40 UTC
|
| [reply] |
|
|
Thank you for your comment. :)
I just figured I could use tune2fs in combination with some other piped commands in order to get the block size from the device. Then I'll just assume that one write is one block equal to the block size of the device. I guess I'm thinking correct, yes? (block devices are really not my strong side)
And another thing. I decided to try out Perlmonks' forum because of the good reputation I discovered this site had when doing some Google-ing after some good Perl forums.
As to the discussion above where bad-mouthing and smart-assing towards my question as it seems to be ridiculous by another user I can just say that I barely came back to this forum because of that.
But anyhow, I am fairly capable of programming in Perl, though my question seemed non-Perl-ish by the content of the post.
I still hope someone has some tricks up their sleeves when it comes to handling the /proc/diskstats file when it comes to calculating different statistics from the data within that file.
Thank you
| [reply] |
|
|
# ------------------------------------------------------------
+--
# The sectors are equivalent with blocks and have a size of 51
+2
# bytes since 2.4 kernels. This value is needed to calculate t
+he
# amount of disk i/o's in bytes.
# ------------------------------------------------------------
+--
blocksize => 512,
Reading the code and seeing how the module's author calculates values should be helpful. | [reply] [d/l] |
|
|
| [reply] |
Re: (OT) Get the number of blocks per second by reading the proc diskstats file
by ww (Archbishop) on Nov 13, 2011 at 15:02 UTC
|
Asserting that you're "writing a perl script" doesn't make your actual question a Perl question.
Use a search engine and the keywords "proc diskstats" if you want answers about the content of /proc/diskstats.
Helpful addendum: /proc is NOT where disk statistics live on every distro of Linux, so you may wish to consult the docs for your flavor and/or use "diskstats Linux"as your SE keywords. | [reply] |
|
|
Thank you for your answer. I agree that the question might not be an actual Perl question, but since I'm scripting with Perl I had some hopes that someone had some experience to share. I already used Google for tons of searches without any luck. If someone knows how to create some snippets of code and perhaps share some ideas of which values to use from the diskstats file, and also how to do the actual calculation, it would be very helpful. I'm sorry if my question is slightly non-Perl, but this place is one of my last hopes at the moment.
| [reply] |
|
|
"if my question is slightly non-Perl....
No, your question is entirely non-Perl; in fact, somewhat akin to:
"I'm cooking a turkey for dinner. Please provide a synopsis of Turkish history"
As to "tons of searchs," didn't you find man proc referenced somewhere... or the documentation itself, http://linux.die.net/man/5/proc?
man proc will tell you, among other things:
/proc/pid/stat
Status information about the process. This is used by ps(1). It is defined in /usr/src/linux/fs/proc/array.c.
The fields, in order, with their proper scanf(3) format specifiers, are:
....
Update: If you don't Read The Fine Manual, you really shouldn't expect the Monks to do your reading, interpretation and coding for you. See On asking for help and How do I post a question effectively?
| [reply] [d/l] [select] |
|
|
|
|
|
|
|
|
|
|