* [PATCH 1/3] tracing/workqueue: fix list header and function name format
@ 2009-05-26 8:06 Zhaolei
2009-05-26 8:21 ` [PATCH 2/3] tracing/workqueue: cleanup for trace_workqueue.c Zhaolei
2009-05-26 8:21 ` [PATCH 3/3] tracing/workqueue: make events sort in ascending order Zhaolei
0 siblings, 2 replies; 4+ messages in thread
From: Zhaolei @ 2009-05-26 8:06 UTC (permalink / raw)
To: Ingo Molnar, Frederic Weisbecker, Steven Rostedt; +Cc: LKML
Fix list header of workqueue trace,
and use %pf to print the function name only(ignore the offsets).
Before patch:
# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
# | | | | ` | -WORKFUNC
# | | | | | |
0 1 1 1053 1053 `-flush_async_commits+0x0/0x90
...
After patch:
# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
# | | | | | `-WORKFUNC
# | | | | | |
0 1 1 1155 1155 `-flush_async_commits
...
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
kernel/trace/trace_workqueue.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index c67be60..6cee4a8 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -409,7 +409,7 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
avg_time = 0;
}
- seq_printf(s, " %3d %6d %6u %6llu %6llu %c-%pF\n",
+ seq_printf(s, " %3d %6d %6u %6llu %6llu %c-%pf\n",
cws->cpu,
wfstat->inserted,
wfstat->executed,
@@ -457,11 +457,13 @@ static void workqueue_stat_file_open(void)
/**/
static int workqueue_stat_headers(struct seq_file *s)
{
- seq_printf(s, "# CPU INSERTED EXECUTED MAX us AVG us"
- " TASKNAME:PID\n");
- seq_printf(s, "# | | | | ` |"
- " -WORKFUNC\n");
- seq_printf(s, "# | | | | | |\n");
+ seq_printf(s,
+ "# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID\n");
+ seq_printf(s,
+ "# | | | | | `-WORKFUNC\n");
+ seq_printf(s,
+ "# | | | | | |\n");
+
return 0;
}
--
1.5.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] tracing/workqueue: cleanup for trace_workqueue.c
2009-05-26 8:06 [PATCH 1/3] tracing/workqueue: fix list header and function name format Zhaolei
@ 2009-05-26 8:21 ` Zhaolei
2009-05-26 8:21 ` [PATCH 3/3] tracing/workqueue: make events sort in ascending order Zhaolei
1 sibling, 0 replies; 4+ messages in thread
From: Zhaolei @ 2009-05-26 8:21 UTC (permalink / raw)
To: Ingo Molnar, Frederic Weisbecker, Steven Rostedt; +Cc: LKML
1: Make function's order in source same with definition in struct tracer_stat
2: Remove ";" after workqueue_stat_file_release()
3: Remove redundant blank in struct tracer_stat workqueue_stats
4: add "static" prefix for some function and struct
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
kernel/trace/trace_workqueue.c | 65 +++++++++++++++++++--------------------
1 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index 6cee4a8..53fe43e 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -81,7 +81,7 @@ static int wq_file_ref;
* Update record when insert a work into workqueue
* Caller need to hold cpu_workqueue_stats spin_lock
*/
-int do_worklet_enqueue(struct cpu_workqueue_stats *cws,
+static int do_worklet_enqueue(struct cpu_workqueue_stats *cws,
struct work_struct *work)
{
struct workfunc_stats *wfstat;
@@ -422,6 +422,27 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
return 0;
}
+static int workqueue_stat_headers(struct seq_file *s)
+{
+ seq_printf(s,
+ "# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID\n");
+ seq_printf(s,
+ "# | | | | | `-WORKFUNC\n");
+ seq_printf(s,
+ "# | | | | | |\n");
+
+ return 0;
+}
+
+static void workqueue_stat_file_open(void)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&free_wq_lock, flags);
+ wq_file_ref++;
+ spin_unlock_irqrestore(&free_wq_lock, flags);
+}
+
/*
* Here we are sure that we have no more readers on our stat file
* and that further readers will block until we return from this function.
@@ -443,42 +464,20 @@ static void workqueue_stat_file_release(void)
}
spin_unlock_irqrestore(&free_wq_lock, flags);
-};
-
-static void workqueue_stat_file_open(void)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&free_wq_lock, flags);
- wq_file_ref++;
- spin_unlock_irqrestore(&free_wq_lock, flags);
-}
-
- /**/
-static int workqueue_stat_headers(struct seq_file *s)
-{
- seq_printf(s,
- "# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID\n");
- seq_printf(s,
- "# | | | | | `-WORKFUNC\n");
- seq_printf(s,
- "# | | | | | |\n");
-
- return 0;
}
-struct tracer_stat workqueue_stats __read_mostly = {
- .name = "workqueues",
- .stat_start = workqueue_stat_start,
- .stat_next = workqueue_stat_next,
- .stat_show = workqueue_stat_show,
- .stat_headers = workqueue_stat_headers,
- .file_open = workqueue_stat_file_open,
- .file_open = workqueue_stat_file_release,
+static struct tracer_stat workqueue_stats __read_mostly = {
+ .name = "workqueues",
+ .stat_start = workqueue_stat_start,
+ .stat_next = workqueue_stat_next,
+ .stat_show = workqueue_stat_show,
+ .stat_headers = workqueue_stat_headers,
+ .file_open = workqueue_stat_file_open,
+ .file_open = workqueue_stat_file_release,
};
-int __init stat_workqueue_init(void)
+static int __init stat_workqueue_init(void)
{
if (register_stat_tracer(&workqueue_stats)) {
pr_warning("Unable to register workqueue stat tracer\n");
@@ -493,7 +492,7 @@ fs_initcall(stat_workqueue_init);
* Workqueues are created very early, just after pre-smp initcalls.
* So we must register our tracepoints at this stage.
*/
-int __init trace_workqueue_early_init(void)
+static int __init trace_workqueue_early_init(void)
{
int ret, cpu;
--
1.5.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] tracing/workqueue: make events sort in ascending order
2009-05-26 8:06 [PATCH 1/3] tracing/workqueue: fix list header and function name format Zhaolei
2009-05-26 8:21 ` [PATCH 2/3] tracing/workqueue: cleanup for trace_workqueue.c Zhaolei
@ 2009-05-26 8:21 ` Zhaolei
2009-05-26 21:01 ` Frederic Weisbecker
1 sibling, 1 reply; 4+ messages in thread
From: Zhaolei @ 2009-05-26 8:21 UTC (permalink / raw)
To: Ingo Molnar, Frederic Weisbecker, Steven Rostedt; +Cc: LKML
Events in workqueue tracer need to be sorted in ascending order to make user
clear.
But now it is reversed by "tracing/stat: replace linked list by an rbtree
for sorting"(53059c9b67a62a3dc8c80204d3da42b9267ea5a0).
We need to define a custom cmp() callback to make sorting correct.
Before patch:
# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
# | | | | | `-WORKFUNC
# | | | | | |
0 1 1 1155 1155 `-xprt_autoclose
0 19 19 864 143 |-xs_udp_connect_worker4
...
0 1 1 4825 4825 |-reg_todo
0 443 515 events/0:5
After patch:
# CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
# | | | | | `-WORKFUNC
# | | | | | |
0 443 515 events/0:5
0 1 1 4825 4825 |-reg_todo
...
0 19 19 797 134 |-xs_udp_connect_worker4
0 1 1 8359 8359 `-xprt_autoclose
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
kernel/trace/trace_workqueue.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index 53fe43e..7fa0d23 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -383,6 +383,12 @@ static void *workqueue_stat_next(void *prev, int idx)
return ret;
}
+/* To make events sort in ascending order */
+static int workqueue_stat_cmp(void *p1, void *p2)
+{
+ return -1;
+}
+
static int workqueue_stat_show(struct seq_file *s, void *p)
{
struct workfunc_stats *wfstat = p;
@@ -470,6 +476,7 @@ static struct tracer_stat workqueue_stats __read_mostly = {
.name = "workqueues",
.stat_start = workqueue_stat_start,
.stat_next = workqueue_stat_next,
+ .stat_cmp = workqueue_stat_cmp,
.stat_show = workqueue_stat_show,
.stat_headers = workqueue_stat_headers,
.file_open = workqueue_stat_file_open,
--
1.5.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] tracing/workqueue: make events sort in ascending order
2009-05-26 8:21 ` [PATCH 3/3] tracing/workqueue: make events sort in ascending order Zhaolei
@ 2009-05-26 21:01 ` Frederic Weisbecker
0 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 21:01 UTC (permalink / raw)
To: Zhaolei; +Cc: Ingo Molnar, Steven Rostedt, LKML
On Tue, May 26, 2009 at 04:21:42PM +0800, Zhaolei wrote:
> Events in workqueue tracer need to be sorted in ascending order to make user
> clear.
> But now it is reversed by "tracing/stat: replace linked list by an rbtree
> for sorting"(53059c9b67a62a3dc8c80204d3da42b9267ea5a0).
> We need to define a custom cmp() callback to make sorting correct.
That's my bad, the reverse sorting subsequent to this patch is an accident
so the fix should be done in the stat tracing framework.
I'll fix that.
The other patches for the workqueue tracer look good. I'll apply
them and send a pull request to Ingo.
Thanks!
>
> Before patch:
> # CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
> # | | | | | `-WORKFUNC
> # | | | | | |
> 0 1 1 1155 1155 `-xprt_autoclose
> 0 19 19 864 143 |-xs_udp_connect_worker4
> ...
> 0 1 1 4825 4825 |-reg_todo
> 0 443 515 events/0:5
>
> After patch:
> # CPU INSERTED EXECUTED MAX us AVG us TASKNAME:PID
> # | | | | | `-WORKFUNC
> # | | | | | |
> 0 443 515 events/0:5
> 0 1 1 4825 4825 |-reg_todo
> ...
> 0 19 19 797 134 |-xs_udp_connect_worker4
> 0 1 1 8359 8359 `-xprt_autoclose
>
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
> kernel/trace/trace_workqueue.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
> index 53fe43e..7fa0d23 100644
> --- a/kernel/trace/trace_workqueue.c
> +++ b/kernel/trace/trace_workqueue.c
> @@ -383,6 +383,12 @@ static void *workqueue_stat_next(void *prev, int idx)
> return ret;
> }
>
> +/* To make events sort in ascending order */
> +static int workqueue_stat_cmp(void *p1, void *p2)
> +{
> + return -1;
> +}
> +
> static int workqueue_stat_show(struct seq_file *s, void *p)
> {
> struct workfunc_stats *wfstat = p;
> @@ -470,6 +476,7 @@ static struct tracer_stat workqueue_stats __read_mostly = {
> .name = "workqueues",
> .stat_start = workqueue_stat_start,
> .stat_next = workqueue_stat_next,
> + .stat_cmp = workqueue_stat_cmp,
> .stat_show = workqueue_stat_show,
> .stat_headers = workqueue_stat_headers,
> .file_open = workqueue_stat_file_open,
> --
> 1.5.5.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-26 21:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-26 8:06 [PATCH 1/3] tracing/workqueue: fix list header and function name format Zhaolei
2009-05-26 8:21 ` [PATCH 2/3] tracing/workqueue: cleanup for trace_workqueue.c Zhaolei
2009-05-26 8:21 ` [PATCH 3/3] tracing/workqueue: make events sort in ascending order Zhaolei
2009-05-26 21:01 ` Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox