diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-07-17 12:06:51 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-07-20 17:48:46 -0400 |
commit | a39e67c0c179e9168aa6210999779d7be4ddf1c3 (patch) | |
tree | 08e464518ffc3337ccdc2d8fad5a2fe1bfdc1445 | |
parent | b049432dfd4a6554cbc543edfb55312a748d669f (diff) | |
download | trace-cmd-a39e67c0c179e9168aa6210999779d7be4ddf1c3.tar.gz |
trace-cmd/profile: Fix merging of by-comm tasks for schedule
The sched_switch event had the same issue as the sched_wakeup event
in that the pid was used for lookups. Instead of having a separate
merge matching function, use the normal lookup function, but as we
do not care if the pid of the sched_switch or sched_wakeup events
are different, as long as we know that they all belong to the same
comm, we can ignore them. Just need to modify the search vals before
doing the lookups.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-profile.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/trace-profile.c b/trace-profile.c index 33c63bd1..0304e9b7 100644 --- a/trace-profile.c +++ b/trace-profile.c @@ -2227,41 +2227,34 @@ static void merge_stacks(struct event_hash *exist, struct event_hash *event) } } -/* - * We use the pid in some of the fields in the event data which isn't helpful - * when we're trying to merge things, so just pay attention to the event_data - * field. - */ -static int match_event_for_merge(struct trace_hash_item *item, void *data) -{ - struct event_data_match *edata = data; - struct event_hash *event = event_from_item(item); - - return event->event_data == edata->event_data; -} - static void merge_event_into_group(struct group_data *group, struct event_hash *event) { struct event_hash *exist; struct trace_hash_item *item; struct event_data_match edata; - trace_hash_func match; unsigned long long key; if (event->event_data->type == EVENT_TYPE_WAKEUP) { edata.event_data = event->event_data; - match = match_event_for_merge; + event->search_val = 0; + event->val = 0; key = trace_hash((unsigned long)event->event_data); - } else { + } else if (event->event_data->type == EVENT_TYPE_SCHED_SWITCH) { edata.event_data = event->event_data; - edata.search_val = event->search_val; - edata.val = event->val; + event->search_val = event->val; + key = (unsigned long)event->event_data + + ((unsigned long)event->val * 2); + key = trace_hash(key); + } else { key = event->hash.key; - match = match_event; } - item = trace_hash_find(&group->event_hash, key, match, &edata); + edata.event_data = event->event_data; + edata.search_val = event->search_val; + edata.val = event->val; + + item = trace_hash_find(&group->event_hash, key, match_event, &edata); if (!item) { event->hash.key = key; trace_hash_add(&group->event_hash, &event->hash); |