Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Printing process of program

by k2 (Scribe)
on Jul 10, 2001 at 04:41 UTC ( [id://95207]=perlquestion: print w/replies, xml ) Need Help??

k2 has asked for the wisdom of the Perl Monks concerning the following question:

Hi!
I'm writing a program that will handle huge textfiles and in order to see the progress I wrote this bit of code that prints the procentage of the file that has been delt with and on witch line in the text the program is on.
But it's not working out the way I was expecting.
It works fine on small text-files, but when I run it on files that are 2-3 Gb the procentage-counter counts from -0% to aprox. -115% and then stops while the part that prints the line the program is on keeps running...

Anyone got any ideas?

This might have been up to discussion earlier, if so please point me in the right direction.

Regards k2
-------------------
$fs = (-s "@ARGV" ); $rowcount=0; while () { Run whatever loop you want... if ($rowcount % 1000 == 0 ) { print "\r", int((tell INDATA) /$fs*100), "% done = $rowcount r +ows ";} $rowcount++; }

Replies are listed 'Best First'.
Re: Printing process of program
by voyager (Friar) on Jul 10, 2001 at 05:33 UTC
    See the node on processing large files. I think the problem is the tell on files > 2G.

    Can you use some other technique to show progress, i.e. by counting rows, or accumulating how many bytes you've read, rather then using tell?

Re: Printing process of program
by no_slogan (Deacon) on Jul 10, 2001 at 05:33 UTC
    Could be a problem with large file support on your platform. What was your platform, sir? Try printing out the value of $fs and (tell INDATA), and see if those look reasonable.
Re: Printing process of program
by k2 (Scribe) on Jul 10, 2001 at 08:51 UTC
    Sorry, should have included my OS.
    This is running on a w2k-machine.
    I guessed there might be a problem with the large
    files, just wanted to know if anybody else were having
    this problem.
    I have compared the values on smaller files and they look ok
    but I have to get a better editor in order to check these large
    files...
    Thanks k2

Log In?
Username:
Password:

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

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

    No recent polls found