Skip to content

Commit 4f1202c

Browse files
fenrus75Ingo Molnar
authored andcommitted
perf timechart: Show the name of the waker/wakee in timechart
Timechart currently shows thin green lines for sending or receiving wakeups. This patch also prints (in a very small font) the name of the process that is being woken/wakes up this process. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20090920181328.68baa978@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent cdf8073 commit 4f1202c

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

tools/perf/builtin-timechart.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ static void draw_wakeups(void)
752752
we = wake_events;
753753
while (we) {
754754
int from = 0, to = 0;
755+
char *task_from = NULL, *task_to = NULL;
755756

756757
/* locate the column of the waker and wakee */
757758
p = all_data;
@@ -760,10 +761,14 @@ static void draw_wakeups(void)
760761
c = p->all;
761762
while (c) {
762763
if (c->Y && c->start_time <= we->time && c->end_time >= we->time) {
763-
if (p->pid == we->waker)
764+
if (p->pid == we->waker) {
764765
from = c->Y;
765-
if (p->pid == we->wakee)
766+
task_from = c->comm;
767+
}
768+
if (p->pid == we->wakee) {
766769
to = c->Y;
770+
task_to = c->comm;
771+
}
767772
}
768773
c = c->next;
769774
}
@@ -776,7 +781,7 @@ static void draw_wakeups(void)
776781
else if (from && to && abs(from - to) == 1)
777782
svg_wakeline(we->time, from, to);
778783
else
779-
svg_partial_wakeline(we->time, from, to);
784+
svg_partial_wakeline(we->time, from, task_from, to, task_to);
780785
we = we->next;
781786
}
782787
}

tools/perf/util/svghelper.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void svg_pstate(int cpu, u64 start, u64 end, u64 freq)
242242
}
243243

244244

245-
void svg_partial_wakeline(u64 start, int row1, int row2)
245+
void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2)
246246
{
247247
double height;
248248

@@ -251,21 +251,35 @@ void svg_partial_wakeline(u64 start, int row1, int row2)
251251

252252

253253
if (row1 < row2) {
254-
if (row1)
254+
if (row1) {
255255
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
256256
time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/32);
257-
258-
if (row2)
257+
if (desc2)
258+
fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"0.02pt\">%s &gt;</text>\n",
259+
time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT + SLOT_HEIGHT/48, desc2);
260+
}
261+
if (row2) {
259262
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
260263
time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row2 * SLOT_MULT);
264+
if (desc1)
265+
fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"0.02pt\">%s &gt;</text>\n",
266+
time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, desc1);
267+
}
261268
} else {
262-
if (row2)
269+
if (row2) {
263270
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
264271
time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/32);
265-
266-
if (row1)
272+
if (desc1)
273+
fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"0.02pt\">%s &lt;</text>\n",
274+
time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/48, desc1);
275+
}
276+
if (row1) {
267277
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
268278
time2pixels(start), row1 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row1 * SLOT_MULT);
279+
if (desc2)
280+
fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f) rotate(90)\" font-size=\"0.02pt\">%s &lt;</text>\n",
281+
time2pixels(start), row1 * SLOT_MULT - SLOT_HEIGHT/32, desc2);
282+
}
269283
}
270284
height = row1 * SLOT_MULT;
271285
if (row2 > row1)

tools/perf/util/svghelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern void svg_pstate(int cpu, u64 start, u64 end, u64 freq);
1717
extern void svg_time_grid(u64 start, u64 end);
1818
extern void svg_legenda(void);
1919
extern void svg_wakeline(u64 start, int row1, int row2);
20-
extern void svg_partial_wakeline(u64 start, int row1, int row2);
20+
extern void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2);
2121
extern void svg_interrupt(u64 start, int row);
2222
extern void svg_text(int Yslot, u64 start, const char *text);
2323
extern void svg_close(void);

0 commit comments

Comments
 (0)