NameDateSize

..Today170

MakefileH A D25-Nov-2011159

READMEH A D30-Jan-20084.1 KiB

tpann.shH A D14-Jan-20081.8 KiB

tpfmt.shH A D12-Oct-20091.7 KiB

tprof.8H A D09-Dec-20114 KiB

tprof.cH A D10-Jan-20124.9 KiB

README

1$NetBSD: README,v 1.8 2008/01/14 12:48:52 yamt Exp $
2
3NOTE:
4	- tprof driver currently only supports pentium4 (netburst) processors.
5	- it samples program counters on every PMIs.
6	- it's currently hardcoded to use global_power_events events.
7	  for details, see x86/x86/tprof_pmi.c and intel's processor manuals.
8
9usage:
10
110. set SIZEOF_PTR environment variable, which is used by tpfmt.sh and tpann.sh.
12   if not set, SIZEOF_PTR=4 is assumed.
13
141. add a line to your kernel config.
15
16	pseudo-device	tprof
17
182. create a device special file.
19
20	# mknod /dev/tprof c 191 0
21
223. run the tprof command.
23
24	# tprof -o /tmp/foo sleep 1
25
26	tprof statistics:
27		sample 57
28		overflow 0
29		buf 3
30		emptybuf 3
31		dropbuf 0
32		dropbuf_sample 0
33
344. format the result.
35   the first line in the following example means that 11 samples have been
36   taken at 0xc0396c36, whose symbolic name is lapic_gettick+0x6.
37
38	# sh ./tpfmt.sh < /tmp/foo
39	11      c0396c36        lapic_gettick+0x6
40	5       c039b98a        x86_pause+0x2
41	4       c010cf9d        __cpu_simple_lock+0xd
42	2       c010cfcd        __cpu_simple_lock_try+0xd
43	2       c039b571        bus_space_read_4+0x11
44	1       c01005c8        sse2_zero_page+0x18
45	1       c0100624        sse2_copy_page+0x34
46	1       c010ceeb        mutex_spin_enter+0x2b
47	1       c010cef5        mutex_spin_enter+0x35
48	1       c010cf32        mutex_spin_exit+0x32
49	1       c0119ed0        in_localaddr+0x30
50	1       c012d0fd        tcp_output+0x1fbd
51	1       c02980c2        amap_copy+0x42
52	1       c02a0100        uvm_map_lookup_entry_bytree+0x20
53	1       c02a27fe        uvm_tree_RB_REMOVE+0xee
54	1       c02a8914        uvm_pagelookup+0x4
55	1       c02a9d5c        uvm_pagefree+0xfc
56	1       c02a9e36        uvm_pagefree+0x1d6
57	1       c02dd9d1        _kernel_unlock+0xa1
58	1       c02e0285        mutex_vector_enter+0x15
59	1       c02eb83a        sleepq_wake+0x5a
60	1       c0303467        pool_cache_get_paddr+0x97
61	1       c030368b        pool_cache_put_slow+0x6b
62	1       c0321ed3        pffasttimo+0x33
63	1       c034547a        VOP_LOCK+0xa
64	1       c0346235        VOP_ACCESS+0x45
65	1       c034a749        genfs_unlock+0x29
66	1       c038f251        cpu_idle+0x31
67	1       c03938da        pmap_write_protect+0xaa
68	1       c0394305        pmap_do_remove+0x2e5
69	1       c03944b3        pmap_do_remove+0x493
70	1       c0396cdf        lapic_delay+0x5f
71	1       c0396d19        lapic_delay+0x99
72	1       c0396d1d        lapic_delay+0x9d
73	1       c0397429        lapic_clockintr+0x19
74	1       c039b984        x86_mwait+0xc
75	1       c042f66a        _atomic_swap_32+0xa
76
775. tpann.sh is another formatter.  it outputs "objdump -d" with numbers of
78   samples for each addresses.
79
80	# tprof -o /tmp/bar sleep 100
81	# sh ./tpann.sh < /tmp/bar
82
83		:
84		snip
85		:
86
87	c01005e0 <sse2_zero_page>:
88	       4  c01005e0:     55                      push   %ebp
89	      11  c01005e1:     89 e5                   mov    %esp,%ebp
90	       1  c01005e3:     8b 54 24 08             mov    0x8(%esp),%edx
91	       3  c01005e7:     b9 00 10 00 00          mov    $0x1000,%ecx
92	       1  c01005ec:     31 c0                   xor    %eax,%eax
93	       1  c01005ee:     89 f6                   mov    %esi,%esi
94	    7936  c01005f0:     0f c3 42 00             movnti %eax,0x0(%edx)
95	    6371  c01005f4:     0f c3 42 04             movnti %eax,0x4(%edx)
96	    1220  c01005f8:     0f c3 42 08             movnti %eax,0x8(%edx)
97	     741  c01005fc:     0f c3 42 0c             movnti %eax,0xc(%edx)
98	    1178  c0100600:     0f c3 42 10             movnti %eax,0x10(%edx)
99	    1334  c0100604:     0f c3 42 14             movnti %eax,0x14(%edx)
100	     976  c0100608:     0f c3 42 18             movnti %eax,0x18(%edx)
101	    1299  c010060c:     0f c3 42 1c             movnti %eax,0x1c(%edx)
102	     954  c0100610:     83 e9 20                sub    $0x20,%ecx
103	      45  c0100613:     8d 52 20                lea    0x20(%edx),%edx
104	     238  c0100616:     75 d8                   jne    c01005f0 <sse2_zero_page+0x10>
105	      71  c0100618:     0f ae f8                sfence 
106	     297  c010061b:     5d                      pop    %ebp
107	      19  c010061c:     c3                      ret    
108	       0  c010061d:     8d 76 00                lea    0x0(%esi),%esi
109
110		:
111		snip
112		:
113