public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Cc: Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 1/8] ftrace: move sched_switch enable after markers
Date: Thu, 10 Jul 2008 20:58:09 -0400	[thread overview]
Message-ID: <20080711005950.252598349@goodmis.org> (raw)
In-Reply-To: 20080711005808.316194101@goodmis.org

[-- Attachment #1: ftrace-sched-enable-marker-last.patch --]
[-- Type: text/plain, Size: 2173 bytes --]

We have two markers now that are enabled on sched_switch. One that records
the context switching and the other that records task wake ups. Currently
we enable the tracing first and then set the markers. This causes some
confusing traces:

# tracer: sched_switch
#
#           TASK-PID   CPU#    TIMESTAMP  FUNCTION
#              | |      |          |         |
       trace-cmd-3973  [00]   115.834817:   3973:120:R   +     3:  0:S
       trace-cmd-3973  [01]   115.834910:   3973:120:R   +     6:  0:S
       trace-cmd-3973  [02]   115.834910:   3973:120:R   +     9:  0:S
       trace-cmd-3973  [03]   115.834910:   3973:120:R   +    12:  0:S
       trace-cmd-3973  [02]   115.834910:   3973:120:R   +     9:  0:S
          <idle>-0     [02]   115.834910:      0:140:R ==>  3973:120:R


Here we see that trace-cmd with PID 3973 wakes up task 9 but the next line
shows the idle task doing a context switch to task 3973.

Enabling the tracing to _after_ the markers are set creates a much saner
output:

# tracer: sched_switch
#
#           TASK-PID   CPU#    TIMESTAMP  FUNCTION
#              | |      |          |         |
          <idle>-0     [02]  7922.634225:      0:140:R ==>  4790:120:R
       trace-cmd-4789  [03]  7922.634225:      0:140:R   +  4790:120:R


Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/trace/trace_sched_switch.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-tip.git/kernel/trace/trace_sched_switch.c
===================================================================
--- linux-tip.git.orig/kernel/trace/trace_sched_switch.c	2008-06-30 20:56:38.000000000 -0400
+++ linux-tip.git/kernel/trace/trace_sched_switch.c	2008-06-30 20:57:09.000000000 -0400
@@ -227,14 +227,14 @@ void tracing_stop_cmdline_record(void)
 static void start_sched_trace(struct trace_array *tr)
 {
 	sched_switch_reset(tr);
-	tracer_enabled = 1;
 	tracing_start_cmdline_record();
+	tracer_enabled = 1;
 }
 
 static void stop_sched_trace(struct trace_array *tr)
 {
-	tracing_stop_cmdline_record();
 	tracer_enabled = 0;
+	tracing_stop_cmdline_record();
 }
 
 static void sched_switch_trace_init(struct trace_array *tr)

-- 

  reply	other threads:[~2008-07-11  1:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  0:58 [PATCH 0/8] ftrace: updates Steven Rostedt
2008-07-11  0:58 ` Steven Rostedt [this message]
2008-07-11  0:58 ` [PATCH 2/8] ftrace: define function trace nop Steven Rostedt
2008-07-11  0:58 ` [PATCH 3/8] ftrace: trace schedule Steven Rostedt
2008-07-11  0:58 ` [PATCH 4/8] ftrace: check proper config for preempt type Steven Rostedt
2008-07-11  0:58 ` [PATCH 5/8] ftrace: start wakeup tracing after setting function tracer Steven Rostedt
2008-07-11  0:58 ` [PATCH 6/8] ftrace: use current CPU for function startup Steven Rostedt
2008-07-11  0:58 ` [PATCH 7/8] ftrace: add ftrace_kill_atomic Steven Rostedt
2008-07-11  0:58 ` [PATCH 8/8] ftrace: separate out the function enabled variable Steven Rostedt
2008-07-11 13:50 ` [PATCH 0/8] ftrace: updates Ingo Molnar
2008-07-11 14:47   ` Ingo Molnar
2008-07-11 14:51     ` 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=20080711005950.252598349@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    /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