Skip to content

Commit f25b92f

Browse files
authored
Merge pull request #191 from intel-innersource/rdementi/some-csv-scripts-2022-03-21
add some experimental pcm csv data plot scripts
2 parents 6deb088 + 5c79169 commit f25b92f

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed

scripts/find_field.awk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/awk -f
2+
3+
{
4+
for(i=1; i<=NF; i++) {
5+
if (index($i, term) > 0) print (i)":"$i;
6+
}
7+
}

scripts/find_field.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
head -1 $1 | awk -F ',' -v term="$2" -f find_field.awk
4+
5+

scripts/pcm.plot

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
set key autotitle columnhead
3+
set datafile separator ","
4+
5+
# change as needed
6+
# set xlabel 'sample # (each is 1000ms)'
7+
8+
set ylabel 'metric value'
9+
10+
set terminal pdf
11+
set output "pcm.pdf"
12+
13+
# change below as needed
14+
# plot metrics 3 .. 37
15+
do for [m=3:37] {
16+
plot "single_header.pcm.csv" using m with dots
17+
}
18+
19+
# plot metrics 84 .. 107
20+
do for [m=84:107] {
21+
plot "single_header.pcm.csv" using m with dots
22+
}
23+
24+

scripts/single_header.awk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
BEGIN {
2+
line = 0;
3+
}
4+
5+
{
6+
if (line == 0)
7+
{
8+
# print $0;
9+
for(i=1; i<=NF; i++) {
10+
first[i] = $i;
11+
}
12+
}
13+
else if (line == 1)
14+
{
15+
for(i=1; i<=NF; i++) {
16+
if ($i != "") printf first[i]" "$i","
17+
}
18+
print ""
19+
}
20+
else
21+
{
22+
print $0
23+
}
24+
25+
line = line + 1;
26+
}

scripts/single_header.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
cat $1 | awk -F ',' -f single_header.awk > single_header.$1
4+

0 commit comments

Comments
 (0)