1. 26 10月, 2012 2 次提交
    • A
      perf inject: Merge sched_stat_* and sched_switch events · 26a031e1
      Andrew Vagin 提交于
      You may want to know where and how long a task is sleeping. A callchain
      may be found in sched_switch and a time slice in stat_iowait, so I add
      handler in perf inject for merging this events.
      
      My code saves sched_switch event for each process and when it meets
      stat_iowait, it reports the sched_switch event, because this event
      contains a correct callchain. By another words it replaces all
      stat_iowait events on proper sched_switch events.
      
      I use the next sequence of commands for testing:
      
        perf record -e sched:sched_stat_sleep -e sched:sched_switch \
      	      -e sched:sched_process_exit -g -o ~/perf.data.raw \
      	      ~/test-program
        perf inject -v -s -i ~/perf.data.raw -o ~/perf.data
        perf report --stdio -i ~/perf.data
         100.00%	foo  [kernel.kallsyms]  [k] __schedule
                     	|
                      --- __schedule
                          schedule
                         |
                         |--79.75%-- schedule_hrtimeout_range_clock
                         |          schedule_hrtimeout_range
                         |          poll_schedule_timeout
                         |          do_select
                         |          core_sys_select
                         |          sys_select
                         |          system_call_fastpath
                         |          __select
                         |          __libc_start_main
                         |
                          --20.25%-- do_nanosleep
                                    hrtimer_nanosleep
                                    sys_nanosleep
                                    system_call_fastpath
                                    __GI___libc_nanosleep
                                    __libc_start_main
      
       And here is test-program.c:
      
       #include<unistd.h>
       #include<time.h>
       #include<sys/select.h>
      
       int main()
       {
      	struct timespec ts1;
      	struct timeval tv1;
      	int i;
      	long s;
      
      	for (i = 0; i <  10; i++) {
      		ts1.tv_sec = 0;
      		ts1.tv_nsec = 10000000;
      		nanosleep(&ts1, NULL);
      
      		tv1.tv_sec = 0;
      		tv1.tv_usec = 40000;
      		select(0, NULL, NULL, NULL,&tv1);
      	}
      	return 1;
       }
      Signed-off-by: NAndrew Vagin <avagin@openvz.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1344344165-369636-4-git-send-email-avagin@openvz.org
      [ committer note: Made it use evsel->handler ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      26a031e1
    • A
      perf inject: Work with files · e558a5bd
      Andrew Vagin 提交于
      Before this patch "perf inject" can only handle data from pipe.
      
      I want to use "perf inject" for reworking events. Look at my following patch.
      
      v2: add information about new options in tools/perf/Documentation/
      Signed-off-by: NAndrew Vagin <avagin@openvz.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1344344165-369636-2-git-send-email-avagin@openvz.org
      [ committer note: fixed it up to cope with 5852a445, 5ded57ac, 002439e8 & f62d3f0f ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e558a5bd
  2. 04 5月, 2010 1 次提交
    • A
      perf inject: Add missing bits · 11d232ec
      Arnaldo Carvalho de Melo 提交于
      New commands need to have Documentation and be added to command-list.txt
      so that they can appear when 'perf' is called withouth any subcommand:
      
      [root@doppio linux-2.6-tip]# perf
      
       usage: perf [--version] [--help] COMMAND [ARGS]
      
       The most commonly used perf commands are:
         annotate        Read perf.data (created by perf record) and display annotated code
         archive         Create archive with object files with build-ids found in perf.data file
         bench           General framework for benchmark suites
         buildid-cache   Manage build-id cache.
         buildid-list    List the buildids in a perf.data file
         diff            Read two perf.data files and display the differential profile
         inject          Filter to augment the events stream with additional information
         kmem            Tool to trace/measure kernel memory(slab) properties
         kvm             Tool to trace/measure kvm guest os
         list            List all symbolic event types
         lock            Analyze lock events
         probe           Define new dynamic tracepoints
         record          Run a command and record its profile into perf.data
         report          Read perf.data (created by perf record) and display the profile
         sched           Tool to trace/measure scheduler properties (latencies)
         stat            Run a command and gather performance counter statistics
         test            Runs sanity tests.
         timechart       Tool to visualize total system behavior during a workload
         top             System profiling tool.
         trace           Read perf.data (created by perf record) and display trace output
      
       See 'perf help COMMAND' for more information on a specific command.
      
      [root@doppio linux-2.6-tip]#
      
      The new 'perf inject' command hadn't so it wasn't appearing on that list.
      
      Also fix the long option, that should have no spaces in it, rename the faulty one
      to be '--build-ids', instead of '--inject build-ids'.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11d232ec