mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement
@ 2011-01-13 14:11 Arnaldo Carvalho de Melo
  2011-01-13 14:11 ` [PATCH 1/2] perf sched: Fix list of events, dropping unsupported ':r' modifier Arnaldo Carvalho de Melo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-13 14:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Kirill Smelkov, Paul Mackerras,
	Peter Zijlstra, Robert Richter, Stephane Eranian, Tom Zanussi

Hi Ingo,

        Please consider pulling from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent

	The 'nodelay' mode for perf record is disabled by default and allows
potentially many 'perf script' usecases that need to receive events as they
happen, with no latency.

Regards,

- Arnaldo

Kirill Smelkov (1):
  perf record: Add "nodelay" mode, disabled by default

Stephane Eranian (1):
  perf sched: Fix list of events, dropping unsupported ':r' modifier

 tools/perf/Documentation/perf-record.txt |    3 +++
 tools/perf/builtin-record.c              |    8 ++++++++
 tools/perf/builtin-sched.c               |   18 +++++++++---------
 3 files changed, 20 insertions(+), 9 deletions(-)


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

* [PATCH 1/2] perf sched: Fix list of events, dropping unsupported ':r' modifier
  2011-01-13 14:11 [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Arnaldo Carvalho de Melo
@ 2011-01-13 14:11 ` Arnaldo Carvalho de Melo
  2011-01-13 14:11 ` [PATCH 2/2] perf record: Add "nodelay" mode, disabled by default Arnaldo Carvalho de Melo
  2011-01-13 17:06 ` [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-13 14:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Stephane Eranian, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Peter Zijlstra, Robert Richter,
	Arnaldo Carvalho de Melo

From: Stephane Eranian <eranian@google.com>

Looks to me like the :r modifier is not supported anymore, so remove it from
the list of events.

Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
LKML-Reference: <AANLkTim=jawJyBj0iFd0r4-LCKzvjFW+NddzJMD5GUB9@mail.gmail.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index abd4b84..29e7ffd 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1843,15 +1843,15 @@ static const char *record_args[] = {
 	"-f",
 	"-m", "1024",
 	"-c", "1",
-	"-e", "sched:sched_switch:r",
-	"-e", "sched:sched_stat_wait:r",
-	"-e", "sched:sched_stat_sleep:r",
-	"-e", "sched:sched_stat_iowait:r",
-	"-e", "sched:sched_stat_runtime:r",
-	"-e", "sched:sched_process_exit:r",
-	"-e", "sched:sched_process_fork:r",
-	"-e", "sched:sched_wakeup:r",
-	"-e", "sched:sched_migrate_task:r",
+	"-e", "sched:sched_switch",
+	"-e", "sched:sched_stat_wait",
+	"-e", "sched:sched_stat_sleep",
+	"-e", "sched:sched_stat_iowait",
+	"-e", "sched:sched_stat_runtime",
+	"-e", "sched:sched_process_exit",
+	"-e", "sched:sched_process_fork",
+	"-e", "sched:sched_wakeup",
+	"-e", "sched:sched_migrate_task",
 };
 
 static int __cmd_record(int argc, const char **argv)
-- 
1.6.2.5


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

* [PATCH 2/2] perf record: Add "nodelay" mode, disabled by default
  2011-01-13 14:11 [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Arnaldo Carvalho de Melo
  2011-01-13 14:11 ` [PATCH 1/2] perf sched: Fix list of events, dropping unsupported ':r' modifier Arnaldo Carvalho de Melo
@ 2011-01-13 14:11 ` Arnaldo Carvalho de Melo
  2011-01-13 17:06 ` [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-13 14:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kirill Smelkov, Arnaldo Carvalho de Melo,
	Frederic Weisbecker, Ingo Molnar, Mike Galbraith, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, Tom Zanussi

From: Kirill Smelkov <kirr@mns.spb.ru>

Sometimes there is a need to use perf in "live-log" mode. The problem
is, for seldom events, actual info output is largely delayed because
perf-record reads sample data in whole pages.

So for such scenarious, add flag for perf-record to go in "nodelay"
mode. To track e.g. what's going on in icmp_rcv while ping is running
Use it with something like this:

(1) $ perf probe -L icmp_rcv | grep -U8 '^ *43\>'
                                    goto error;
                    }
         38         if (!pskb_pull(skb, sizeof(*icmph)))
                            goto error;
                    icmph = icmp_hdr(skb);

         43         ICMPMSGIN_INC_STATS_BH(net, icmph->type);
                    /*
                     *      18 is the highest 'known' ICMP type. Anything else is a mystery
                     *
                     *      RFC 1122: 3.2.2  Unknown ICMP messages types MUST be silently
                     *                discarded.
                     */
         50         if (icmph->type > NR_ICMP_TYPES)
                            goto error;

    $ perf probe icmp_rcv:43 'type=icmph->type'

(2) $ cat trace-icmp.py
    [...]
    def trace_begin():
            print "in trace_begin"

    def trace_end():
            print "in trace_end"

    def probe__icmp_rcv(event_name, context, common_cpu,
            common_secs, common_nsecs, common_pid, common_comm,
            __probe_ip, type):
                    print_header(event_name, common_cpu, common_secs, common_nsecs,
                            common_pid, common_comm)

                    print "__probe_ip=%u, type=%u\n" % \
                    (__probe_ip, type),
    [...]

(3) $ perf record -a -D -e probe:icmp_rcv -o - | \
      perf script -i - -s trace-icmp.py

Thanks to Peter Zijlstra for pointing how to do it.

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <20110112140613.GA11698@tugrik.mns.mnsspb.ru>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt |    3 +++
 tools/perf/builtin-record.c              |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 52462ae..e032716 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -61,6 +61,9 @@ OPTIONS
 -r::
 --realtime=::
 	Collect data with this RT SCHED_FIFO priority.
+-D::
+--no-delay::
+	Collect data without buffering.
 -A::
 --append::
 	Append to the output file to do incremental profiling.
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 1210e64..df6064a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -49,6 +49,7 @@ static int			pipe_output			=      0;
 static const char		*output_name			= "perf.data";
 static int			group				=      0;
 static int			realtime_prio			=      0;
+static bool			nodelay				=  false;
 static bool			raw_samples			=  false;
 static bool			sample_id_all_avail		=   true;
 static bool			system_wide			=  false;
@@ -307,6 +308,11 @@ static void create_counter(struct perf_evsel *evsel, int cpu)
 		attr->sample_type	|= PERF_SAMPLE_CPU;
 	}
 
+	if (nodelay) {
+		attr->watermark = 0;
+		attr->wakeup_events = 1;
+	}
+
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->inherit		= !no_inherit;
@@ -843,6 +849,8 @@ const struct option record_options[] = {
 		    "record events on existing thread id"),
 	OPT_INTEGER('r', "realtime", &realtime_prio,
 		    "collect data with this RT SCHED_FIFO priority"),
+	OPT_BOOLEAN('D', "no-delay", &nodelay,
+		    "collect data without buffering"),
 	OPT_BOOLEAN('R', "raw-samples", &raw_samples,
 		    "collect raw sample records from all opened counters"),
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
-- 
1.6.2.5


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

* Re: [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement
  2011-01-13 14:11 [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Arnaldo Carvalho de Melo
  2011-01-13 14:11 ` [PATCH 1/2] perf sched: Fix list of events, dropping unsupported ':r' modifier Arnaldo Carvalho de Melo
  2011-01-13 14:11 ` [PATCH 2/2] perf record: Add "nodelay" mode, disabled by default Arnaldo Carvalho de Melo
@ 2011-01-13 17:06 ` Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2011-01-13 17:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Corey Ashford, Frederic Weisbecker, Kirill Smelkov,
	Paul Mackerras, Peter Zijlstra, Robert Richter, Stephane Eranian,
	Tom Zanussi


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
>         Please consider pulling from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
> 
> 	The 'nodelay' mode for perf record is disabled by default and allows
> potentially many 'perf script' usecases that need to receive events as they
> happen, with no latency.
> 
> Regards,
> 
> - Arnaldo
> 
> Kirill Smelkov (1):
>   perf record: Add "nodelay" mode, disabled by default
> 
> Stephane Eranian (1):
>   perf sched: Fix list of events, dropping unsupported ':r' modifier
> 
>  tools/perf/Documentation/perf-record.txt |    3 +++
>  tools/perf/builtin-record.c              |    8 ++++++++
>  tools/perf/builtin-sched.c               |   18 +++++++++---------
>  3 files changed, 20 insertions(+), 9 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

end of thread, other threads:[~2011-01-13 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-13 14:11 [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Arnaldo Carvalho de Melo
2011-01-13 14:11 ` [PATCH 1/2] perf sched: Fix list of events, dropping unsupported ':r' modifier Arnaldo Carvalho de Melo
2011-01-13 14:11 ` [PATCH 2/2] perf record: Add "nodelay" mode, disabled by default Arnaldo Carvalho de Melo
2011-01-13 17:06 ` [GIT PULL 0/2] perf/urgent fixes and an disabled by default improvement Ingo Molnar

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

all inboxes | Powered by JetHome®