[PATCH] Add the begin/end markers to events with the proper flags

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 30 15:42:30 PST 2013

From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Thu, 31 Jan 2013 10:34:41 +1100
Subject: [PATCH] Add the begin/end markers to events with the proper flags

When we create the event names, the name itself does not include the
information about whether the event is the beginning or end of some
state, so we end up having things like events named "deco" and then in
the event flags it says whether this is the *beginning* of deco, or the

And when we show the event, we only used to show the name.  This patch
makes us show whether it's the begin or end event for events that have
those flags.  So now you see "deco begin" and "deco end" instead of just
two events both called "deco".

It would perhaps be nice if we somehow showed the range between the
events too, and paired them up visually some way, but that's a separate
and much more difficult thing to do.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
 profile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/profile.c b/profile.c
index ce3dd81e3eb9..bb55f5b15673 100644
--- a/profile.c
+++ b/profile.c
@@ -400,7 +400,9 @@ static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, st
 			snprintf(buffer, sizeof(buffer), "%s: %d", _(event->name), event->value);
 	} else {
-		snprintf(buffer, sizeof(buffer), "%s", _(event->name));
+		snprintf(buffer, sizeof(buffer), "%s%s", _(event->name),
+			event->flags == SAMPLE_FLAGS_BEGIN ? " begin" :
+			event->flags == SAMPLE_FLAGS_END ? " end" : "");
 	attach_tooltip(x-15, y-6, 12, 12, buffer);

More information about the subsurface mailing list