Skip to contentSkip to conversation

perf top: Fix sample counting

PATCH New Arnaldo Carvalho de Melo 1 participant 2 messages Jan 21, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 perf top: Fix sample counting

From: Arnaldo Carvalho de Melo <[email protected]>

Broken since "5b2bb75 perf top: Support userspace symbols too".

---
 tools/perf/builtin-top.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/builtin-top.c +3 -3
index 7a8a77e..8b04988 100644
@@ -934,8 +934,11 @@ static void event__process_sample(const event_t *self,
 	struct addr_location al;
 	u8 origin = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
+	++samples;
+
 	switch (origin) {
 	case PERF_RECORD_MISC_USER:
+		++userspace_samples;
 		if (hide_user_symbols)
 			return;
 		break;
@@ -960,9 +963,6 @@ static void event__process_sample(const event_t *self,
 		if (list_empty(&syme->node) || !syme->node.next)
 			__list_insert_active_sym(syme);
 		pthread_mutex_unlock(&active_symbols_lock);
-		if (origin == PERF_RECORD_MISC_USER)
-			++userspace_samples;
-		++samples;
 	}
 }
 
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 2/2 perf top: Handle PERF_RECORD_{FORK,EXIT} events

From: Arnaldo Carvalho de Melo <[email protected]>

As noticed by Mike, symbols in new tasks were not being processed as we weren't processing these events.

---
 tools/perf/builtin-top.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +4 -0
index 8b04988..2227b84 100644
@@ -975,6 +975,10 @@ static int event__process(event_t *event, struct perf_session *session)
 	case PERF_RECORD_MMAP:
 		event__process_mmap(event, session);
 		break;
+	case PERF_RECORD_FORK:
+	case PERF_RECORD_EXIT:
+		event__process_task(event, session);
+		break;
 	default:
 		break;
 	}
Signature · 1 line
1.6.2.5