Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

(tye)Re: one-liner hogs

by tye (Cardinal)
on Feb 01, 2001 at 04:16 UTC ( #55609=note: print w/ replies, xml ) Need Help??


in reply to one-liner hogs

Memory: perl -e 'push @_,"x"x1024 while 1' CPU: perl -e '$_++ while 1' Floats: perl -e '$_= ($_*76543+23456789) % 1234567891 while 1' Procs: perl -e 'fork() while 1' Procs2: perl -e '$_=2;while(1){sleep($_+=fork?$_:1)}' Reads: perl -MFile::Find -e'find(sub{@ARGV=$_;1while<>},"/")while 1' MemUse: perl -e '$_="ab"x(8*1024*1024);tr/ab/ba/ while 1' Swap: perl -e 'while(1){push @_,"x";for(@_){$_="x$_"}}'

To double the load, prepend "fork;" to the line. For example, four-times as much "read" load can be (attempted to be) generated via:

perl -MFile::Find -e 'fork;fork;find(sub{@ARGV=$_;1while<>},"/")while +1'

My favorite is "Procs2", which is the only one I tested; most of these you don't want to test when anyone else is using the computer. (:

        - tye (but my friends call me "Tye")


Comment on (tye)Re: one-liner hogs
Select or Download Code
(jptxs)Re: (tye)Re: one-liner hogs
by jptxs (Curate) on Feb 01, 2001 at 04:21 UTC
    Everyone's responses have been awesome, but there might be the winners because they're so simple. I need non-programmer types to be able to memorize and spit these out.

    actually Kanji's suggestion seemed so good there's a box 3000 miles away in California being rebooted as we speak =) oops.

    "A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche
      Sorry. Just saw your signature line and noticed it was from Nietzsche. I saw a pretty funny bumper sticker the other day that read:
      God is dead. - Nietzsche.
      Nietzsche is dead. - God.
Re: (tye)Re: one-liner hogs
by Boldra (Deacon) on Feb 01, 2001 at 19:29 UTC
    Nice Tye, but I honestly can't see myself memorising your floats one :)


      Okay, I spent a bit more time and found 3 prime numbers that are easier to remember. I updated the original message changing:

      Floats: perl -e '$_= ($_*36217+41081) % 492391271 while 1'

      to

      Floats: perl -e '$_= ($_*76543+23456789) % 1234567891 while 1'
      Now that is much easier to remember. Thanks!

              - tye (but my friends call me "Tye")
Re^2: one-liner hogs
by shmem (Canon) on Aug 04, 2008 at 21:18 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-10-25 19:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (148 votes), past polls