1. 08 10月, 2009 1 次提交
  2. 14 4月, 2009 3 次提交
    • Z
      tracing: Fix branch tracer header · 557055be
      Zhaolei 提交于
      Before patch:
      
        # tracer: branch
        #
        #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
        #              | |       |          |         |
                   <...>-2981  [000] 24008.872738: [  ok  ] trace_irq_handler_exit:irq_event_types.h:41
                   <...>-2981  [000] 24008.872742: [  ok  ] note_interrupt:spurious.c:229
        ...
      
      After patch:
      
        # tracer: branch
        #
        #           TASK-PID    CPU#    TIMESTAMP  CORRECT  FUNC:FILE:LINE
        #              | |       |          |         |       |
                   <...>-2985  [000] 26329.142970: [  ok  ] slab_free:slub.c:1776
                   <...>-2985  [000] 26329.142972: [  ok  ] trace_kmem_cache_free:kmem_event_types.h:191
        ...
      Signed-off-by: NZhao Lei <zhaolei@cn.fujitsu.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <49E2F19A.3040006@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      557055be
    • T
      tracing/filters: use ring_buffer_discard_commit() in filter_check_discard() · eb02ce01
      Tom Zanussi 提交于
      This patch changes filter_check_discard() to make use of the new
      ring_buffer_discard_commit() function and modifies the current users to
      call the old commit function in the non-discard case.
      
      It also introduces a version of filter_check_discard() that uses the
      global trace buffer (filter_current_check_discard()) for those cases.
      
      v2 changes:
      
      - fix compile error noticed by Ingo Molnar
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: fweisbec@gmail.com
      LKML-Reference: <1239178554.10295.36.camel@tropicana>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      eb02ce01
    • T
      tracing/filters: add run-time field descriptions to TRACE_EVENT_FORMAT events · e1112b4d
      Tom Zanussi 提交于
      This patch adds run-time field descriptions to all the event formats
      exported using TRACE_EVENT_FORMAT.  It also hooks up all the tracers
      that use them (i.e. the tracers in the 'ftrace subsystem') so they can
      also have their output filtered by the event-filtering mechanism.
      
      When I was testing this, there were a couple of things that fooled me
      into thinking the filters weren't working, when actually they were -
      I'll mention them here so others don't make the same mistakes (and file
      bug reports. ;-)
      
      One is that some of the tracers trace multiple events e.g. the
      sched_switch tracer uses the context_switch and wakeup events, and if
      you don't set filters on all of the traced events, the unfiltered output
      from the events without filters on them can make it look like the
      filtering as a whole isn't working properly, when actually it is doing
      what it was asked to do - it just wasn't asked to do the right thing.
      
      The other is that for the really high-volume tracers e.g. the function
      tracer, the volume of filtered events can be so high that it pushes the
      unfiltered events out of the ring buffer before they can be read so e.g.
      cat'ing the trace file repeatedly shows either no output, or once in
      awhile some output but that isn't there the next time you read the
      trace, which isn't what you normally expect when reading the trace file.
      If you read from the trace_pipe file though, you can catch them before
      they disappear.
      
      Changes from v1:
      
      As suggested by Frederic Weisbecker:
      
      - get rid of externs in functions
      - added unlikely() to filter_check_discard()
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e1112b4d
  3. 25 3月, 2009 1 次提交
  4. 11 3月, 2009 1 次提交
  5. 05 3月, 2009 1 次提交
  6. 11 2月, 2009 1 次提交
  7. 06 2月, 2009 3 次提交
    • A
      trace: Call tracing_reset_online_cpus before tracer->init() · b6f11df2
      Arnaldo Carvalho de Melo 提交于
      Impact: cleanup
      
      To make it easy for ftrace plugin writers, as this was open coded in
      the existing plugins
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b6f11df2
    • A
      tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} · 51a763dd
      Arnaldo Carvalho de Melo 提交于
      Impact: new API
      
      These new functions do what previously was being open coded, reducing
      the number of details ftrace plugin writers have to worry about.
      
      It also standardizes the handling of stacktrace, userstacktrace and
      other trace options we may introduce in the future.
      
      With this patch, for instance, the blk tracer (and some others already
      in the tree) can use the "userstacktrace" /d/tracing/trace_options
      facility.
      
      $ codiff /tmp/vmlinux.before /tmp/vmlinux.after
      linux-2.6-tip/kernel/trace/trace.c:
        trace_vprintk              |   -5
        trace_graph_return         |  -22
        trace_graph_entry          |  -26
        trace_function             |  -45
        __ftrace_trace_stack       |  -27
        ftrace_trace_userstack     |  -29
        tracing_sched_switch_trace |  -66
        tracing_stop               |   +1
        trace_seq_to_user          |   -1
        ftrace_trace_special       |  -63
        ftrace_special             |   +1
        tracing_sched_wakeup_trace |  -70
        tracing_reset_online_cpus  |   -1
       13 functions changed, 2 bytes added, 355 bytes removed, diff: -353
      
      linux-2.6-tip/block/blktrace.c:
        __blk_add_trace |  -58
       1 function changed, 58 bytes removed, diff: -58
      
      linux-2.6-tip/kernel/trace/trace.c:
        trace_buffer_lock_reserve  |  +88
        trace_buffer_unlock_commit |  +86
       2 functions changed, 174 bytes added, diff: +174
      
      /tmp/vmlinux.after:
       16 functions changed, 176 bytes added, 413 bytes removed, diff: -237
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      51a763dd
    • A
      ring_buffer: remove unused flags parameter · 0a987751
      Arnaldo Carvalho de Melo 提交于
      Impact: API change, cleanup
      
      >From ring_buffer_{lock_reserve,unlock_commit}.
      
      $ codiff /tmp/vmlinux.before /tmp/vmlinux.after
      linux-2.6-tip/kernel/trace/trace.c:
        trace_vprintk              |  -14
        trace_graph_return         |  -14
        trace_graph_entry          |  -10
        trace_function             |   -8
        __ftrace_trace_stack       |   -8
        ftrace_trace_userstack     |   -8
        tracing_sched_switch_trace |   -8
        ftrace_trace_special       |  -12
        tracing_sched_wakeup_trace |   -8
       9 functions changed, 90 bytes removed, diff: -90
      
      linux-2.6-tip/block/blktrace.c:
        __blk_add_trace |   -1
       1 function changed, 1 bytes removed, diff: -1
      
      /tmp/vmlinux.after:
       10 functions changed, 91 bytes removed, diff: -91
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0a987751
  8. 05 2月, 2009 4 次提交
  9. 03 2月, 2009 1 次提交
  10. 29 1月, 2009 1 次提交
  11. 14 1月, 2009 1 次提交
  12. 11 1月, 2009 1 次提交
    • F
      tracing/ftrace: handle more than one stat file per tracer · 034939b6
      Frederic Weisbecker 提交于
      Impact: new API for tracers
      
      Make the stat tracing API reentrant. And also provide the new directory
      /debugfs/tracing/trace_stat which will contain all the stat files for the
      current active tracer.
      
      Now a tracer will, if desired, want to provide a zero terminated array of
      tracer_stat structures.
      Each one contains the callbacks necessary for one stat file.
      It have to provide at least a name for its stat file, an iterator with
      stat_start/start_next callback and an output callback for one stat entry.
      
      Also adapt the branch tracer to this new API.
      We create two files "all" and "annotated" inside the /debugfs/tracing/trace_stat
      directory, making the both stats simultaneously available instead of needing
      to change an option to switch from one stat file to another.
      
      The output of these stats haven't changed.
      
      Changes in v2:
      
      _ Apply the previous memory leak fix (rebase against tip/master)
      
      Changes in v3:
      
      _ Merge the patch that adapted the branch tracer to this Api in this patch to
        not break the kernel build.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      034939b6
  13. 29 12月, 2008 2 次提交
    • F
      tracing/branch-tracer: adapt to the stat tracing API · e302cf3f
      Frederic Weisbecker 提交于
      Impact: refactor the branch tracer
      
      This patch adapts the branch tracer to the tracing API.
      
      This is a proof of concept because the branch tracer implements two
      "stat tracing" that were split in two files.
      
      So I added an option to the branch tracer: stat_all_branch.
      If it is set, then trace_stat will output all of the branches
      entries stats. Otherwise, it will print the annotated branches.
      
      Its is a kind of quick trick, waiting for a better solution.
      
      By default, the annotated branches stat are sorted by incorrect branch
      prediction percentage.
      
      Ie:
      
       correct incorrect  %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
             0        1 100 native_smp_prepare_cpus        smpboot.c            1228
             0        1 100 hpet_rtc_timer_reinit          hpet.c               1057
             0    18032 100 sched_info_queued              sched_stats.h        223
             0      684 100 yield_task_fair                sched_fair.c         984
             0      282 100 pre_schedule_rt                sched_rt.c           1263
             0    13414 100 sched_info_dequeued            sched_stats.h        178
             0    21724 100 sched_info_switch              sched_stats.h        270
             0        1 100 get_signal_to_deliver          signal.c             1820
             0        8 100 __cancel_work_timer            workqueue.c          560
             0      212 100 verify_export_symbols          module.c             1509
             0       17 100 __rmqueue_fallback             page_alloc.c         793
             0       43 100 clear_page_mlock               internal.h           129
             0      124 100 try_to_unmap_anon              rmap.c               1021
             0       53 100 try_to_unmap_anon              rmap.c               1013
             0        6 100 vma_address                    rmap.c               232
             0     3301 100 try_to_unmap_file              rmap.c               1082
             0      466 100 try_to_unmap_file              rmap.c               1077
             0        1 100 mem_cgroup_create              memcontrol.c         1090
             0        3 100 inotify_find_update_watch      inotify.c            726
             2    30163  99 perf_counter_task_sched_out    perf_counter.c       385
             1     2935  99 percpu_free                    allocpercpu.c        138
          1544   297672  99 dentry_lru_del_init            dcache.c             153
             8     1074  99 input_pass_event               input.c              86
          1390    76781  98 mapping_unevictable            pagemap.h            50
           280     6665  95 pick_next_task_rt              sched_rt.c           889
           750     4826  86 next_pidmap                    pid.c                194
             2        8  80 blocking_notifier_chain_regist notifier.c           220
            36      130  78 ioremap_pte_range              ioremap.c            22
          1093     3247  74 IS_ERR                         err.h                34
          1023     2908  73 sched_slice                    sched_fair.c         445
            22       60  73 disk_put_part                  genhd.h              206
      [...]
      
      It enables a developer to quickly address the source of incorrect branch
      predictions.  Note that this sorting would be better with a second sort on
      the number of incorrect predictions.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e302cf3f
    • S
      ftrace: change trace.c to use registered events · f633cef0
      Steven Rostedt 提交于
      Impact: rework trace.c to use new event register API
      
      Almost every ftrace event has to implement its output display in
      trace.c through a different function. Some events did not handle
      all the formats (trace, latency-trace, raw, hex, binary), and
      this method does not scale well.
      
      This patch converts the format functions to use the event API to
      find the event and and print its format. Currently, we have
      a print function for trace, latency_trace, raw, hex and binary.
      A trace_nop_print is available if the event wants to avoid output
      on a particular format.
      
      Perhaps other tracers could use this in the future (like mmiotrace and
      function_graph).
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f633cef0
  14. 03 12月, 2008 1 次提交
  15. 29 11月, 2008 1 次提交
  16. 23 11月, 2008 4 次提交
    • S
      trace: fix compiler warning in branch profiler · 0429149f
      Steven Rostedt 提交于
      Impact: fix compiler warning
      
      The ftrace_pointers used in the branch profiler are constant values.
      They should never change. But the compiler complains when they are
      passed into the debugfs_create_file as a data pointer, because the
      function discards the qualifier.
      
      This patch typecasts the parameter to debugfs_create_file back to
      a void pointer. To remind the callbacks that they are pointing to
      a constant value, I also modified the callback local pointers to
      be const struct ftrace_pointer * as well.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0429149f
    • S
      trace: profile all if conditionals · 2bcd521a
      Steven Rostedt 提交于
      Impact: feature to profile if statements
      
      This patch adds a branch profiler for all if () statements.
      The results will be found in:
      
        /debugfs/tracing/profile_branch
      
      For example:
      
         miss      hit    %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
             0        1 100 x86_64_start_reservations      head64.c             127
             0        1 100 copy_bootdata                  head64.c             69
             1        0   0 x86_64_start_kernel            head64.c             111
            32        0   0 set_intr_gate                  desc.h               319
             1        0   0 reserve_ebda_region            head.c               51
             1        0   0 reserve_ebda_region            head.c               47
             0        1 100 reserve_ebda_region            head.c               42
             0        0   X maxcpus                        main.c               165
      
      Miss means the branch was not taken. Hit means the branch was taken.
      The percent is the percentage the branch was taken.
      
      This adds a significant amount of overhead and should only be used
      by those analyzing their system.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2bcd521a
    • S
      trace: branch profiling should not print percent without data · bac28bfe
      Steven Rostedt 提交于
      Impact: cleanup on output of branch profiler
      
      When a branch has not been taken, it does not make sense to show
      a percentage incorrect or hit. This patch changes the behaviour
      to print out a 'X' when the branch has not been executed yet.
      
      For example:
      
       correct incorrect  %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
          2096        0   0 do_arch_prctl                  process_64.c         832
             0        0   X do_arch_prctl                  process_64.c         804
          2604        0   0 IS_ERR                         err.h                34
        130228     5765   4 __switch_to                    process_64.c         673
             0        0   X enable_TSC                     process_64.c         448
             0        0   X disable_TSC                    process_64.c         431
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bac28bfe
    • S
      trace: consolidate unlikely and likely profiler · 45b79749
      Steven Rostedt 提交于
      Impact: clean up to make one profiler of like and unlikely tracer
      
      The likely and unlikely profiler prints out the file and line numbers
      of the annotated branches that it is profiling. It shows the number
      of times it was correct or incorrect in its guess. Having two
      different files or sections for that matter to tell us if it was a
      likely or unlikely is pretty pointless. We really only care if
      it was correct or not.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      45b79749
  17. 16 11月, 2008 2 次提交
  18. 13 11月, 2008 4 次提交
  19. 12 11月, 2008 2 次提交
    • S
      tracing: likely/unlikely branch annotation tracer · 52f232cb
      Steven Rostedt 提交于
      Impact: new likely/unlikely branch tracer
      
      This patch adds a way to record the instances of the likely() and unlikely()
      branch condition annotations.
      
      When "unlikely" is set in /debugfs/tracing/iter_ctrl the unlikely conditions
      will be added to any of the ftrace tracers. The change takes effect when
      a new tracer is passed into the current_tracer file.
      
      For example:
      
       bash-3471  [003]   357.014755: [INCORRECT] sched_info_dequeued:sched_stats.h:177
       bash-3471  [003]   357.014756: [correct] update_curr:sched_fair.c:489
       bash-3471  [003]   357.014758: [correct] calc_delta_fair:sched_fair.c:411
       bash-3471  [003]   357.014759: [correct] account_group_exec_runtime:sched_stats.h:356
       bash-3471  [003]   357.014761: [correct] update_curr:sched_fair.c:489
       bash-3471  [003]   357.014763: [INCORRECT] calc_delta_fair:sched_fair.c:411
       bash-3471  [003]   357.014765: [correct] calc_delta_mine:sched.c:1279
      
      Which shows the normal tracer heading, as well as whether the condition was
      correct "[correct]" or was mistaken "[INCORRECT]", followed by the function,
      file name and line number.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      52f232cb
    • S
      tracing: profile likely and unlikely annotations · 1f0d69a9
      Steven Rostedt 提交于
      Impact: new unlikely/likely profiler
      
      Andrew Morton recently suggested having an in-kernel way to profile
      likely and unlikely macros. This patch achieves that goal.
      
      When configured, every(*) likely and unlikely macro gets a counter attached
      to it. When the condition is hit, the hit and misses of that condition
      are recorded. These numbers can later be retrieved by:
      
        /debugfs/tracing/profile_likely    - All likely markers
        /debugfs/tracing/profile_unlikely  - All unlikely markers.
      
      # cat /debug/tracing/profile_unlikely | head
       correct incorrect  %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
          2167        0   0 do_arch_prctl                  process_64.c         832
             0        0   0 do_arch_prctl                  process_64.c         804
          2670        0   0 IS_ERR                         err.h                34
         71230     5693   7 __switch_to                    process_64.c         673
         76919        0   0 __switch_to                    process_64.c         639
         43184    33743  43 __switch_to                    process_64.c         624
         12740    64181  83 __switch_to                    process_64.c         594
         12740    64174  83 __switch_to                    process_64.c         590
      
      # cat /debug/tracing/profile_unlikely | \
        awk '{ if ($3 > 25) print $0; }' |head -20
         44963    35259  43 __switch_to                    process_64.c         624
         12762    67454  84 __switch_to                    process_64.c         594
         12762    67447  84 __switch_to                    process_64.c         590
          1478      595  28 syscall_get_error              syscall.h            51
             0     2821 100 syscall_trace_leave            ptrace.c             1567
             0        1 100 native_smp_prepare_cpus        smpboot.c            1237
         86338   265881  75 calc_delta_fair                sched_fair.c         408
        210410   108540  34 calc_delta_mine                sched.c              1267
             0    54550 100 sched_info_queued              sched_stats.h        222
         51899    66435  56 pick_next_task_fair            sched_fair.c         1422
             6       10  62 yield_task_fair                sched_fair.c         982
          7325     2692  26 rt_policy                      sched.c              144
             0     1270 100 pre_schedule_rt                sched_rt.c           1261
          1268    48073  97 pick_next_task_rt              sched_rt.c           884
             0    45181 100 sched_info_dequeued            sched_stats.h        177
             0       15 100 sched_move_task                sched.c              8700
             0       15 100 sched_move_task                sched.c              8690
         53167    33217  38 schedule                       sched.c              4457
             0    80208 100 sched_info_switch              sched_stats.h        270
         30585    49631  61 context_switch                 sched.c              2619
      
      # cat /debug/tracing/profile_likely | awk '{ if ($3 > 25) print $0; }'
         39900    36577  47 pick_next_task                 sched.c              4397
         20824    15233  42 switch_mm                      mmu_context_64.h     18
             0        7 100 __cancel_work_timer            workqueue.c          560
           617    66484  99 clocksource_adjust             timekeeping.c        456
             0   346340 100 audit_syscall_exit             auditsc.c            1570
            38   347350  99 audit_get_context              auditsc.c            732
             0   345244 100 audit_syscall_entry            auditsc.c            1541
            38     1017  96 audit_free                     auditsc.c            1446
             0     1090 100 audit_alloc                    auditsc.c            862
          2618     1090  29 audit_alloc                    auditsc.c            858
             0        6 100 move_masked_irq                migration.c          9
             1      198  99 probe_sched_wakeup             trace_sched_switch.c 58
             2        2  50 probe_wakeup                   trace_sched_wakeup.c 227
             0        2 100 probe_wakeup_sched_switch      trace_sched_wakeup.c 144
          4514     2090  31 __grab_cache_page              filemap.c            2149
         12882   228786  94 mapping_unevictable            pagemap.h            50
             4       11  73 __flush_cpu_slab               slub.c               1466
        627757   330451  34 slab_free                      slub.c               1731
          2959    61245  95 dentry_lru_del_init            dcache.c             153
           946     1217  56 load_elf_binary                binfmt_elf.c         904
           102       82  44 disk_put_part                  genhd.h              206
             1        1  50 dst_gc_task                    dst.c                82
             0       19 100 tcp_mss_split_point            tcp_output.c         1126
      
      As you can see by the above, there's a bit of work to do in rethinking
      the use of some unlikelys and likelys. Note: the unlikely case had 71 hits
      that were more than 25%.
      
      Note:  After submitting my first version of this patch, Andrew Morton
        showed me a version written by Daniel Walker, where I picked up
        the following ideas from:
      
        1)  Using __builtin_constant_p to avoid profiling fixed values.
        2)  Using __FILE__ instead of instruction pointers.
        3)  Using the preprocessor to stop all profiling of likely
             annotations from vsyscall_64.c.
      
      Thanks to Andrew Morton, Arjan van de Ven, Theodore Tso and Ingo Molnar
      for their feed back on this patch.
      
      (*) Not ever unlikely is recorded, those that are used by vsyscalls
       (a few of them) had to have profiling disabled.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1f0d69a9