diff options
author | Charles Baylis <charles.baylis@linaro.org> | 2017-12-14 17:12:28 +0000 |
---|---|---|
committer | Charles Baylis <charles.baylis@linaro.org> | 2017-12-15 10:00:34 +0000 |
commit | e2c016e58be8cf4265e2df92a9c3e966913ab17c (patch) | |
tree | ef1855eda3169fe835a7f8915af6be9b86be9835 | |
parent | 685620cca7db8e25269a1350b29be6f3d64c27ec (diff) |
Highlight lines in profile tables.
Show which tasks used each line in profile when the pointer
hovers above the profile entry.
Change-Id: I99d24f0e7dc384ee7fce3e05787b9692ed30dc83
-rw-r--r-- | matrix-report.pl | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/matrix-report.pl b/matrix-report.pl index 01e0b00..3d6e30a 100644 --- a/matrix-report.pl +++ b/matrix-report.pl @@ -121,7 +121,7 @@ span.hoverprofile { z-index: 1; } -.clickablepid:hover { +.clickable:hover { cursor:pointer; background: rgba(255,255,255,0.4); } @@ -225,18 +225,41 @@ styleSheet = styleEl.sheet; var selectedpid = -1; -function highlight_pids(list) +function highlight_pids(list, inclass) { delete_rules(); + var ruleprefix; + if (typeof inclass !== 'undefined') { + ruleprefix="."+inclass+" "; + } else { + ruleprefix=""; + } list.forEach(function(p) { // var style="box-shadow: inset 0px 0px 10000px rgba(255,255,255,0.6);"; // var style="border-color: black; border-style: solid;"; // var style="box-shadow: 0 0 0 1px black;"; var style="border-color: black; color: white;"; - styleSheet.insertRule(".pid"+p+" { " +style+ "}"); + styleSheet.insertRule(ruleprefix+".pid"+p+" { " +style+ "}"); }); } +function highlight_profile(list) +{ + if (selectedpid < 0) + { + highlight_pids(list, "profile"); + selectedpid = -2; + } +} + +function unhighlight_profile() +{ + if (selectedpid == -2) + { + delete_rules(); + } +} + function do_click(pid) { if (selectedpid != pid) @@ -269,8 +292,8 @@ EOF my $max_count=1+($time[$#time]-$time[0])/$SAMPLE_INTERVAL; print $fh qq(<div id="pidtaskwrapper" class="moreless">); -print $fh qq(<span class="more button" onclick="do_moreless(this.parentElement)">Show all tasks</span>); -print $fh qq(<span class="less button" onclick="do_moreless(this.parentElement)">Show tasks above $MIN_TASK_CPU% cpu usage</span>); +print $fh qq(<span class="more button" onclick="do_moreless(this.parentElement)"><span class="clickable">Show all tasks</span></span>); +print $fh qq(<span class="less button" onclick="do_moreless(this.parentElement)"><span class="clickable">Show tasks above $MIN_TASK_CPU% cpu usage</span></span>); print $fh qq(<br>); foreach my $pid (sort keys %task) { @@ -327,29 +350,30 @@ for (my $i=0;$i<$#cpu;$i++) foreach my $loc (@loc_list) { my $prof_pct = sprintf("%5.1f%%", 100 * $lochash->{$loc} / $n); - my $pid=$loc_to_pid{$loc}; - $loc .= " - $task{$pid}"."[$pid]" if $loc=~/\(\[unknown\]\)$/; + my @loc_pids=keys %{$loc_to_pid{$c}->{$loc}}; my $line = qq($prof_pct - $loc\n); + my $loc_classes=join ' ', map { "pid$_" } @loc_pids; + my $js_loc_pids="[".(join ",",@loc_pids)."]"; + $line = qq(<span class="$loc_classes" onmouseover="highlight_profile($js_loc_pids)" onmouseout="unhighlight_profile()">$line</span>); if ($count++ > $DEFAULT_PROFILE_LIMIT) { - $remainder .= qq(<span class="pid$pid">$line</span>); + $remainder .= $line; } else { - $top_part .= qq(<span class="pid$pid">$line</span>); + $top_part .= $line; } } if ($remainder) { my $more = $count - $DEFAULT_PROFILE_LIMIT; - $str .= qq(<p><div class="moreless" onclick="do_moreless(this)"><span class="profiletable">$top_part</span><span class="more">More... ($more more entries)</span><span class="less"><span class="profiletable">$remainder</span>Less...</span></div>); + $str .= qq(<p><div class="moreless" onclick="do_moreless(this)"><span class="profiletable profile">$top_part</span><span class="more clickable">More... ($more more entries)</span><span class="less"><span class="profiletable">$remainder</span>Less... ($more fewer entries)</span></div>); } else { - $str .= "<p><pre>$top_part</pre>"; + $str .= qq(<p><span class="profiletable profile">$top_part</span>); } - my $max_counts=$REPORT_INTERVAL/$SAMPLE_INTERVAL; $str .= "<br>Threads active in this timeslot<p>"; - $str .= "<table><tr><th>PID</th><th>Task name</th><th>CPU usage</th></tr>"; + $str .= qq(<table class="profile"><tr><th>PID</th><th>Task name</th><th>CPU usage</th></tr>); foreach my $pid (sort keys %{$pids{$c}}) { my $cpu = sprintf("%.1f%%", 100 * $pids{$c}->{$pid} / $max_counts); - $str .= qq(<tr><td class="alignr clickablepid" onclick="do_click($pid)">$pid</td><td>$task{$pid}</td><td class="alignr">$cpu</td></tr>); + $str .= qq(<tr class="pid$pid"><td class="alignr clickable" onclick="do_click($pid)">$pid</td><td>$task{$pid}</td><td class="alignr">$cpu</td></tr>); } $str .= "</table>"; $str .= qq(</span>); @@ -361,10 +385,11 @@ for (my $i=0;$i<$#cpu;$i++) %counts=(); %locs=(); %pids=(); + %loc_to_pid=(); } $counts{$cpu[$i]}++; $locs{$cpu[$i]}->{$where[$i]}++; - $loc_to_pid{$where[$i]}=$pid[$i]; + $loc_to_pid{$cpu[$i]}->{$where[$i]}->{$pid[$i]} = 1; $pids{$cpu[$i]}->{$pid[$i]}++; } |