linux/kernel/trace/trace_branch.c
<<
/opt.6./spaue= .6./forme= .6.a /opt.6 href="../linux+v3.7.4/kernel/trace/trace_branch.c">/opt.6.img src="../.static/gfx/right.png" alt=">>">/o./spaue=/o.spau class="lxr_search">/opt/opt.6.input typ hidden" nam navtarget" > ">/opt.6.input typ text" nam search" id search">/opt.6.butt2" typ submit">Search/opt.6Prefs= .6./a>/o./spaue=pt.6 6./dive=pt.6 6.form acvalu="ajax+*" method="post" onsubmit="return false;">/o.input typ hidden" nam ajax_lookup" id ajax_lookup" > ">/pt.6 6./forme=/pt.6 6.div class="headingbott2m">= .div id file_contents"e
6 61./a>.spau class="comment">/*./spaue=6 62./a>.spau class="comment"> * unlikely profiler./spaue=6 63./a>.spau class="comment"> *./spaue=6 64./a>.spau class="comment"> * Copyright (C) 2008 Steven Rostedt <srostedt@redhat.com>./spaue=6 65./a>.spau class="comment"> */./spaue=6 66./a>#include <linux/kallsyms.h./a>>=6 67./a>#include <linux/seq_file.h./a>>=6 68./a>#include <linux/spinlock.h./a>>=6 69./a>#include <linux/irqflags.h./a>>=6 ptioa>#include <linux/debugfs.h./a>>=6 11ioa>#include <linux/uaccess.h./a>>=6 12ioa>#include <linux/module.h./a>>=6 13ioa>#include <linux/ftrace.h./a>>=6 14ioa>#include <linux/hash.h./a>>=6 15ioa>#include <linux/fs.h./a>>=6 16./a>#include <asm/local.h./a>>=6 17./a>=6 18./a>#include "trace.h./a>"=6 19./a>#include "trace_stat.h./a>"=6 20./a>#include "trace_output.h./a>"=6 21./a>=6 22ioa>#ifdef6.a href="+code=CONFIG_BRANCH_TRACER" class="sref">CONFIG_BRANCH_TRACER./a>=6 23./a>=6 24ioa>static struct6.a href="+code=tracer" class="sref">tracerioa>6.a href="+code=branch_trace" class="sref">branch_traceioa>;=6 25ioa>static int6.a href="+code=branch_tracing_enabled" class="sref">branch_tracing_enabledioa>6.a href="+code=__read_mostly" class="sref">__read_mostlyioa>;=6 26ioa>static .a href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEXioa>(.a href="+code=branch_tracing_mutex" class="sref">branch_tracing_mutexioa>);=6 27./a>=6 28ioa>static struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=branch_tracer" class="sref">branch_tracerioa>;=6 29./a>=6 30ioa>static void=6 31./a>.a href="+code=probe_likely_condivalu" class="sref">probe_likely_condivaluioa>(struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=f" class="sref">fioa>, int6.a href="+code=val" class="sref">valioa>, int6.a href="+code=expect" class="sref">expectioa>)=6 32ioa>{=6 33./a>        struct6.a href="+code=ftrace_event_call" class="sref">ftrace_event_callioa>6*.a href="+code=call" class="sref">callioa>6= &.a href="+code=event_branch" class="sref">event_branchioa>;=6 34./a>        struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>6= .a href="+code=branch_tracer" class="sref">branch_tracerioa>;=6 35./a>        struct6.a href="+code=ring_buffer_event" class="sref">ring_buffer_eventioa>6*.a href="+code=event" class="sref">eventioa>;=6 36./a>        struct6.a href="+code=trace_branch" class="sref">trace_branchioa>6*.a href="+code=entry" class="sref">entryioa>;=6 37./a>        struct6.a href="+code=ring_buffer" class="sref">ring_bufferioa>6*.a href="+code=buffer" class="sref">bufferioa>;=6 38./a>        unsigned long6.a href="+code=flags" class="sref">flagsioa>;=6 39./a>        int6.a href="+code=cpu" class="sref">cpuioa>, .a href="+code=pc" class="sref">pcioa>;=6 40./a>        const char6*.a href="+code=p" class="sref">pioa>;=6 41./a>=6 42./a>        .spau class="comment">/*./spaue=6 43./a>.spau class="comment">         * I would love to save just the ftrace_likely_data pointer, but./spaue=6 44./a>.spau class="comment">         * this code cau also be used by modules. Ugly things cau happen./spaue=6 45./a>.spau class="comment">         * if the module is unloaded, and then we go and read the./spaue=6 46./a>.spau class="comment">         * pointer.  This is slower, but much safer../spaue=6 47./a>.spau class="comment">         */./spaue=6 48./a>=6 49./a>        if (.a href="+code=unlikely" class="sref">unlikelyioa>(!.a href="+code=tr" class="sref">trioa>))=6 50./a>                return;=6 51./a>=6 52./a>        .a href="+code=local_irq_save" class="sref">local_irq_saveioa>(.a href="+code=flags" class="sref">flagsioa>);=6 53./a>        .a href="+code=cpu" class="sref">cpuioa>6= .a href="+code=raw_smp_processor_id" class="sref">raw_smp_processor_idioa>();=6 54./a>        if (.a href="+code=atomic_inc_return" class="sref">atomic_inc_returnioa>(&.a href="+code=tr" class="sref">trioa>->.a href="+code=data" class="sref">dataioa>[.a href="+code=cpu" class="sref">cpuioa>]->.a href="+code=disabled" class="sref">disabledioa>) != 1)=6 55./a>                goto .a href="+code=out" class="sref">outioa>;=6 56./a>=6 57./a>        .a href="+code=pc" class="sref">pcioa>6= .a href="+code=preempt_count" class="sref">preempt_countioa>();=6 58./a>        .a href="+code=buffer" class="sref">bufferioa>6= .a href="+code=tr" class="sref">trioa>->.a href="+code=buffer" class="sref">bufferioa>;=6 59./a>        .a href="+code=event" class="sref">eventioa>6= .a href="+code=trace_buffer_lock_reserve" class="sref">trace_buffer_lock_reserveioa>(.a href="+code=buffer" class="sref">bufferioa>, .a href="+code=TRACE_BRANCH" class="sref">TRACE_BRANCHioa>,=6 60./a>                                          sizeof(*.a href="+code=entry" class="sref">entryioa>), .a href="+code=flags" class="sref">flagsioa>, .a href="+code=pc" class="sref">pcioa>);=6 61./a>        if (!.a href="+code=event" class="sref">eventioa>)=6 62./a>                goto .a href="+code=out" class="sref">outioa>;=6 63./a>=6 64./a>        .a href="+code=entry" class="sref">entryioa>   = .a href="+code=ring_buffer_event_data" class="sref">ring_buffer_event_dataioa>(.a href="+code=event" class="sref">eventioa>);=6 65./a>=6 66./a>        .spau class="comment">/* Strip off the path, only save the file */./spaue=6 67./a>        .a href="+code=p" class="sref">pioa> = .a href="+code=f" class="sref">fioa>->.a href="+code=file" class="sref">fileioa> + .a href="+code=strlen" class="sref">strlenioa>(.a href="+code=f" class="sref">fioa>->.a href="+code=file" class="sref">fileioa>);=6 68./a>        while (.a href="+code=p" class="sref">pioa> >= .a href="+code=f" class="sref">fioa>->.a href="+code=file" class="sref">fileioa> &&6*.a href="+code=p" class="sref">pioa> != .spau class="string">'/'./spaue)=6 69./a>                .a href="+code=p" class="sref">pioa>--;=6 70./a>        .a href="+code=p" class="sref">pioa>++;=6 71./a>=6 72./a>        .a href="+code=strncpy" class="sref">strncpyioa>(.a href="+code=entry" class="sref">entryioa>->.a href="+code=func" class="sref">funcioa>, .a href="+code=f" class="sref">fioa>->.a href="+code=func" class="sref">funcioa>, .a href="+code=TRACE_FUNC_SIZE" class="sref">TRACE_FUNC_SIZEioa>);=6 73./a>        .a href="+code=strncpy" class="sref">strncpyioa>(.a href="+code=entry" class="sref">entryioa>->.a href="+code=file" class="sref">fileioa>, .a href="+code=p" class="sref">pioa>, .a href="+code=TRACE_FILE_SIZE" class="sref">TRACE_FILE_SIZEioa>);=6 74./a>        .a href="+code=entry" class="sref">entryioa>->.a href="+code=func" class="sref">funcioa>[.a href="+code=TRACE_FUNC_SIZE" class="sref">TRACE_FUNC_SIZEioa>] = 0;=6 75./a>        .a href="+code=entry" class="sref">entryioa>->.a href="+code=file" class="sref">fileioa>[.a href="+code=TRACE_FILE_SIZE" class="sref">TRACE_FILE_SIZEioa>] = 0;=6 76./a>        .a href="+code=entry" class="sref">entryioa>->.a href="+code=line" class="sref">lineioa> = .a href="+code=f" class="sref">fioa>->.a href="+code=line" class="sref">lineioa>;=6 77./a>        .a href="+code=entry" class="sref">entryioa>->.a href="+code=correct" class="sref">correctioa> = .a href="+code=val" class="sref">valioa> == .a href="+code=expect" class="sref">expectioa>;=6 78./a>=6 79./a>        if (!.a href="+code=filter_check_discard" class="sref">filter_check_discardioa>(.a href="+code=call" class="sref">callioa>, .a href="+code=entry" class="sref">entryioa>, .a href="+code=buffer" class="sref">bufferioa>, .a href="+code=event" class="sref">eventioa>))=6 80./a>                .a href="+code=ring_buffer_unlock_commit" class="sref">ring_buffer_unlock_commitioa>(.a href="+code=buffer" class="sref">bufferioa>, .a href="+code=event" class="sref">eventioa>);=6 81./a>=6 82./a> .a href="+code=out" class="sref">outioa>:=6 83./a>        .a href="+code=atomic_dec" class="sref">atomic_decioa>(&.a href="+code=tr" class="sref">trioa>->.a href="+code=data" class="sref">dataioa>[.a href="+code=cpu" class="sref">cpuioa>]->.a href="+code=disabled" class="sref">disabledioa>);=6 84./a>        .a href="+code=local_irq_restore" class="sref">local_irq_restoreioa>(.a href="+code=flags" class="sref">flagsioa>);=6 85./a>}=6 86./a>=6 87./a>static .a href="+code=inline" class="sref">inline./a>=6 88./a>void .a href="+code=trace_likely_condivalu" class="sref">trace_likely_condivaluioa>(struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=f" class="sref">fioa>, int6.a href="+code=val" class="sref">valioa>, int6.a href="+code=expect" class="sref">expectioa>)=6 89./a>{=6 90./a>        if (!.a href="+code=branch_tracing_enabled" class="sref">branch_tracing_enabledioa>)=6 91./a>                return;=6 92./a>=6 93./a>        .a href="+code=probe_likely_condivalu" class="sref">probe_likely_condivaluioa>(.a href="+code=f" class="sref">fioa>, .a href="+code=val" class="sref">valioa>, .a href="+code=expect" class="sref">expectioa>);=6 94./a>}=6 95./a>=6 96./a>int6.a href="+code=enable_branch_tracing" class="sref">enable_branch_tracingioa>(struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>)=6 97./a>{=6 98./a>        .a href="+code=mutex_lock" class="sref">mutex_lockioa>(&.a href="+code=branch_tracing_mutex" class="sref">branch_tracing_mutexioa>);=6 99./a>        .a href="+code=branch_tracer" class="sref">branch_tracerioa>6= .a href="+code=tr" class="sref">trioa>;=6100./a>        .spau class="comment">/*./spaue=6101./a>.spau class="comment">         * Must be seen before enabling. The reader is a condivaluiospaue=6102./a>.spau class="comment">         * where we do not need a matching rmb()iospaue=6103./a>.spau class="comment">         */./spaue=6104./a>        .a href="+code=smp_wmb" class="sref">smp_wmbioa>();=6105./a>        .a href="+code=branch_tracing_enabled" class="sref">branch_tracing_enabledioa>++;=6106./a>        .a href="+code=mutex_unlock" class="sref">mutex_unlockioa>(&.a href="+code=branch_tracing_mutex" class="sref">branch_tracing_mutexioa>);=6107./a>=6108./a>        return 0;=6109./a>}=61ptioa>=6111ioa>void .a href="+code=disable_branch_tracing" class="sref">disable_branch_tracingioa>(void)=6112ioa>{=6113./a>        .a href="+code=mutex_lock" class="sref">mutex_lockioa>(&.a href="+code=branch_tracing_mutex" class="sref">branch_tracing_mutexioa>);=6114ioa>=6115./a>        if (!.a href="+code=branch_tracing_enabled" class="sref">branch_tracing_enabledioa>)=6116./a>                goto .a href="+code=out_unlock" class="sref">out_unlockioa>;=6117./a>=6118./a>        .a href="+code=branch_tracing_enabled" class="sref">branch_tracing_enabledioa>--;=6119./a>=6120./a> .a href="+code=out_unlock" class="sref">out_unlockioa>:=6121./a>        .a href="+code=mutex_unlock" class="sref">mutex_unlockioa>(&.a href="+code=branch_tracing_mutex" class="sref">branch_tracing_mutexioa>);=6122ioa>}=6123./a>=6124ioa>static void .a href="+code=start_branch_trace" class="sref">start_branch_traceioa>(struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>)=6125ioa>{=6126./a>        .a href="+code=enable_branch_tracing" class="sref">enable_branch_tracingioa>(.a href="+code=tr" class="sref">trioa>);=6127./a>}=6128./a>=6129./a>static void .a href="+code=stop_branch_trace" class="sref">stop_branch_traceioa>(struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>)=6130ioa>{=6131./a>        .a href="+code=disable_branch_tracing" class="sref">disable_branch_tracingioa>();=6132ioa>}=6133./a>=6134ioa>static int6.a href="+code=branch_trace_init" class="sref">branch_trace_initioa>(struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>)=6135ioa>{=6136./a>        .a href="+code=start_branch_trace" class="sref">start_branch_traceioa>(.a href="+code=tr" class="sref">trioa>);=6137./a>        return 0;=6138./a>}=6139./a>=6140ioa>static void6.a href="+code=branch_trace_reset" class="sref">branch_trace_resetioa>(struct6.a href="+code=trace_array" class="sref">trace_arrayioa>6*.a href="+code=tr" class="sref">trioa>)=6141./a>{=6142./a>        .a href="+code=stop_branch_trace" class="sref">stop_branch_traceioa>(.a href="+code=tr" class="sref">trioa>);=6143./a>}=6144ioa>=6145ioa>static enum .a href="+code=print_line_t" class="sref">print_line_t./a> .a href="+code=trace_branch_print" class="sref">trace_branch_printioa>(struct6.a href="+code=trace_iterator" class="sref">trace_iteratorioa>6*.a href="+code=iter" class="sref">iterioa>,=6146./a>                                            int6.a href="+code=flags" class="sref">flagsioa>, struct6.a href="+code=trace_event" class="sref">trace_eventioa>6*.a href="+code=event" class="sref">eventioa>)=6147./a>{=6148./a>        struct6.a href="+code=trace_branch" class="sref">trace_branchioa>6*.a href="+code=field" class="sref">fieldioa>;=6149./a>=6150./a>        .a href="+code=trace_assign_typ
" class="sref">trace_assign_typ
ioa>(.a href="+code=field" class="sref">fieldioa>, .a href="+code=iter" class="sref">iterioa>->.a href="+code=ent" class="sref">entioa>);=6151./a>=6152./a>        if (.a href="+code=trace_seq_printf" class="sref">trace_seq_printfioa>(&.a href="+code=iter" class="sref">iterioa>->.a href="+code=seq" class="sref">seqioa>, .spau class="string">"[%s] %s:%s:%d\n"6153./a>                             .a href="+code=field" class="sref">fieldioa>->.a href="+code=correct" class="sref">correctioa> ? .spau class="string">"  ok  "" MISS "6154./a>                             .a href="+code=field" class="sref">fieldioa>->.a href="+code=func" class="sref">funcioa>,=6155./a>                             .a href="+code=field" class="sref">fieldioa>->.a href="+code=file" class="sref">fileioa>,=6156./a>                             .a href="+code=field" class="sref">fieldioa>->.a href="+code=line" class="sref">lineioa>))=6157./a>                return .a href="+code=TRACE_TYPE_PARTIAL_LINE" class="sref">TRACE_TYPE_PARTIAL_LINEioa>;=6158./a>=6159./a>        return .a href="+code=TRACE_TYPE_HANDLED" class="sref">TRACE_TYPE_HANDLEDioa>;=6160./a>}=6161./a>=6162./a>static void6.a href="+code=branch_print_header" class="sref">branch_print_headerioa>(struct6.a href="+code=seq_file" class="sref">seq_fileioa> *.a href="+code=s" class="sref">sioa>)=6163./a>{=6164./a>        .a href="+code=seq_puts" class="sref">seq_putsioa>(.a href="+code=s" class="sref">sioa>, .spau class="string">"#           TASK-PID    CPU#    TIMESTAMP  CORRECT"6165./a>                .spau class="string">"  FUNC:FILE:LINE\n"6166./a>        .a href="+code=seq_puts" class="sref">seq_putsioa>(.a href="+code=s" class="sref">sioa>, .spau class="string">"#              | |       |          |         |   "6167./a>                .spau class="string">"    |\n"6168./a>}=6169./a>=6170ioa>static struct6.a href="+code=trace_event_funcvalus" class="sref">trace_event_funcvalus./a> .a href="+code=trace_branch_funcs" class="sref">trace_branch_funcs./a> = {=6171./a>        ..a href="+code=trace" class="sref">trace./a>          = .a href="+code=trace_branch_print" class="sref">trace_branch_printioa>,=6172./a>};=6173./a>=6174ioa>static struct6.a href="+code=trace_event" class="sref">trace_eventioa>6.a href="+code=trace_branch_event" class="sref">trace_branch_event./a> = {=6175./a>        ..a href="+code=typ
" class="sref">typ
ioa>           = .a href="+code=TRACE_BRANCH" class="sref">TRACE_BRANCHioa>,=6176./a>        ..a href="+code=funcs" class="sref">funcs./a>          = &.a href="+code=trace_branch_funcs" class="sref">trace_branch_funcs./a>,=6177./a>};=6178./a>=6179ioa>static struct6.a href="+code=tracer" class="sref">tracerioa>6.a href="+code=branch_trace" class="sref">branch_traceioa>6.a href="+code=__read_mostly" class="sref">__read_mostlyioa> ==6180ioa>{=6181./a>        ..a href="+code=nam
" class="sref">nam
ioa>           = .spau class="string">"branch"6182./a>        ..a href="+code=init" class="sref">initioa>           = .a href="+code=branch_trace_init" class="sref">branch_trace_initioa>,=6183./a>        ..a href="+code=reset" class="sref">resetioa>          = .a href="+code=branch_trace_reset" class="sref">branch_trace_resetioa>,=6184ioa>#ifdef6.a href="+code=CONFIG_FTRACE_SELFTEST" class="sref">CONFIG_FTRACE_SELFTEST./a>=6185./a>        ..a href="+code=selftest" class="sref">selftest./a>       = .a href="+code=trace_selftest_startup_branch" class="sref">trace_selftest_startup_branchioa>,=6186./a>#endif .spau class="comment">/* CONFIG_FTRACE_SELFTEST */./spaue=6187./a>        ..a href="+code=print_header" class="sref">print_headerioa>   = .a href="+code=branch_print_header" class="sref">branch_print_headerioa>,=6188./a>};=6189./a>=6190./a>.a href="+code=__init" class="sref">__initioa> static int6.a href="+code=init_branch_tracer" class="sref">init_branch_tracerioa>(void)=6191./a>{=6192./a>        int6.a href="+code=ret" class="sref">retioa>;=6193./a>=6194./a>        .a href="+code=ret" class="sref">retioa> = .a href="+code=register_ftrace_event" class="sref">register_ftrace_eventioa>(&.a href="+code=trace_branch_event" class="sref">trace_branch_event./a>);=6195./a>        if (!.a href="+code=ret" class="sref">retioa>) {=6196./a>                .a href="+code=printk" class="sref">printkioa>(.a href="+code=KERN_WARNING" class="sref">KERN_WARNINGioa>6.spau class="string">"Warning: could not register "6197./a>                                    .spau class="string">"branch events\n"6198./a>                return 1;=6199./a>        }=6200./a>        return .a href="+code=register_tracer" class="sref">register_tracerioa>(&.a href="+code=branch_trace" class="sref">branch_traceioa>);=6201./a>}=6202./a>.a href="+code=device_initcall" class="sref">device_initcallioa>(.a href="+code=init_branch_tracer" class="sref">init_branch_tracerioa>);=6203./a>=6204./a>#else=6205ioa>static .a href="+code=inline" class="sref">inline./a>=6206./a>void .a href="+code=trace_likely_condivalu" class="sref">trace_likely_condivaluioa>(struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=f" class="sref">fioa>, int6.a href="+code=val" class="sref">valioa>, int6.a href="+code=expect" class="sref">expectioa>)=6207./a>{=6208./a>}=6209./a>#endif .spau class="comment">/* CONFIG_BRANCH_TRACER */./spaue=62ptioa>=6211ioa>void .a href="+code=ftrace_likely_update" class="sref">ftrace_likely_updateioa>(struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=f" class="sref">fioa>, int6.a href="+code=val" class="sref">valioa>, int6.a href="+code=expect" class="sref">expectioa>)=6212ioa>{=6213./a>        .spau class="comment">/*./spaue=6214./a>.spau class="comment">         * I would love to have a trace point here instead, but the./spaue=6215./a>.spau class="comment">         * trace point code is so inundated with unlikely and likelyiospaue=6216./a>.spau class="comment">         * condivalus that the recursive nightmare that exists is tooiospaue=6217./a>.spau class="comment">         * much to try to get working. At least for now../spaue=6218./a>.spau class="comment">         */./spaue=6219./a>        .a href="+code=trace_likely_condivalu" class="sref">trace_likely_condivaluioa>(.a href="+code=f" class="sref">fioa>, .a href="+code=val" class="sref">valioa>, .a href="+code=expect" class="sref">expectioa>);=622tioa>=6221./a>        .spau class="comment">/* FIXME: Make this atomic! */./spaue=6222./a>        if (.a href="+code=val" class="sref">valioa> == .a href="+code=expect" class="sref">expectioa>)=6223./a>                .a href="+code=f" class="sref">fioa>->.a href="+code=correct" class="sref">correctioa>++;=6224./a>        else=6225./a>                .a href="+code=f" class="sref">fioa>->.a href="+code=incorrect" class="sref">incorrectioa>++;=6226./a>}=6227./a>.a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOLioa>(.a href="+code=ftrace_likely_update" class="sref">ftrace_likely_updateioa>);=6228./a>=6229./a>extern unsigned long6.a href="+code=__start_annotated_branch_profile" class="sref">__start_annotated_branch_profile./a>[];=6230ioa>extern unsigned long6.a href="+code=__stop_annotated_branch_profile" class="sref">__stop_annotated_branch_profile./a>[];=6231./a>=6232./a>static int6.a href="+code=annotated_branch_stat_headers" class="sref">annotated_branch_stat_headersioa>(struct6.a href="+code=seq_file" class="sref">seq_fileioa> *.a href="+code=m" class="sref">mioa>)=6233./a>{=6234./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">" correct incorrect  %% "6235./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"       Funcvalu                "6236./a>                              .spau class="string">"  File              Line\n"6237./a>                              .spau class="string">" ------- ---------  - "6238./a>                              .spau class="string">"       --------                "6239./a>                              .spau class="string">"  ----              ----\n"6240./a>        return 0;=6241./a>}=6242./a>=6243./a>static .a href="+code=inline" class="sref">inline./a> long6.a href="+code=get_incorrect_percent" class="sref">get_incorrect_percentioa>(struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=p" class="sref">pioa>)=6244ioa>{=6245./a>        long6.a href="+code=percent" class="sref">percentioa>;=6246./a>=6247./a>        if (.a href="+code=p" class="sref">pioa>->.a href="+code=correct" class="sref">correctioa>) {=6248./a>                .a href="+code=percent" class="sref">percentioa> = .a href="+code=p" class="sref">pioa>->.a href="+code=incorrect" class="sref">incorrectioa> *6100;=6249./a>                .a href="+code=percent" class="sref">percentioa> /= .a href="+code=p" class="sref">pioa>->.a href="+code=correct" class="sref">correctioa> + .a href="+code=p" class="sref">pioa>->.a href="+code=incorrect" class="sref">incorrectioa>;=6250./a>        } else=6251./a>                .a href="+code=percent" class="sref">percentioa> = .a href="+code=p" class="sref">pioa>->.a href="+code=incorrect" class="sref">incorrectioa> ?6100 : -1;=6252./a>=6253./a>        return .a href="+code=percent" class="sref">percentioa>;=6254./a>}=6255./a>=6256./a>static int6.a href="+code=branch_stat_show" class="sref">branch_stat_showioa>(struct6.a href="+code=seq_file" class="sref">seq_fileioa> *.a href="+code=m" class="sref">mioa>, void6*.a href="+code=v" class="sref">vioa>)=6257./a>{=6258./a>        struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=p" class="sref">pioa> = .a href="+code=v" class="sref">vioa>;=6259./a>        const char6*.a href="+code=f" class="sref">fioa>;=6260./a>        long6.a href="+code=percent" class="sref">percentioa>;=6261./a>=6262./a>        .spau class="comment">/* Only print the file, not the path */./spaue=6263./a>        .a href="+code=f" class="sref">fioa> = .a href="+code=p" class="sref">pioa>->.a href="+code=file" class="sref">fileioa> + .a href="+code=strleu" class="sref">strleuioa>(.a href="+code=p" class="sref">pioa>->.a href="+code=file" class="sref">fileioa>);=6264./a>        while (.a href="+code=f" class="sref">fioa> >= .a href="+code=p" class="sref">pioa>->.a href="+code=file" class="sref">fileioa> &&6*.a href="+code=f" class="sref">fioa> != .spau class="string">'/'6265./a>                .a href="+code=f" class="sref">fioa>--;=6266./a>        .a href="+code=f" class="sref">fioa>++;=6267./a>=6268./a>        .spau class="comment">/*./spaue=6269./a>.spau class="comment">         * The miss is overlayed on correct, and hit on incorrect../spaue=6270ioa>.spau class="comment">         */./spaue=6271./a>        .a href="+code=percent" class="sref">percentioa> = .a href="+code=get_incorrect_percent" class="sref">get_incorrect_percentioa>(.a href="+code=p" class="sref">pioa>);=6272./a>=6273./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"%8lu %8lu "pioa>->.a href="+code=correct" class="sref">correctioa>, .a href="+code=p" class="sref">pioa>->.a href="+code=incorrect" class="sref">incorrectioa>);=6274./a>        if (.a href="+code=percent" class="sref">percentioa> < 0)=6275./a>                .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"  X "6276./a>        else=6277./a>                .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"%3ld "percentioa>);=6278./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"%-30.30s %-20.20s %d\n"pioa>->.a href="+code=func" class="sref">funcioa>, .a href="+code=f" class="sref">fioa>, .a href="+code=p" class="sref">pioa>->.a href="+code=line" class="sref">line./a>);=6279./a>        return 0;=6280./a>}=6281./a>=6282./a>static void6*.a href="+code=annotated_branch_stat_start" class="sref">annotated_branch_stat_startioa>(struct6.a href="+code=tracer_stat" class="sref">tracer_statioa>6*.a href="+code=trace" class="sref">traceioa>)=6283./a>{=6284./a>        return .a href="+code=__start_annotated_branch_profile" class="sref">__start_annotated_branch_profile./a>;=6285./a>}=6286./a>=6287./a>static void6*=6288./a>.a href="+code=annotated_branch_stat_next" class="sref">annotated_branch_stat_nextioa>(void6*.a href="+code=v" class="sref">vioa>, int6.a href="+code=idx" class="sref">idxioa>)=6289./a>{=6290./a>        struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=p" class="sref">pioa> = .a href="+code=v" class="sref">vioa>;=6291./a>=6292./a>        ++.a href="+code=p" class="sref">pioa>;=6293./a>=6294./a>        if ((void6*).a href="+code=p" class="sref">pioa> >= (void6*).a href="+code=__stop_annotated_branch_profile" class="sref">__stop_annotated_branch_profile./a>)=6295./a>                return .a href="+code=NULL" class="sref">NULLioa>;=6296./a>=6297./a>        return .a href="+code=p" class="sref">pioa>;=6298./a>}=6299./a>=6300ioa>static int6.a href="+code=annotated_branch_stat_cmp" class="sref">annotated_branch_stat_cmpioa>(void6*.a href="+code=p1" class="sref">p1ioa>, void6*.a href="+code=p2" class="sref">p2./a>)=6301./a>{=6302./a>        struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=a" class="sref">aioa> = .a href="+code=p1" class="sref">p1ioa>;=6303./a>        struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=b" class="sref">bioa> = .a href="+code=p2" class="sref">p2./a>;=6304ioa>=6305./a>        long6.a href="+code=percent_a" class="sref">percent_aioa>, .a href="+code=percent_b" class="sref">percent_b./a>;=6306./a>=6307./a>        .a href="+code=percent_a" class="sref">percent_aioa> = .a href="+code=get_incorrect_percent" class="sref">get_incorrect_percentioa>(.a href="+code=a" class="sref">aioa>);=6308./a>        .a href="+code=percent_b" class="sref">percent_b./a> = .a href="+code=get_incorrect_percent" class="sref">get_incorrect_percentioa>(.a href="+code=b" class="sref">bioa>);=6309./a>=6310./a>        if (.a href="+code=percent_a" class="sref">percent_aioa> < .a href="+code=percent_b" class="sref">percent_b./a>)=6311./a>                return -1;=6312./a>        if (.a href="+code=percent_a" class="sref">percent_aioa> > .a href="+code=percent_b" class="sref">percent_b./a>)=6313./a>                return 1;=6314ioa>=6315./a>        if (.a href="+code=a" class="sref">aioa>->.a href="+code=incorrect" class="sref">incorrectioa> < .a href="+code=b" class="sref">bioa>->.a href="+code=incorrect" class="sref">incorrectioa>)=6316./a>                return -1;=6317./a>        if (.a href="+code=a" class="sref">aioa>->.a href="+code=incorrect" class="sref">incorrectioa> > .a href="+code=b" class="sref">bioa>->.a href="+code=incorrect" class="sref">incorrectioa>)=6318./a>                return 1;=6319./a>=6320./a>        .spau class="comment">/*./spaue=6321./a>.spau class="comment">         * Since the above shows worse (incorrect) cases./spaue=6322./a>.spau class="comment">         * first, we continue that by showing6best (correct)./spaue=6323./a>.spau class="comment">         * cases last../spaue=6324./a>.spau class="comment">         */./spaue=6325./a>        if (.a href="+code=a" class="sref">aioa>->.a href="+code=correct" class="sref">correctioa> > .a href="+code=b" class="sref">bioa>->.a href="+code=correct" class="sref">correctioa>)=6326./a>                return -1;=6327./a>        if (.a href="+code=a" class="sref">aioa>->.a href="+code=correct" class="sref">correctioa> < .a href="+code=b" class="sref">bioa>->.a href="+code=correct" class="sref">correctioa>)=6328./a>                return 1;=6329./a>=6330./a>        return 0;=6331./a>}=6332./a>=6333./a>static struct6.a href="+code=tracer_stat" class="sref">tracer_statioa>6.a href="+code=annotated_branch_stats" class="sref">annotated_branch_stats./a> = {=6334./a>        ..a href="+code=nam
" class="sref">nam
ioa> = .spau class="string">"branch_annotated"6335./a>        ..a href="+code=stat_start" class="sref">stat_startioa> = .a href="+code=annotated_branch_stat_start" class="sref">annotated_branch_stat_startioa>,=6336./a>        ..a href="+code=stat_next" class="sref">stat_nextioa> = .a href="+code=annotated_branch_stat_next" class="sref">annotated_branch_stat_nextioa>,=6337./a>        ..a href="+code=stat_cmp" class="sref">stat_cmpioa> = .a href="+code=annotated_branch_stat_cmp" class="sref">annotated_branch_stat_cmpioa>,=6338./a>        ..a href="+code=stat_headers" class="sref">stat_headersioa> = .a href="+code=annotated_branch_stat_headers" class="sref">annotated_branch_stat_headersioa>,=6339./a>        ..a href="+code=stat_show" class="sref">stat_showioa> = .a href="+code=branch_stat_show" class="sref">branch_stat_showioa>=6340./a>};=6341./a>=6342./a>.a href="+code=__init" class="sref">__initioa> static int6.a href="+code=init_annotated_branch_stats" class="sref">init_annotated_branch_statsioa>(void)=6343./a>{=6344./a>        int6.a href="+code=ret" class="sref">retioa>;=6345./a>=6346./a>        .a href="+code=ret" class="sref">retioa> = .a href="+code=register_stat_tracer" class="sref">register_stat_tracerioa>(&.a href="+code=annotated_branch_stats" class="sref">annotated_branch_stats./a>);=6347./a>        if (!.a href="+code=ret" class="sref">retioa>) {=6348./a>                .a href="+code=printk" class="sref">printkioa>(.a href="+code=KERN_WARNING" class="sref">KERN_WARNINGioa>6.spau class="string">"Warning: could not register "6349./a>                                    .spau class="string">"annotated branches stats\n"6350./a>                return 1;=6351./a>        }=6352./a>        return 0;=6353./a>}=6354./a>.a href="+code=fs_initcall" class="sref">fs_initcallioa>(.a href="+code=init_annotated_branch_stats" class="sref">init_annotated_branch_statsioa>);=6355./a>=6356./a>#ifdef6.a href="+code=CONFIG_PROFILE_ALL_BRANCHES" class="sref">CONFIG_PROFILE_ALL_BRANCHES./a>=6357./a>=6358./a>extern unsigned long6.a href="+code=__start_branch_profile" class="sref">__start_branch_profile./a>[];=6359./a>extern unsigned long6.a href="+code=__stop_branch_profile" class="sref">__stop_branch_profile./a>[];=636tioa>=6361./a>static int6.a href="+code=all_branch_stat_headers" class="sref">all_branch_stat_headersioa>(struct6.a href="+code=seq_file" class="sref">seq_fileioa> *.a href="+code=m" class="sref">mioa>)=6362ioa>{=6363./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"   miss      hit    %% "6364./a>        .a href="+code=seq_printf" class="sref">seq_printfioa>(.a href="+code=m" class="sref">mioa>, .spau class="string">"       Funcvalu                "6365./a>                              .spau class="string">"  File              Line\n"6366./a>                              .spau class="string">" ------- ---------  - "6367./a>                              .spau class="string">"       --------                "6368./a>                              .spau class="string">"  ----              ----\n"6369./a>        return 0;=6370./a>}=6371./a>=6372./a>static void6*.a href="+code=all_branch_stat_start" class="sref">all_branch_stat_startioa>(struct6.a href="+code=tracer_stat" class="sref">tracer_statioa>6*.a href="+code=trace" class="sref">traceioa>)=6373./a>{=6374./a>        return .a href="+code=__start_branch_profile" class="sref">__start_branch_profile./a>;=6375./a>}=6376./a>=6377./a>static void6*=6378./a>.a href="+code=all_branch_stat_next" class="sref">all_branch_stat_nextioa>(void6*.a href="+code=v" class="sref">vioa>, int6.a href="+code=idx" class="sref">idxioa>)=6379./a>{=6380./a>        struct6.a href="+code=ftrace_branch_data" class="sref">ftrace_branch_dataioa>6*.a href="+code=p" class="sref">pioa> = .a href="+code=v" class="sref">vioa>;=6381./a>=6382./a>        ++.a href="+code=p" class="sref">pioa>;=6383./a>=6384./a>        if ((void6*).a href="+code=p" class="sref">pioa> >= (void6*).a href="+code=__stop_branch_profile" class="sref">__stop_branch_profile./a>)=6385./a>                return .a href="+code=NULL" class="sref">NULLioa>;=6386./a>=6387./a>        return .a href="+code=p" class="sref">pioa>;=6388./a>}=6389./a>=6390ioa>static struct6.a href="+code=tracer_stat" class="sref">tracer_statioa>6.a href="+code=all_branch_stats" class="sref">all_branch_stats./a> = {=6391./a>        ..a href="+code=nam
" class="sref">nam
ioa> = .spau class="string">"branch_all"6392./a>        ..a href="+code=stat_start" class="sref">stat_startioa> = .a href="+code=all_branch_stat_start" class="sref">all_branch_stat_startioa>,=6393./a>        ..a href="+code=stat_next" class="sref">stat_nextioa> = .a href="+code=all_branch_stat_next" class="sref">all_branch_stat_nextioa>,=6394./a>        ..a href="+code=stat_headers" class="sref">stat_headersioa> = .a href="+code=all_branch_stat_headers" class="sref">all_branch_stat_headersioa>,=6395./a>        ..a href="+code=stat_show" class="sref">stat_showioa> = .a href="+code=branch_stat_show" class="sref">branch_stat_showioa>=6396./a>};=6397./a>=6398./a>.a href="+code=__init" class="sref">__initioa> static int6.a href="+code=all_annotated_branch_stats" class="sref">all_annotated_branch_statsioa>(void)=6399./a>{=6400./a>        int6.a href="+code=ret" class="sref">retioa>;=6401./a>=6402./a>        .a href="+code=ret" class="sref">retioa> = .a href="+code=register_stat_tracer" class="sref">register_stat_tracerioa>(&.a href="+code=all_branch_stats" class="sref">all_branch_stats./a>);=6403./a>        if (!.a href="+code=ret" class="sref">retioa>) {=6404./a>                .a href="+code=printk" class="sref">printkioa>(.a href="+code=KERN_WARNING" class="sref">KERN_WARNINGioa>6.spau class="string">"Warning: could not register "6405./a>                                    .spau class="string">"all branches stats\n"6406./a>                return 1;=6407./a>        }=6408./a>        return 0;=6409./a>}=6410./a>.a href="+code=fs_initcall" class="sref">fs_initcallioa>(.a href="+code=all_annotated_branch_stats" class="sref">all_annotated_branch_statsioa>);=6411./a>#endif .spau class="comment">/* CONFIG_PROFILE_ALL_BRANCHES */./spaue=6412./a>
lxr.linux.no kindly hosted by Redpill Linpro ASioa>, provider of Linux consulting6and operavalus services since 1995.