From: Josef Bacik <jbacik@fb.com>
To: <rostedt@goodmis.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>
Subject: [PATCH 2/5] trace-cmd: group schedule stacktraces together with --merge
Date: Fri, 8 May 2015 15:29:01 -0400 [thread overview]
Message-ID: <1431113344-22579-3-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1431113344-22579-1-git-send-email-jbacik@fb.com>
With --merge we want to be able to merge the scheduling information as well so
we can see how the whole app spent its time. This is a little tricky because we
have to sort based on comm instead of pid. It works out well enough because we
store the intermediate information in the per task hash, but we want to group
the final information together.
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
trace-profile.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/trace-profile.c b/trace-profile.c
index bd775e8..eee026e 100644
--- a/trace-profile.c
+++ b/trace-profile.c
@@ -985,6 +985,7 @@ static int handle_sched_switch_event(struct handle_data *h,
unsigned long long prev_pid;
unsigned long long prev_state;
unsigned long long next_pid;
+ unsigned long long val = 0;
struct start_data *start;
/* pid_field holds prev_pid, data_field holds prev_state */
@@ -1019,6 +1020,12 @@ static int handle_sched_switch_event(struct handle_data *h,
if (!task->comm)
add_task_comm(h, task, h->switch_next_comm, record);
+ if (task->comm && task->group) {
+ char *str = task->comm;
+ while (*str) val += (int)*(str++);
+ } else
+ val = next_pid;
+
/*
* If the next task was blocked, it required a wakeup to
* restart, and there should be one.
@@ -1028,10 +1035,10 @@ static int handle_sched_switch_event(struct handle_data *h,
*
* event_data->start holds the sched_wakeup event data.
*/
- find_and_update_start(task, event_data->start, record->ts, next_pid);
+ find_and_update_start(task, event_data->start, record->ts, val);
/* Look for this task if it was preempted (no wakeup found). */
- find_and_update_start(task, event_data, record->ts, next_pid);
+ find_and_update_start(task, event_data, record->ts, val);
return 0;
}
@@ -1186,6 +1193,7 @@ static int handle_sched_wakeup_event(struct handle_data *h,
struct task_data *task = NULL;
struct start_data *start;
unsigned long long success;
+ unsigned long long val = 0;
proxy = find_task(h, pid);
@@ -1224,11 +1232,17 @@ static int handle_sched_wakeup_event(struct handle_data *h,
*/
proxy->proxy = task;
+ if (task->comm && task->group) {
+ char *str = task->comm;
+ while (*str) val += (int)*(str++);
+ } else
+ val = pid;
+
/* There should be a blocked schedule out of this task */
- find_and_update_start(task, event_data->start, record->ts, pid);
+ find_and_update_start(task, event_data->start, record->ts, val);
/* Set this up for timing how long the wakeup takes */
- start = add_start(task, event_data, record, pid, pid);
+ start = add_start(task, event_data, record, val, val);
task->last_event = NULL;
task->last_start = start;
--
2.1.0
next prev parent reply other threads:[~2015-05-08 19:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 19:28 [PATCH 0/5] trace-cmd profile enhancements Josef Bacik
2015-05-08 19:29 ` [PATCH 1/5] trace-cmd: add option to group like comms for profile Josef Bacik
2015-05-20 17:31 ` Steven Rostedt
2015-05-20 17:51 ` Josef Bacik
2015-05-08 19:29 ` Josef Bacik [this message]
2015-05-20 17:36 ` [PATCH 2/5] trace-cmd: group schedule stacktraces together with --merge Steven Rostedt
2015-05-20 17:54 ` Josef Bacik
2015-05-08 19:29 ` [PATCH 3/5] trace-cmd: lookup syscall names in profile Josef Bacik
2015-05-20 18:00 ` Steven Rostedt
2015-05-20 18:22 ` Josef Bacik
2015-05-20 18:56 ` Steven Rostedt
2015-05-20 19:01 ` Steven Rostedt
2015-05-20 19:06 ` Josef Bacik
2015-05-08 19:29 ` [PATCH 4/5] trace-cmd: sort the events in the profile output Josef Bacik
2015-05-08 19:29 ` [PATCH 5/5] trace-cmd: make trace-hist work with instances Josef Bacik
2015-05-08 20:13 ` [PATCH 0/5] trace-cmd profile enhancements Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431113344-22579-3-git-send-email-jbacik@fb.com \
--to=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome