1

Laptop temperature based on running kernelkey

I'm trying to plot temperatures of my laptop, here are my working files at github

I have epoch, temperature & kernel identifier data like so:

1357786501 72 3.6.11-1-ARCH
1357786801 72 3.6.11-1-ARCH
1357787101 60 3.0.57-1-lts
1357787401 54 3.0.57-1-lts
1357800301 52 3.0.57-1-lts
1357800601 48 3.6.11-1-ARCH
1357800902 45 3.6.11-1-ARCH

The closest I've got to what I want is (using this):

set term svg size 1024,708
set xdata time
set key outside
set timefmt "%s"
set ytics 5
set format x "%d/%m"
plot "< awk '{if($3 == \"3.0.57-1-lts\") print}' temp.csv" u 1:2 t column(3) w p pt 2, \
 "< awk '{if($3 == \"3.6.10-1-ARCH\") print}' temp.csv" u 1:2 t column(3) w p pt 2, \
 "< awk '{if($3 == \"3.6.11-1-ARCH\") print}' temp.csv" u 1:2 t column(3) w p pt 2, \
 "< awk '{if($3 == \"3.8.1-1-mainline-dirty\") print}' temp.csv" u 1:2 t column(3) w p pt 2

gihub kaihendry

Is there a way to avoid using awk? When I don't use this awk, it fails to plot differing kernel identifiers.

Can I make it a continuous line with different colours instead somehow?

Any ideas how to make SVG output without width/height? Any tricks to make it look better?

1 Answer 1

1

If your version of Gnuplot is recent enough, you can use a for-loop and iterator to loop over the different strings you want to match, see for example manual page 88-89 or this blog entry. To ignore non-matching lines you can use the ternary operator (cond ? iftrue : iffalse) to set these values to "Not-A-Number" (1/0 or NaN):

set xdata time
set key outside
set timefmt '%s'
set ytics 5
set format x '%d/%m'
set style data linespoints
archs = "`cut -d' ' -f3 temp.csv | sort -u | tr '\n' ' '`"
plot for [arch in archs] 'temp.csv' using 1:((strcol(3) eq arch) ? $2:1/0) title arch
Sign up to request clarification or add additional context in comments.

9 Comments

Is there no way to avoid manually putting in '3.6.11-1-ARCH 3.0.57-1-lts 3.6.11-1-ARCH' ? awk '{print $3}' temp.csv | sort -u
@hendry: not that I'm aware of.
I have a strange plot on the bottom left, 0 on the X axis: s.natalian.org/2013-01-14/1358154089_1366x768.png
Great stuff Thor, except do you see the strange plot on the bottom left ?
@hendry: yes this is very odd. The numbers that Gnuplot generates make it look like there's a bug somewhere. You can get the raw numbers by inserting set table 'out.txt' before the plot command.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.