Changes between Version 3 and Version 4 of linux/profiling

02/27/2023 09:23:13 PM (15 months ago)
Tim Harvey

removed Laguna info (EOL)


  • linux/profiling

    v3 v4  
    7272Using the standard mode, post-processing of collected raw events is not necessary.
    74 === OProfile Legacy Mode (cns3xxx) ===
    75 The legacy mode (for CPU's that do not implement the new perf_events kernel profiling API. The Gateworks Laguna family using the Cavium cns3xxx CPU falls into this category.
    77 The legacy mode tools consists of:
    78  * oprofile kernel module (requires CONFIG_PROFILING=y and CONFIG_OPROFILE=m)
    79  * opcontrol - used to setup profiling (need vmlinux file)
    80  * opprofiled - the daemon (controlled via opcontrol)
    81  * opreport - report on collected samples
    82 opcontrol parameters:
    83  * --session-dir specifies the location to store samples. It defaults to /var/lib/oprofile and you can use this (with both opcontrol and opreport) to use samples from alternate locations
    84  * --separate specifies how to seperate samples. By default they are all stored in a single file (none), but you can choose to store by:
    85   - none - no profile separation (default)
    86   - lib - per-application profiles for libraries
    87   - kernel - per-application profiles for the kernel and kernel modules
    88   - thread - profiles for each thread and each task
    89   - cpu - profiles for each CPU
    90   - all - all of the above
    91  * Using profile specification parameters you can choose how to sample and report data"
    92   - cpu:0 - report just cpu0 (assuming data was collected separately (see above))
    93  * --vmlinux=file (both for opcontrol and opreport) specifies the vmlinux kernel image required for decrypting kernel symbols
    94  * --setup will store the following list of parameters in /root/.oprofile/daemonrc to be used as default settings for opcontrol and opreport. Alternatively you can specify setup options to each program as needed
    96 Example usage:
    97  1. copy your current kernel's vmlinux to /tmp
    98  2. (optional) setup our configuration for vmlinux symbol decrypting, specific session location, and separating events by cpu:
    99 {{{#!bash
    100 opcontrol --setup --vmlinux=/tmp/vmlinux --session-dir=/tmp/session1 --separate=cpu
    101 }}}
    102  3. start capturing events:
    103 {{{#!bash
    104 opcontrol --start
    105 }}}
    106   * you can force a flush of collected events via opcontrol --dump at any time
    107   * you can clearout current collected events via opcontrol --reset at any time
    108  4. stop capturing events (and flush data):
    109 {{{#!bash
    110 opcontrol --shutdown
    111 }}}
    112  5. report events:
    113 {{{#!bash
    114 opreport --vmlinux=/tmp/vmlinux --session-dir=/tmp/session1
    115 }}}
    116   * if capturing events from individual cpu's separately (as shown above) you can show the info for just cpu0 via opreport cpu:0
    117   * Note that opreport doesn't make use of the conf file generated by opcontrol --setup
    119 Important notes:
    120  * because the cns3xxx kernel and/or hardware does not support a performance counter and this means we are forced into timer based mode using timer irq. In this mode profiling is not useful when using code that disables irqs or runs in hardirq context
    122 References:
    123  *
    124  * ​