• Frederic Weisbecker's avatar
    tracing/branch-tracer: adapt to the stat tracing API · e302cf3f
    Frederic Weisbecker authored
    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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    e302cf3f
trace_branch.c 8.88 KB