/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/debugging/profiling/perfmon2.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
- Initialization
 
2
    modprobe perfmon_intel_core (perfmon_intel_atom, perfmon_amd64, ...)
 
3
    
 
4
- Information
 
5
    pfmon -l                            Listing available events
 
6
    pfmon -L                            Events + unit masks
 
7
    pfmon -i UNHALTED_CORE_CYCLES       Event information
 
8
    pfmon -I                            Hardware information
 
9
 
 
10
- Executing
 
11
    pfmon -- <application>    
 
12
    pfmon -e UNHALTED_CORE_CYCLES,BR_RET_MISSP_EXEC  -- <app>   [multiple]
 
13
    pfmon -e SIMD_COMP_INST_RETIRED:PACKED_SINGLE               [mask]
 
14
    
 
15
    pfmon -priv-level=u         - monitors events in user level only (default)
 
16
    pfmon -priv-level=k         - monitors events in kernel level only
 
17
    pfmon -priv-level=uk        - both levels
 
18
    pfmon -priv-level=uk,u      - first event 'uk' and second event only 'u'
 
19
 
 
20
    pfmon --attach-task=22731   - attaching to the running task
 
21
    pfmon -t 5 --attach...      - attach for 5 seconds
 
22
    
 
23
    pfmon --system-wide         - system wide monitoring
 
24
    pfmon --verbose             - verbose mode
 
25
    pfmon --no-cmd-out          - suppreseing application output
 
26
 
 
27
- Threading 
 
28
    * By default only a single thread is monitored, to enable monitoring of
 
29
    forked childs and pthreads use "--follow-all" or just some of the:
 
30
        --follow-fork --follow-vfork --follow-exec --follow-pthread
 
31
    the information on thread is displayed in the form
 
32
        (pid, tid, ppid)        - process, thread, parent
 
33
        
 
34
- Triggers
 
35
    * Starting and stopping at specific address
 
36
        pfmon \
 
37
            --trigger-code-start=0x4000000000000450 \
 
38
            --trigger-code-stop=0x4000000000000450
 
39
    
 
40
    * If you need to start on some sysmbol, the following command will return
 
41
    appropriate address
 
42
        nm <app> | fgrep "T symbol_name"
 
43
    However, pfmon accepts as well symbols in place of addresses
 
44
        pfmon --trigger-code-stop=main
 
45
 
 
46
    * Monitoring just a single function: the code start and stop trigger should
 
47
    be identical, then pfmon interprets the options as a request to monitor 
 
48
    when execution comes into a function until it leaves it
 
49
        pfmon --trigger-code-start=main pfmon --trigger-code-stop=main
 
50
        
 
51
    * Starting and stopping at access to specific addrss
 
52
        pfmon \
 
53
            --trigger-data-start=addr1,symb1,addr2 \
 
54
            --trigger-data-stop=addr3,symb3
 
55
 
 
56
    * By default start and stop triggers are "executed" only once, to instruct
 
57
    pfmon to do continious monitoring specify:
 
58
        --trigger-code-repeat  --trigger-data-follow options
 
59
 
 
60
    * Pfmon cannot extract symbol information coming from dynamically linked 
 
61
    libraries or modules. The addresses should be specified in that case.
 
62
    The '--attach-task' can be used to connect to thread when dll's already
 
63
    resolved.
 
64
    
 
65
- Profiling (sampling)
 
66
    pfmon --resolve-addresses  --long-smpl-periods=1000000,20000 -e<ev1>,<ev2> -- app
 
67
    
 
68
    Representation --smpl-module=<mode>
 
69
        * List: compact, inst-hist, detailed, compact, raw, pebs
 
70
        * List of supported modules returned by:         pfmon -I
 
71
        * Information  on module:                        pfmon -S compact 
 
72
        * Limit output:  --smpl-show-top=5, --smpl-cum-thresh=96
 
73
                                                
 
74
- Storing results
 
75
    pfmon --with-header --outfile=b 
 
76
    
 
 
b'\\ No newline at end of file'