<?xml version="1.0" encoding="windows-1252"?>
<node id="55609" title="(tye)Re: one-liner hogs" created="2001-01-31 23:16:50" updated="2005-08-10 08:52:10">
<type id="11">
note</type>
<author id="22609">
tye</author>
<data>
<field name="doctext">
&lt;code&gt;
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&lt;&gt;},"/")while 1'
MemUse: perl -e '$_="ab"x(8*1024*1024);tr/ab/ba/ while 1'
Swap:   perl -e 'while(1){push @_,"x";for(@_){$_="x$_"}}'
&lt;/code&gt;&lt;p&gt;
To double the load, prepend "fork;" to the line.  For example, four-times as much "read" load can be (attempted to be) generated via:
&lt;/p&gt;&lt;code&gt;
perl -MFile::Find -e 'fork;fork;find(sub{@ARGV=$_;1while&lt;&gt;},"/")while 1'
&lt;/code&gt;&lt;p&gt;
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. (:
&lt;/p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- 
&lt;a href="/index.pl?node=tye&amp;lastnode_id=1072"&gt;tye&lt;/a&gt; 
(but my friends call me "Tye")</field>
<field name="root_node">
55592</field>
<field name="parent_node">
55592</field>
</data>
</node>
