Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Dear Monks,

I have a very big input file of around 5590600 MB size and while opening the file and reading the file it is taking 99 or 100% utilisation of my CPU. But I am trying to reduce the CPU utilisation to less than 50% and not able to succeed with that. In the execution of "top" command in command prompt first it says CPU usage: 28.2% but in the detailed PID it says 100% usage. So not sure if it is really taking 100% or only 28%.If it is taking only 28% of overall 100% CPU then it is fine. Else could you please let me know how to reduce the cpu time to less than 50%
tie @lines, 'Tie::File', "testfile.dat" or die "Can't read file: $!\n" +; $linecount = $#lines+1; #print "Linecount=> $linecount\n"; foreach ( @lines ) { chomp; ($type, $No, $date) = split(/\|/); $hash{$No.$date} = $type."@".$No."@".$date; } untie @lines;
PROCESS TIME Processes: 135 total, 4 running, 6 stuck, 125 sleeping, 926 threads + + + 21:13:58 Load Avg: 1.22, 1.17, 1.07 CPU usage: 28.2% user, 3.32% sys, 68.64% i +dle SharedLibs: 10M resident, 9736K data, 0B linkedit. MemRegions: +28168 total, 2921M resident, 76M private, 568M shared. PhysMem: 1056M + wired, 3782M active, 971M inactive, 5810M used, 2380M free. VM: 318G vsize, 1054M framework vsize, 248025(0) pageins, 0(0) pageout +s. Networks: packets: 453919/88M in, 393620/58M out. Disks: 65480/378 +2M read, 137948/7081M written. PID COMMAND %CPU TIME #TH #WQ #PORT #MREGS RPR +VT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE UID FA +ULTS COW MSGSENT MSGRECV SYSBSD SYSMACH CSW + PAGEINS KPRVT KSHRD USER perl5.12 99.9 00:08.58 1/1 0 22 56+ 99M+ 124 +4K

In reply to Reduce CPU utilization time in reading file using perl by madtoperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (9)
    As of 2014-07-23 08:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (136 votes), past polls