]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Examples/py_cputime_example.txt
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Examples / py_cputime_example.txt
1 The following are examples of py_cputime.d.
2
3 This script traces the on-CPU time of JavaScript functions and prints a
4 report. Here it traces the example program, Code/Python/func_slow.py
5
6 # py_cputime.d
7 Tracing... Hit Ctrl-C to end.
8 ^C
9
10 Count,
11    FILE                 TYPE       NAME                                COUNT
12    UserDict.py          func       ?                                       1
13    UserDict.py          func       DictMixin                               1
14    UserDict.py          func       IterableUserDict                        1
15    UserDict.py          func       UserDict                                1
16    UserDict.py          func       __init__                                1
17    __init__.py          func       ?                                       1
18    __init__.py          func       CodecRegistryError                      1
19    __init__.py          func       normalize_encoding                      1
20    __init__.py          func       search_function                         1
21    aliases.py           func       ?                                       1
22    ascii.py             func       ?                                       1
23    ascii.py             func       Codec                                   1
24    ascii.py             func       StreamConverter                         1
25    ascii.py             func       StreamReader                            1
26    ascii.py             func       StreamWriter                            1
27    ascii.py             func       getregentry                             1
28    codecs.py            func       ?                                       1
29    codecs.py            func       Codec                                   1
30    codecs.py            func       StreamReader                            1
31    codecs.py            func       StreamReaderWriter                      1
32    codecs.py            func       StreamRecoder                           1
33    codecs.py            func       StreamWriter                            1
34    copy_reg.py          func       ?                                       1
35    func_slow.py         func       ?                                       1
36    func_slow.py         func       func_a                                  1
37    func_slow.py         func       func_b                                  1
38    func_slow.py         func       func_c                                  1
39    linecache.py         func       ?                                       1
40    os.py                func       ?                                       1
41    os.py                func       _Environ                                1
42    os.py                func       __init__                                1
43    os.py                func       _get_exports_list                       1
44    posixpath.py         func       ?                                       1
45    posixpath.py         func       basename                                1
46    posixpath.py         func       dirname                                 1
47    site.py              func       ?                                       1
48    site.py              func       _Helper                                 1
49    site.py              func       _Printer                                1
50    site.py              func       _init_pathinfo                          1
51    site.py              func       abs__file__                             1
52    site.py              func       addsitepackages                         1
53    site.py              func       aliasmbcs                               1
54    site.py              func       execsitecustomize                       1
55    site.py              func       main                                    1
56    site.py              func       removeduppaths                          1
57    site.py              func       setcopyright                            1
58    site.py              func       setencoding                             1
59    site.py              func       sethelper                               1
60    site.py              func       setquit                                 1
61    stat.py              func       ?                                       1
62    types.py             func       ?                                       1
63    types.py             func       _C                                      1
64    warnings.py          func       ?                                       1
65    warnings.py          func       _OptionError                            1
66    warnings.py          func       _processoptions                         1
67    posixpath.py         func       exists                                  2
68    posixpath.py         func       split                                   2
69    site.py              func       addsitedir                              2
70    warnings.py          func       simplefilter                            2
71    copy_reg.py          func       constructor                             3
72    copy_reg.py          func       pickle                                  3
73    site.py              func       __init__                                3
74    site.py              func       addpackage                              3
75    stat.py              func       S_IFMT                                  6
76    stat.py              func       S_ISDIR                                 6
77    posixpath.py         func       isdir                                   8
78    os.py                func       _exists                                10
79    <string>             func       ?                                      11
80    posixpath.py         func       normcase                               14
81    site.py              func       makepath                               14
82    posixpath.py         func       join                                   20
83    posixpath.py         func       abspath                                22
84    posixpath.py         func       isabs                                  22
85    posixpath.py         func       normpath                               22
86    -                    total      -                                     230
87
88 Exclusive function on-CPU times (us),
89    FILE                 TYPE       NAME                                TOTAL
90    ascii.py             func       StreamWriter                            1
91    __init__.py          func       CodecRegistryError                      1
92    ascii.py             func       StreamReader                            1
93    site.py              func       setencoding                             1
94    warnings.py          func       _OptionError                            1
95    UserDict.py          func       IterableUserDict                        1
96    site.py              func       aliasmbcs                               1
97    warnings.py          func       _processoptions                         1
98    types.py             func       _C                                      1
99    ascii.py             func       getregentry                             1
100    site.py              func       _Helper                                 2
101    ascii.py             func       Codec                                   2
102    ascii.py             func       StreamConverter                         2
103    site.py              func       sethelper                               2
104    codecs.py            func       Codec                                   2
105    UserDict.py          func       __init__                                3
106    posixpath.py         func       dirname                                 3
107    posixpath.py         func       basename                                3
108    site.py              func       _Printer                                3
109    os.py                func       _Environ                                3
110    codecs.py            func       StreamWriter                            3
111    site.py              func       setquit                                 3
112    copy_reg.py          func       constructor                             3
113    codecs.py            func       StreamRecoder                           4
114    codecs.py            func       StreamReaderWriter                      5
115    codecs.py            func       StreamReader                            5
116    os.py                func       __init__                                6
117    func_slow.py         func       ?                                       6
118    __init__.py          func       normalize_encoding                      7
119    site.py              func       __init__                                7
120    linecache.py         func       ?                                       7
121    warnings.py          func       simplefilter                            7
122    stat.py              func       S_IFMT                                  9
123    stat.py              func       ?                                      10
124    copy_reg.py          func       pickle                                 12
125    posixpath.py         func       split                                  12
126    posixpath.py         func       normcase                               15
127    stat.py              func       S_ISDIR                                17
128    site.py              func       addsitepackages                        20
129    UserDict.py          func       ?                                      20
130    site.py              func       setcopyright                           23
131    site.py              func       main                                   24
132    <string>             func       ?                                      28
133    UserDict.py          func       UserDict                               31
134    site.py              func       _init_pathinfo                         33
135    posixpath.py         func       exists                                 35
136    ascii.py             func       ?                                      38
137    posixpath.py         func       isabs                                  42
138    aliases.py           func       ?                                      43
139    site.py              func       removeduppaths                         51
140    site.py              func       abs__file__                            56
141    codecs.py            func       ?                                      75
142    types.py             func       ?                                      83
143    posixpath.py         func       join                                   85
144    site.py              func       makepath                               97
145    posixpath.py         func       abspath                                99
146    os.py                func       _get_exports_list                     132
147    __init__.py          func       search_function                       142
148    warnings.py          func       ?                                     171
149    UserDict.py          func       DictMixin                             182
150    posixpath.py         func       ?                                     192
151    copy_reg.py          func       ?                                     196
152    posixpath.py         func       normpath                              209
153    posixpath.py         func       isdir                                 255
154    site.py              func       addpackage                            375
155    site.py              func       addsitedir                            506
156    site.py              func       execsitecustomize                     540
157    site.py              func       ?                                     725
158    os.py                func       _exists                               802
159    os.py                func       ?                                    1138
160    __init__.py          func       ?                                    1199
161    func_slow.py         func       func_a                             229669
162    func_slow.py         func       func_b                             456371
163    func_slow.py         func       func_c                             686056
164    -                    total      -                                 1379951
165
166 Inclusive function on-CPU times (us),
167    FILE                 TYPE       NAME                                TOTAL
168    ascii.py             func       StreamWriter                            1
169    __init__.py          func       CodecRegistryError                      1
170    ascii.py             func       StreamReader                            1
171    site.py              func       setencoding                             1
172    warnings.py          func       _OptionError                            1
173    UserDict.py          func       IterableUserDict                        1
174    site.py              func       aliasmbcs                               1
175    warnings.py          func       _processoptions                         1
176    types.py             func       _C                                      1
177    ascii.py             func       getregentry                             1
178    site.py              func       _Helper                                 2
179    ascii.py             func       Codec                                   2
180    ascii.py             func       StreamConverter                         2
181    site.py              func       sethelper                               2
182    codecs.py            func       Codec                                   2
183    UserDict.py          func       __init__                                3
184    site.py              func       _Printer                                3
185    os.py                func       _Environ                                3
186    codecs.py            func       StreamWriter                            3
187    site.py              func       setquit                                 3
188    copy_reg.py          func       constructor                             3
189    codecs.py            func       StreamRecoder                           4
190    codecs.py            func       StreamReaderWriter                      5
191    codecs.py            func       StreamReader                            5
192    __init__.py          func       normalize_encoding                      7
193    site.py              func       __init__                                7
194    linecache.py         func       ?                                       7
195    warnings.py          func       simplefilter                            7
196    stat.py              func       S_IFMT                                  9
197    os.py                func       __init__                                9
198    posixpath.py         func       basename                                9
199    posixpath.py         func       dirname                                10
200    stat.py              func       ?                                      10
201    posixpath.py         func       split                                  12
202    posixpath.py         func       normcase                               15
203    copy_reg.py          func       pickle                                 15
204    stat.py              func       S_ISDIR                                26
205    UserDict.py          func       UserDict                               31
206    posixpath.py         func       exists                                 35
207    posixpath.py         func       isabs                                  42
208    aliases.py           func       ?                                      43
209    site.py              func       setcopyright                           44
210    ascii.py             func       ?                                      45
211    types.py             func       ?                                      85
212    posixpath.py         func       join                                   85
213    codecs.py            func       ?                                      97
214    os.py                func       _get_exports_list                     132
215    site.py              func       removeduppaths                        171
216    UserDict.py          func       DictMixin                             182
217    site.py              func       abs__file__                           184
218    warnings.py          func       ?                                     190
219    __init__.py          func       search_function                       196
220    posixpath.py         func       ?                                     202
221    posixpath.py         func       normpath                              209
222    UserDict.py          func       ?                                     235
223    posixpath.py         func       isdir                                 281
224    copy_reg.py          func       ?                                     288
225    posixpath.py         func       abspath                               351
226    site.py              func       _init_pathinfo                        392
227    site.py              func       makepath                              395
228    site.py              func       execsitecustomize                     540
229    os.py                func       _exists                               819
230    <string>             func       ?                                     973
231    __init__.py          func       ?                                    1341
232    site.py              func       addpackage                           1470
233    site.py              func       addsitepackages                      1562
234    site.py              func       addsitedir                           2420
235    site.py              func       main                                 2546
236    os.py                func       ?                                    2839
237    site.py              func       ?                                    6118
238    func_slow.py         func       func_c                             686056
239    func_slow.py         func       func_b                            1142427
240    func_slow.py         func       func_a                            1372097
241    func_slow.py         func       ?                                 1372104
242
243 You can see the results are printed in three sections.
244
245 The first section reports how many times each function was called.
246
247 The exclusive function on-CPU times shows, amongst other results that func_a
248 spent around 0.22 seconds on-CPU.  This times excludes time spent in
249 other functions.
250
251 The inclusive function on-CPU times show that func_a spent around 1.4
252 seconds on-CPU.  This includes the time spent in other functions called.
253
254 These on-CPU times are the time the thread spent running on a CPU, from when
255 the subroutine began to when it completed. This does not include time
256 spent off-CPU time such as sleeping for I/O or waiting for scheduling.
257
258 On-CPU times are useful for showing who is causing the CPUs to be busy.
259 See Notes/ALLoncpu_notes.txt for more details. Also see
260 Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a
261 detailed explanation of exclusive vs inclusive subroutine time.
262