title: Load test under linux (memory, total time, %cpu)
body: <p>I have to perform a load test under Red Hat Linux 6.2 using standard software, i.e. I cannot install anything there. It is intended to take account of total time, total memory use and % of cpu for 1000 10000 100000 and 1000000 iterations.</p>
  
  <p>The software I have to test consists in a producer and a consumer. Both are started as independent processes.
  My idea was to use the <strong>top</strong> linux command in batch mode. </p>
  
  <p>I wrote two bash scripts for that:</p>
  
  <pre><code>#!/bin/bash
  # $1 of repetitions
  
  echo $$
  java -jar jms-test-tool-0.0.1-SNAPSHOT.jar -S -N$1 -F./IN -Ddummy &gt; ./input.log
  
  java -jar jms-test-tool-0.0.1-SNAPSHOT.jar -C -N$1 -F./OUT -Ddummy &gt; ./output.log
  </code></pre>
  
  <p>The very first thing this script does is to send to standard output his own <strong>pid</strong> (echo $$).
  This scripts receives as parameter the number of iteratins ($1) which is used as a parameter  for the java process (-N$1). The first java call will send a file $1 times to the second process and the second process will read $1 times files.</p>
  
  <p>The second script (master.sh) has a for loop with the required steps (1000 10000 100000 and 1000000) calling in every iteration the slave and receiving the <strong>pid</strong> of the slave.</p>
  
  <pre><code>master.sh
  #!/bin/bash
  for steps in 1000 10000 100000 1000000
  do
    pid=`./slave.sh $steps `
  
    echo "Slave pid is : $pid"
    top -b -p$pid      
  done
  </code></pre>
  
  <p>Using <strong>top</strong> I wanted to get the memory, time and %cpu used, but the <strong>pid</strong> of the slave doesn't appear at the process table. </p>
  
  <p>Then two questions. What am I doing wrong here?
  Anybody knows a better way for performing this test?</p>