Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Time modules

by mikejones (Scribe)
on Feb 25, 2009 at 03:27 UTC ( [id://746162]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Time modules
in thread Time modules

I made some progress, however I was not sure what you meant in number 2. Since I am using file find, my units would be every file greater than 25Mb for example.
<snip> else { my ( $size_input ) = pop @_ ; if ( $^O !~ /(?:)dec\w+/i ) { my ( $dev,$ino,$mode,$nlink,$uid,$gid ) ; (( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) && ( $dev >= 0 ) && !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) +&& ( int(((-s _) + 1023) / 1024 ) >= $size_input ) && push ((@large_files), $name) ; $number_of_files = scalar @large_files ; $timer->restart( min => 0, max => $number_of_files ) ; print $timer->report( "%45b %p\r", 10 ) ; }
### The output is not entirely accurate. For a large filesystem this is painted across my screen and counts down. For smaller filesystems, numbers are not calculated quickly enough and all I see is n/a. For mid-size filesystems all I see is 100% ###
##################################........... 76.9% #########################.................... 55.6% "output of the file find hereafter"
In the code  print $timer->report( "%45b %p\r", 10 ) ; does 10 represent % points to increment or decrement in his calculations? thank you

Replies are listed 'Best First'.
Re^5: Time modules
by ELISHEVA (Prior) on Feb 25, 2009 at 15:09 UTC
    Neither. It means number of points completed so far. So assuming you are updating your progress bar after each 10 files and you had 50 files total, you'd set min=0, max=50 and each successive call would be something like this:
    print $timer->report( "%45b %p\r", 10 ); #10 out of 50 files print $timer->report( "%45b %p\r", 20 ); #20 out of 50 files print $timer->report( "%45b %p\r", 30 ); #30 out of 50 files

    Best, beth

      Hi Beth, So you are saying I should make this print timer call three times in my loop? My max is number of files which of course varies from filesystem to filesystem. thank you

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found