public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] trace_stat: keep original order
@ 2009-03-25  8:58 Lai Jiangshan
  2009-03-25 13:30 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-03-25  8:58 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, LKML


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);



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] trace_stat: keep original order
  2009-03-25  8:58 [PATCH 1/2] trace_stat: keep original order Lai Jiangshan
@ 2009-03-25 13:30 ` Frederic Weisbecker
  2009-03-25 14:36 ` Steven Rostedt
  2009-03-25 17:33 ` [tip:tracing/ftrace] " Lai Jiangshan
  2 siblings, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2009-03-25 13:30 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Ingo Molnar, Steven Rostedt, LKML

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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] trace_stat: keep original order
  2009-03-25  8:58 [PATCH 1/2] trace_stat: keep original order Lai Jiangshan
  2009-03-25 13:30 ` Frederic Weisbecker
@ 2009-03-25 14:36 ` Steven Rostedt
  2009-03-26  2:19   ` Lai Jiangshan
  2009-03-25 17:33 ` [tip:tracing/ftrace] " Lai Jiangshan
  2 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2009-03-25 14:36 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: Ingo Molnar, Frederic Weisbecker, LKML


On Wed, 2009-03-25 at 16:58 +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.
> 

This doesn't reverse the order of the annotated branch profiler, does
it?

-- Steve

> 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);
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:tracing/ftrace] trace_stat: keep original order
  2009-03-25  8:58 [PATCH 1/2] trace_stat: keep original order Lai Jiangshan
  2009-03-25 13:30 ` Frederic Weisbecker
  2009-03-25 14:36 ` Steven Rostedt
@ 2009-03-25 17:33 ` Lai Jiangshan
  2 siblings, 0 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-03-25 17:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, srostedt, tglx, laijs, mingo

Commit-ID:  220ba351dfa57eca4bec5ce0098a276446a47958
Gitweb:     http://git.kernel.org/tip/220ba351dfa57eca4bec5ce0098a276446a47958
Author:     Lai Jiangshan <laijs@cn.fujitsu.com>
AuthorDate: Wed, 25 Mar 2009 16:58:39 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 25 Mar 2009 18:32:34 +0100

trace_stat: keep original order

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>
Acked-by: Steven Rostedt <srostedt@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49C9F23F.5040307@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_stat.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index 8c129dd..acdebd7 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);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] trace_stat: keep original order
  2009-03-25 14:36 ` Steven Rostedt
@ 2009-03-26  2:19   ` Lai Jiangshan
  0 siblings, 0 replies; 5+ messages in thread
From: Lai Jiangshan @ 2009-03-26  2:19 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Ingo Molnar, Frederic Weisbecker, LKML

Steven Rostedt wrote:
> On Wed, 2009-03-25 at 16:58 +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.
>>
> 
> This doesn't reverse the order of the annotated branch profiler, does
> it?
> 

The annotated ftrace_branch_data are orderless. So it's OK
with or without this fix.

(From code, not test) If this fix applied,
__start_annotated_branch_profile is shown at the first, and then
__start_annotated_branch_profile + 1... and
__stop_annotated_branch_profile is shown at the last.

Lai


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-26  2:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25  8:58 [PATCH 1/2] trace_stat: keep original order Lai Jiangshan
2009-03-25 13:30 ` Frederic Weisbecker
2009-03-25 14:36 ` Steven Rostedt
2009-03-26  2:19   ` Lai Jiangshan
2009-03-25 17:33 ` [tip:tracing/ftrace] " Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox