Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I typically throw together a simple script for this type of work.</p> <p>Take a look at the kernel documentation for the proc filesystem (Google 'linux proc.txt').</p> <p>The first line of <code>/proc/stat</code> (Section 1.8 in proc.txt) will give you cumulative cpu usage stats (i.e. user, nice, system, idle, ...). For each process, the file <code>/proc/$PID/stat</code> (Table 1-4 in proc.txt) will provide you with both process-specific cpu usage stats and memory usage stats (see rss).</p> <p>If you google a bit you'll find plenty of detailed info on these files, and pointers to libraries / apps / code snippets that can help you obtain / derive the values you need. With that in mind, I'll focus on the high-level strategy. </p> <p>For CPU stats, use your favorite scripting language to create an executable that takes a set of process ids for monitoring. At a fixed interval (ex: 1 second) poll / calculate the cumulative totals for each process and the system as a whole. During each poll interval, write all results on a single line to stdout.</p> <p>For memory stats, write a similar script, but simply log the per-process memory usage. Memory is a bit easier as we directly obtain the instantaneous values.</p> <p>Run these script for the duration of your test, passing the set of processes ids that you'd like to monitor and redirecting its output to a log file.</p> <pre><code>./logcpu $(pidof foo) $(pidof bar) &gt; cpustats ./logmem $(pidof foo) $(pidof bar) &gt; memstats </code></pre> <p>Import the contents of these files into a spreadsheet (for certain applications this is as easy as copy / paste). For CPU, you are after instantaneous values but have cumulative values, so you'll need to do some minor spreadsheet work to derive these values (it's just the delta 't(x + 1) - t(x)'). Of course you could have your cpu logger write the delta, but you'll be spending a bit more time up front on the script.</p> <p>Finally, use your spreadsheet to generate a nice plot.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload