Skip to contentSkip to conversation

perf: Use appropriate pointer type instead of silly typecasting

PATCH Arnaldo Carvalho de Melo 2 participants 2 messages Nov 30, 2010 – Dec 1, 2010 2 messages not in the archive perf events

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Em Tue, Nov 30, 2010 at 05:49:35PM -0000, Thomas Gleixner escreveu:

Quoted 4 lines

There is no reason to use a struct sample_event pointer in struct sample_queue and type cast it when flushing the queue.

I touched that code in a branch I'm working on, same change :-\ Well, testing the other patches, thanks!

- Arnaldo

Quoted 26 lines
 tools/perf/util/session.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6-tip/tools/perf/util/session.c
===================================================================

tools/perf/util/session.c +2 -2
@@ -386,7 +386,7 @@ static event__swap_op event__swap_ops[] 
 
 struct sample_queue {
 	u64			timestamp;
-	struct sample_event	*event;
+	event_t			*event;
 	struct list_head	list;
 };
 
@@ -406,7 +406,7 @@ static void flush_sample_queue(struct pe
 		if (iter->timestamp > limit)
 			break;
 
-		ops->sample((event_t *)iter->event, s);
+		ops->sample(iter->event, s);
 
 		os->last_flush = iter->timestamp;
 		list_del(&iter->list);
#3 lore raw

[tip:perf/core] perf session: Use appropriate pointer type instead of silly typecasting

In reply to a message not in the archive
Commit-ID:  28990f75e66b36faf6ce56747890009d4e250243
Gitweb:     http://git.kernel.org/tip/28990f75e66b36faf6ce56747890009d4e250243
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Tue, 30 Nov 2010 17:49:35 +0000
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 30 Nov 2010 19:55:26 -0200

perf session: Use appropriate pointer type instead of silly typecasting

There is no reason to use a struct sample_event pointer in struct sample_queue and type cast it when flushing the queue.

Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>

---
 tools/perf/util/session.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/session.c +2 -2
index daca557..525bcf6 100644
@@ -386,7 +386,7 @@ static event__swap_op event__swap_ops[] = {
 
 struct sample_queue {
 	u64			timestamp;
-	struct sample_event	*event;
+	event_t			*event;
 	struct list_head	list;
 };
 
@@ -406,7 +406,7 @@ static void flush_sample_queue(struct perf_session *s,
 		if (iter->timestamp > limit)
 			break;
 
-		ops->sample((event_t *)iter->event, s);
+		ops->sample(iter->event, s);
 
 		os->last_flush = iter->timestamp;
 		list_del(&iter->list);