aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Baylis <charles.baylis@linaro.org>2017-12-12 15:39:25 +0000
committerCharles Baylis <charles.baylis@linaro.org>2017-12-12 16:34:40 +0000
commit1c26ccaa08475805d50d7c213cb98dd64cde6eda (patch)
treebb1d57ec1bed83b32accf65e9a24673804824035
parent74cef258e0d148e3ffa33eeb1b61d9a8148d144f (diff)
pid highlighting initial version
Change-Id: I510ce82f0d121f73b34d33425932d03607c08a44
-rw-r--r--perf-utilization.pl36
1 files changed, 30 insertions, 6 deletions
diff --git a/perf-utilization.pl b/perf-utilization.pl
index 4413bd6..cc7872f 100644
--- a/perf-utilization.pl
+++ b/perf-utilization.pl
@@ -35,7 +35,7 @@ if (defined $OUTPUT)
open INPUT, "<", "$tmpdir/perfscript.out" or die "Open failed: $!";
-my (@cpu, @time, @where);
+my (@pid, @cpu, @time, @where);
my ($max_cpu);
while (<INPUT>)
@@ -47,12 +47,13 @@ while (<INPUT>)
warn "Command line configured interval was $SAMPLE_INTERVAL, but perf.data header has $discovered_interval" if $SAMPLE_INTERVAL != $discovered_interval;
}
next unless /\s*(\S+)\s+(\d+)\s+\[0*(\d+)\]\s+(\d+\.\d+):\s+(\d+)\s+(\S+)\s+(\S+)\s+(.*)/;
- my ($cpu, $time, $where) = ($3, $4, $8);
+ my ($pid, $cpu, $time, $where) = ($2, $3, $4, $8);
$max_cpu = $cpu if $cpu > $max_cpu;
push @cpu, $cpu;
push @time, $time;
push @where, $where;
+ push @pid, $pid;
}
print $fh <<EOF;
@@ -93,9 +94,6 @@ th.rotate {
transform:rotate(190deg);
}
-.hashover:hover {
- box-shadow: inset 0px 0px 10000px rgba(255,255,255,0.6);
-}
.hashover:hover .hoverprofile {
visibility: visible;
@@ -104,6 +102,27 @@ th.rotate {
</style>
</head>
<body>
+<script>
+var styleEl = document.createElement('style'), styleSheet;
+
+// Append style element to head
+document.head.appendChild(styleEl);
+
+// Grab style sheet
+styleSheet = styleEl.sheet;
+
+
+function highlight_pids(list)
+{
+ list.forEach(function(p) {
+ styleSheet.insertRule(".pid"+p+" { box-shadow: inset 0px 0px 10000px rgba(255,255,255,0.6); }");
+ });
+}
+function delete_rules()
+{
+ while (styleSheet.cssRules.length > 0) { styleSheet.deleteRule(0); }
+}
+</script>
<table>
EOF
@@ -118,6 +137,7 @@ my $first_time=$time[0];
my $start_time=$first_time;
my %counts;
my %locs;
+my %pids;
for (my $i=0;$i<$#cpu;$i++)
{
if ($time[$i] > ($start_time + $REPORT_INTERVAL))
@@ -134,7 +154,9 @@ for (my $i=0;$i<$#cpu;$i++)
my $pct = 100*$n/($REPORT_INTERVAL/$SAMPLE_INTERVAL);
my $col = 10*int($pct/10);
$col = $col > 90 ? 90 : $col;
- $str .= qq(<td class="bg$col hashover">);
+ my $pid_list="[".(join ',', keys %{$pids{$c}})."]";
+ my $pid_classes=join ' ', map { "pid$_" } keys %{$pids{$c}};
+ $str .= qq(<td class="bg$col hashover $pid_classes" onmouseover="highlight_pids($pid_list)" onmouseout="delete_rules()">);
$str .= sprintf("%.0f%%",$pct);
if ($n > 0) {
$str .= qq(<span class="hoverprofile">);
@@ -156,9 +178,11 @@ for (my $i=0;$i<$#cpu;$i++)
%counts=();
%locs=();
+ %pids=();
}
$counts{$cpu[$i]}++;
$locs{$cpu[$i]}->{$where[$i]}++;
+ $pids{$cpu[$i]}->{$pid[$i]} = 1;
}
print $fh <<EOF;