/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
- Initialization
    modprobe perfmon_intel_core (perfmon_intel_atom, perfmon_amd64, ...)
    
- Information
    pfmon -l				Listing available events
    pfmon -L				Events + unit masks
    pfmon -i UNHALTED_CORE_CYCLES	Event information
    pfmon -I				Hardware information

- Executing
    pfmon -- <application>    
    pfmon -e UNHALTED_CORE_CYCLES,BR_RET_MISSP_EXEC  -- <app>	[multiple]
    pfmon -e SIMD_COMP_INST_RETIRED:PACKED_SINGLE		[mask]
    
    pfmon -priv-level=u		- monitors events in user level only (default)
    pfmon -priv-level=k		- monitors events in kernel level only
    pfmon -priv-level=uk	- both levels
    pfmon -priv-level=uk,u	- first event 'uk' and second event only 'u'

    pfmon --attach-task=22731	- attaching to the running task
    pfmon -t 5 --attach...	- attach for 5 seconds
    
    pfmon --system-wide		- system wide monitoring
    pfmon --verbose		- verbose mode
    pfmon --no-cmd-out		- suppreseing application output

- Threading 
    * By default only a single thread is monitored, to enable monitoring of
    forked childs and pthreads use "--follow-all" or just some of the:
	--follow-fork --follow-vfork --follow-exec --follow-pthread
    the information on thread is displayed in the form
	(pid, tid, ppid)	- process, thread, parent
	
- Triggers
    * Starting and stopping at specific address
	pfmon \
	    --trigger-code-start=0x4000000000000450 \
	    --trigger-code-stop=0x4000000000000450
    
    * If you need to start on some sysmbol, the following command will return
    appropriate address
	nm <app> | fgrep "T symbol_name"
    However, pfmon accepts as well symbols in place of addresses
	pfmon --trigger-code-stop=main

    * Monitoring just a single function: the code start and stop trigger should
    be identical, then pfmon interprets the options as a request to monitor 
    when execution comes into a function until it leaves it
	pfmon --trigger-code-start=main pfmon --trigger-code-stop=main
	
    * Starting and stopping at access to specific addrss
	pfmon \
	    --trigger-data-start=addr1,symb1,addr2 \
	    --trigger-data-stop=addr3,symb3

    * By default start and stop triggers are "executed" only once, to instruct
    pfmon to do continious monitoring specify:
	--trigger-code-repeat  --trigger-data-follow options

    * Pfmon cannot extract symbol information coming from dynamically linked 
    libraries or modules. The addresses should be specified in that case.
    The '--attach-task' can be used to connect to thread when dll's already
    resolved.
    
- Profiling (sampling)
    pfmon --resolve-addresses  --long-smpl-periods=1000000,20000 -e<ev1>,<ev2> -- app
    
    Representation --smpl-module=<mode>
	* List: compact, inst-hist, detailed, compact, raw, pebs
	* List of supported modules returned by:	 pfmon -I
	* Information  on module:			 pfmon -S compact 
	* Limit output:	 --smpl-show-top=5, --smpl-cum-thresh=96
						
- Storing results
    pfmon --with-header --outfile=b