Thanks guys for your replies. I got a reply from comp.lang.perl.misc which pointed out the following 2 modules:
1.Filesys::Df
2. Linux::Sysinfo
They are pretty easy to use, fast, and provide many values. I know that my daemon is not going to bomb the other one once in a second. But I just wanted to know.
These modules really do pump up the speed from okay to burn-the-road. Just to compare system call and Filesys::Df, I wrote a small perl program which calls getting free disk using system call to df and using the module. I profiled them by running them around 1000 times and this was
the output of dprofpp:
Forking df and getting the time:
Total Elapsed Time = 42.04899 Seconds
User+System Time = 5.668994 Seconds
Inclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
96.7 5.485 5.485 1000 0.0055 0.0055
main::get_freequeue
Using df from the module
Total Elapsed Time = 0.618107 Seconds
User+System Time = 0.768107 Seconds
Inclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
92.1 0.013 0.708 1000 0.0000 0.0007
main::get_freequeue
90.4 0.013 0.695 1000 0.0000 0.0007 Filesys::Df::df
88.7 0.682 0.682 1000 0.0007 0.0007
Filesys::Df::_df
The difference is staggering.
I will also play around with the IPC mod as pointed ou by zentara. Looks interesting
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.