Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: get system info using perl

by saurabh.hirani (Beadle)
on Feb 05, 2009 at 16:00 UTC ( [id://741584]=note: print w/replies, xml ) Need Help??


in reply to Re: get system info using perl
in thread get system info using perl

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://741584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found