Proc::NiceSleep

Yield system in an intelligent fashion
Download

Proc::NiceSleep Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Josh Rabinowitz
  • Publisher web site:
  • http://search.cpan.org/~joshr/Sman-1.01/Sman/Man/Convert.pm

Proc::NiceSleep Tags


Proc::NiceSleep Description

Yield system in an intelligent fashion Proc::NiceSleep is a yield system in an intelligent fashion.SYNOPSIS use Proc::NiceSleep qw( :all ); nice(5); # lower our priority, if our OS supports it max_load(1.1); # max load we allow, if GetCpuLoad can find loads sleep_factor(.5); # sleep 50% as long as we run min_run_time(2); # run at least 2 seconds without sleep while($somecondition) { #dosomething(); $slept = maybe_sleep(); # sleep some amount of time if needed }Proc::NiceSleep defines subroutines to allow a process to yield use of the system according to a configured policy. Proc::NiceSleep is intended for use in situations where the operating system does not support priorities, or where using the operating system's built-in priorities does not yield the system sufficiently.By default Proc::NiceSleep expects to yield the process for one tenth the amount of time that process runs. This is expressed by the default Sleep Factor of 0.10. Proc::NiceSleep can also be configured to attempt to keep the average system load below a certain threshhold through use of the max_load() function.A convenient nice() function, which acts much like the shell command and executable of the same name, is also provided for easy, platform independent access to your system's priorities (if available).If Proc::NiceSleep autodetects the presence of the Time::HiRes module (and your operating system supports it) then timing and yielding operations will occur with sub-second granularity. If not, no warning or error will be issued but Proc::NiceSleep operations will occur with a granularity of about one second. Sys::CpuLoad must be found for max_load() to have any effect. Requirements: · Perl


Proc::NiceSleep Related Software