Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to create a line chart to display the cpu usage of each process over time. How do I create the chart with time as the X axis, %CPU as the Y axis, then use the command name to indicate which line on the chart the data belongs to?

My data was created using the unix command:

pidstat -hdul 1 > file.txt

I then reformatted the data into csv using this command:

sed '1d;/^[#]/d;/^$/d;s/^[ ]*//;s/[ ]+/,/g' raw_data_file_input > nice_data_file.csv

My data is organized into the following columns:

Time, PID, %usr, %system, %guest, %CPU, CPU, KB_rd/s, KB_wr/s, KB_ccwr/s, Command

In other words, I want every command "kjournald" to be one line on the graph at various times, and "gnome-panel" to be another separate line.

Here is a sample of the data in csv format:

share|improve this question
up vote 2 down vote accepted

I don't know how familiar you are with the "Text-to-columns" tool on Excel's "Data" tab, but you can use that to quickly split apart your comma-delimited file.

I may be missing something, but, it appears to me that your sample data has only one instance of each "Command". I couldn't construct a time-dependent line chart with a single data point, so I made up some additional "dummy" data, with dummy values for each "time".

A pivot table will easily handle this. The pivot table will sort the data and you can filter it to only show certain categories ("Commands", in this case).

Once you've built your pivot table you can then click anywhere in the pivot table and "Insert" a chart. See below.

enter image description here

share|improve this answer
There are definitely multiple instances of command. Is it possible for you to post a link to that sample file you created so I can figure out how to correctly create the pivot tables? Oh I see, you simply filter each column based on each "Command" in the pivot table, then graph that. – Andrew Hundt Nov 9 '11 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .