From: Frederic Weisbecker <fweisbec@gmail.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <srostedt@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] trace_stat: keep original order
Date: Wed, 25 Mar 2009 14:30:29 +0100 [thread overview]
Message-ID: <20090325133028.GE5976@nowhere> (raw)
In-Reply-To: <49C9F23F.5040307@cn.fujitsu.com>
On Wed, Mar 25, 2009 at 04:58:39PM +0800, Lai Jiangshan wrote:
>
> Impact: make trace_stat files show items with the original order
>
> trace_stat tracer reverse the items, it makes the output
> looks a little ugly.
>
> Example, when we read trace_stat/workqueues, we get cpu#7's stat.
> at first, and then cpu#6... cpu#0.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
> index f71b85b..c08e7f1 100644
> --- a/kernel/trace/trace_stat.c
> +++ b/kernel/trace/trace_stat.c
> @@ -125,23 +125,21 @@ static int stat_seq_init(struct tracer_stat_session *session)
> INIT_LIST_HEAD(&new_entry->list);
> new_entry->stat = stat;
>
> - list_for_each_entry(iter_entry, &session->stat_list, list) {
> + list_for_each_entry_reverse(iter_entry, &session->stat_list,
> + list) {
>
> /* Insertion with a descendent sorting */
> - if (ts->stat_cmp(new_entry->stat,
> - iter_entry->stat) > 0) {
> + if (ts->stat_cmp(iter_entry->stat,
> + new_entry->stat) >= 0) {
>
> - list_add_tail(&new_entry->list,
> - &iter_entry->list);
> - break;
> -
> - /* The current smaller value */
> - } else if (list_is_last(&iter_entry->list,
> - &session->stat_list)) {
> list_add(&new_entry->list, &iter_entry->list);
> break;
> }
> }
> +
> + /* The current larger value */
> + if (list_empty(&new_entry->list))
> + list_add(&new_entry->list, &session->stat_list);
> }
> exit:
> mutex_unlock(&session->stat_mutex);
>
>
Nice!
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
next prev parent reply other threads:[~2009-03-25 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 8:58 [PATCH 1/2] trace_stat: keep original order Lai Jiangshan
2009-03-25 13:30 ` Frederic Weisbecker [this message]
2009-03-25 14:36 ` Steven Rostedt
2009-03-26 2:19 ` Lai Jiangshan
2009-03-25 17:33 ` [tip:tracing/ftrace] " Lai Jiangshan
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=20090325133028.GE5976@nowhere \
--to=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=srostedt@redhat.com \
/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