summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkira Yokosawa <akiyks@gmail.com>2024-01-31 00:37:18 +0900
committerPaul E. McKenney <paulmck@kernel.org>2024-01-30 15:31:00 -0800
commit065052e729ba4f0ebc84583403416d4c964e7fb2 (patch)
tree70103290c47819ae6722286f700acf7037570fed
parenta10c638c3dbb2bfc4748990596d42ac33cb7856c (diff)
downloadperfbook-065052e729ba4f0ebc84583403416d4c964e7fb2.tar.gz
CodeSamples/cpu/data: Use "smooth frequency" for plotting histogram
Add gnuplot scripts for generating EPS plots. Use "smooth frequency" feature of gnuplot for plotting distribution histograms. Distribution data in coe.dat, fre.dat, and rfe.dat are converted on-the-fly into single-column data by using expand.pl as a filter. Signed-off-by: Akira Yokosawa <akiyks@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rwxr-xr-xCodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/expand.pl42
-rw-r--r--CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/plots.sh83
2 files changed, 125 insertions, 0 deletions
diff --git a/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/expand.pl b/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/expand.pl
new file mode 100755
index 00000000..30719692
--- /dev/null
+++ b/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/expand.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Expand frequency data of the form:
+#
+# 1000 4
+# 1004 2
+# 1050 1
+#
+# into:
+#
+# 1000
+# 1000
+# 1000
+# 1000
+# 1004
+# 1004
+# 1050
+#
+# Copyright (C) Akira Yokosawa, 2024
+#
+# Authors: Akira Yokosawa <akiyks@gmail.com>
+
+use strict;
+use warnings;
+
+my $line;
+my $freq;
+my $count;
+
+open(my $fn, '<:encoding(UTF-8)', $ARGV[0])
+ or die "Could not open file '$ARGV[0]' $!";
+
+while($line = <$fn>) {
+ if ($line =~ /(\-?[0-9]+)\s+([0-9]+)/ ) {
+ $freq = $1;
+ $count = $2;
+ for (my $i = 0; $i < $count; $i++) {
+ print "$freq\n";
+ }
+ }
+}
diff --git a/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/plots.sh b/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/plots.sh
index f8abada9..ea04fcac 100644
--- a/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/plots.sh
+++ b/CodeSamples/cpu/data/kerneltest054.05.atn6.2024.01.22-12.28.01/plots.sh
@@ -89,3 +89,86 @@ set nokey
# set label 5 "refcnt" at 0.15,2.8 left
plot "rfe.dat" w points pt 6 pointsize 0.5
---EOF---
+
+# For eps output
+font=../../../../fonts/uhvr8a.pfb
+fontsize=8
+przsize="nosquare 0.55,0.25"
+
+gnuplot << ---EOF---
+set term postscript portrait color ${fontsize} enhanced fontfile "${font}" "NimbusSanL-Regu"
+set size $przsize
+set output "coe-nvals.eps"
+
+set xlabel "Time (Timestamp Periods)"
+set ylabel "Number of Simultaneous Values"
+#set logscale y
+set xrange [:10000]
+#set yrange [100:10000]
+set nokey
+plot "coe-nvals.dat" w l
+---EOF---
+
+gnuplot << ---EOF---
+set term postscript portrait color ${fontsize} enhanced fontfile "${font}" "NimbusSanL-Regu"
+set size $przsize
+set output "coe.eps"
+stats "< perl expand.pl coe.dat" nooutput
+N = STATS_records
+
+set xlabel "Store-to-Store Latency (Timestamp Periods)"
+set ylabel "Frequency (arb. unit)"
+#set logscale y
+set xrange [-1000:3000]
+set yrange [0:]
+set nokey
+#set border 3
+set yzeroaxis
+set boxwidth 40
+#set style fill solid 1.0 noborder
+bin_width = 40
+bin(x) = bin_width * floor(x/bin_width)
+plot "< perl expand.pl coe.dat" using (bin(column(1))):(20./N) smooth frequency with boxes
+---EOF---
+
+gnuplot << ---EOF---
+set term postscript portrait color ${fontsize} enhanced fontfile "${font}" "NimbusSanL-Regu"
+set size $przsize
+set output "fre.eps"
+stats "< perl expand.pl fre.dat" nooutput
+N = STATS_records
+
+set xlabel "Load-to-Store Latency (Timestamp Periods)"
+set ylabel "Frequency (arb. unit)"
+#set logscale y
+set xrange [-250:50]
+set yrange [0:]
+set nokey
+set yzeroaxis
+set boxwidth 2
+#set style fill solid 1.0 noborder
+bin_width = 2
+bin(x) = bin_width * floor(x/bin_width)
+plot "< perl expand.pl fre.dat" using (bin(column(1))):(20./N) smooth frequency with boxes
+---EOF---
+
+gnuplot << ---EOF---
+set term postscript portrait color ${fontsize} enhanced fontfile "${font}" "NimbusSanL-Regu"
+set size $przsize
+set output "rfe.eps"
+stats "< perl expand.pl rfe.dat" nooutput
+N = STATS_records
+
+set xlabel "Store-to-Load Latency (Timestamp Periods)"
+set ylabel "Frequency (arb. unit)"
+#set logscale y
+set xrange [0:350]
+set yrange [0:]
+set nokey
+set yzeroaxis
+set boxwidth 2
+#set style fill solid 1.0 noborder
+bin_width = 2
+bin(x) = bin_width * floor(x/bin_width)
+plot "< perl expand.pl rfe.dat" using (bin(column(1))):(20./N) smooth frequency with boxes
+---EOF---