]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Examples/py_malloc_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_malloc_example.txt
1 The following are examples of py_malloc.d
2
3 This is an experimental script to identify who is calling malloc() for memory 
4 allocation, and to print distribution plots of the requested bytes.  Here you
5 can see it running on Code/Python/func_abc.py
6
7 # py_malloc.d -c ./func_abc.py
8 Tracing... Hit Ctrl-C to end.
9 Function A
10 Function B
11 Function C
12
13 Python malloc byte distributions by engine caller,
14
15    libpython2.4.so.1.0`_PyUnicode_New, total bytes = 2 
16            value  ------------- Distribution ------------- count    
17                1 |                                         0        
18                2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
19                4 |                                         0        
20
21    libpython2.4.so.1.0`find_key, total bytes = 16 
22            value  ------------- Distribution ------------- count    
23                8 |                                         0        
24               16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
25               32 |                                         0        
26
27    libpython2.4.so.1.0`PyInterpreterState_New, total bytes = 36 
28            value  ------------- Distribution ------------- count    
29               16 |                                         0        
30               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
31               64 |                                         0        
32
33    libpython2.4.so.1.0`_PyImport_Init, total bytes = 60 
34            value  ------------- Distribution ------------- count    
35               16 |                                         0        
36               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
37               64 |                                         0        
38
39    libpython2.4.so.1.0`PyThreadState_New, total bytes = 84 
40            value  ------------- Distribution ------------- count    
41               32 |                                         0        
42               64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
43              128 |                                         0        
44
45    libpython2.4.so.1.0`pmerge, total bytes = 132 
46            value  ------------- Distribution ------------- count    
47                2 |                                         0        
48                4 |@@                                       1        
49                8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   16       
50               16 |                                         0        
51
52    libpython2.4.so.1.0`PyThread_allocate_lock, total bytes = 144 
53            value  ------------- Distribution ------------- count    
54               16 |                                         0        
55               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
56               64 |                                         0        
57
58    libpython2.4.so.1.0`convertsimple, total bytes = 210 
59            value  ------------- Distribution ------------- count    
60               16 |                                         0        
61               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
62               64 |                                         0        
63
64    libc.so.1`strdup, total bytes = 451 
65            value  ------------- Distribution ------------- count    
66                1 |                                         0        
67                2 |@@@                                      1        
68                4 |@@@                                      1        
69                8 |                                         0        
70               16 |@@@@@@@@@@@@@@@@@@@@                     8        
71               32 |@@@@@@@@@@@@@@@                          6        
72               64 |                                         0        
73
74    libpython2.4.so.1.0`PyList_New, total bytes = 528 
75            value  ------------- Distribution ------------- count    
76                2 |                                         0        
77                4 |@@@@@@@@@@@@@@@@@@                       22       
78                8 |@@@@@@@@@@@@@@@@@                        21       
79               16 |@@@@@                                    6        
80               32 |                                         0        
81               64 |                                         0        
82              128 |@                                        1        
83              256 |                                         0        
84
85    libpython2.4.so.1.0`PyTokenizer_FromFile, total bytes = 1024 
86            value  ------------- Distribution ------------- count    
87              512 |                                         0        
88             1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
89             2048 |                                         0        
90
91    libpython2.4.so.1.0`_PyExc_Init, total bytes = 1058 
92            value  ------------- Distribution ------------- count    
93                8 |                                         0        
94               16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   40       
95               32 |@@                                       2        
96               64 |                                         0        
97
98    libpython2.4.so.1.0`tok_new, total bytes = 1832 
99            value  ------------- Distribution ------------- count    
100              256 |                                         0        
101              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
102             1024 |                                         0        
103
104    libpython2.4.so.1.0`fill_free_list, total bytes = 1976 
105            value  ------------- Distribution ------------- count    
106              256 |                                         0        
107              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
108             1024 |                                         0        
109
110    libpython2.4.so.1.0`PyParser_New, total bytes = 12024 
111            value  ------------- Distribution ------------- count    
112             2048 |                                         0        
113             4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
114             8192 |                                         0        
115
116    libpython2.4.so.1.0`PyObject_Malloc, total bytes = 35152 
117            value  ------------- Distribution ------------- count    
118              128 |                                         0        
119              256 |@@@@@@@@@@@@@@@@@@@                      20       
120              512 |@@@@@@@                                  7        
121             1024 |@@@@@@@@@@                               11       
122             2048 |@@@@                                     4        
123             4096 |                                         0        
124
125    libpython2.4.so.1.0`PyMem_Malloc, total bytes = 50683 
126            value  ------------- Distribution ------------- count    
127                4 |                                         0        
128                8 |@@@                                      2        
129               16 |@@@@@@@                                  4        
130               32 |@@                                       1        
131               64 |@@@@@@@@@@@@@                            8        
132              128 |@@@@@                                    3        
133              256 |                                         0        
134              512 |                                         0        
135             1024 |                                         0        
136             2048 |                                         0        
137             4096 |                                         0        
138             8192 |@@@@@@@@@@                               6        
139            16384 |                                         0        
140
141    libc.so.1`_findbuf, total bytes = 51800 
142            value  ------------- Distribution ------------- count    
143              256 |                                         0        
144              512 |@@@@@@@@@@@@@@@                          4        
145             1024 |@@@@                                     1        
146             2048 |                                         0        
147             4096 |@@@@@@@                                  2        
148             8192 |@@@@@@@@@@@@@@@                          4        
149            16384 |                                         0        
150
151    libpython2.4.so.1.0`dictresize, total bytes = 178752 
152            value  ------------- Distribution ------------- count    
153               64 |                                         0        
154              128 |@                                        1        
155              256 |@@@@@@@@@@@@@@@@@@@@@                    29       
156              512 |                                         0        
157             1024 |@@@@@@@@@@@@@@                           19       
158             2048 |@                                        1        
159             4096 |@                                        2        
160             8192 |                                         0        
161            16384 |@                                        1        
162            32768 |                                         0        
163            65536 |@                                        1        
164           131072 |                                         0        
165
166    libpython2.4.so.1.0`new_arena, total bytes = 262208 
167            value  ------------- Distribution ------------- count    
168               32 |                                         0        
169               64 |@@@@@@@@@@@@@@@@@@@@                     1        
170              128 |                                         0        
171              256 |                                         0        
172              512 |                                         0        
173             1024 |                                         0        
174             2048 |                                         0        
175             4096 |                                         0        
176             8192 |                                         0        
177            16384 |                                         0        
178            32768 |                                         0        
179            65536 |                                         0        
180           131072 |                                         0        
181           262144 |@@@@@@@@@@@@@@@@@@@@                     1        
182           524288 |                                         0        
183
184
185 Python malloc byte distributions by Python file and function,
186
187    site.py, addsitepackages, bytes total = 4 
188            value  ------------- Distribution ------------- count    
189                2 |                                         0        
190                4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
191                8 |                                         0        
192
193    site.py, abs__file__, bytes total = 60 
194            value  ------------- Distribution ------------- count    
195               16 |                                         0        
196               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
197               64 |                                         0        
198
199    posixpath.py, exists, bytes total = 83 
200            value  ------------- Distribution ------------- count    
201               16 |                                         0        
202               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
203               64 |                                         0        
204
205    stat.py, S_ISDIR, bytes total = 364 
206            value  ------------- Distribution ------------- count    
207              128 |                                         0        
208              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
209              512 |                                         0        
210
211    site.py, _init_pathinfo, bytes total = 380 
212            value  ------------- Distribution ------------- count    
213              128 |                                         0        
214              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
215              512 |                                         0        
216
217    UserDict.py, DictMixin, bytes total = 384 
218            value  ------------- Distribution ------------- count    
219              128 |                                         0        
220              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
221              512 |                                         0        
222
223    codecs.py, StreamReader, bytes total = 384 
224            value  ------------- Distribution ------------- count    
225              128 |                                         0        
226              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
227              512 |                                         0        
228
229    codecs.py, StreamReaderWriter, bytes total = 384 
230            value  ------------- Distribution ------------- count    
231              128 |                                         0        
232              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
233              512 |                                         0        
234
235    codecs.py, StreamRecoder, bytes total = 384 
236            value  ------------- Distribution ------------- count    
237              128 |                                         0        
238              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
239              512 |                                         0        
240
241    codecs.py, StreamWriter, bytes total = 384 
242            value  ------------- Distribution ------------- count    
243              128 |                                         0        
244              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
245              512 |                                         0        
246
247    os.py, _Environ, bytes total = 384 
248            value  ------------- Distribution ------------- count    
249              128 |                                         0        
250              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
251              512 |                                         0        
252
253    site.py, _Printer, bytes total = 384 
254            value  ------------- Distribution ------------- count    
255              128 |                                         0        
256              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
257              512 |                                         0        
258
259    site.py, addsitedir, bytes total = 388 
260            value  ------------- Distribution ------------- count    
261              128 |                                         0        
262              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
263              512 |                                         0        
264
265    linecache.py, ?, bytes total = 396 
266            value  ------------- Distribution ------------- count    
267                4 |                                         0        
268                8 |@@@@@@@@@@@@@@@@@@@@                     1        
269               16 |                                         0        
270               32 |                                         0        
271               64 |                                         0        
272              128 |                                         0        
273              256 |@@@@@@@@@@@@@@@@@@@@                     1        
274              512 |                                         0        
275
276    posixpath.py, isdir, bytes total = 608 
277            value  ------------- Distribution ------------- count    
278                1 |                                         0        
279                2 |@@@@@@@                                  2        
280                4 |                                         0        
281                8 |                                         0        
282               16 |@@@@@@@@@@@@@@@@@@@@@@@                  7        
283               32 |@@@@@@@                                  2        
284               64 |                                         0        
285              128 |                                         0        
286              256 |@@@                                      1        
287              512 |                                         0        
288
289    os.py, _get_exports_list, bytes total = 612 
290            value  ------------- Distribution ------------- count    
291              256 |                                         0        
292              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
293             1024 |                                         0        
294
295    posixpath.py, abspath, bytes total = 728 
296            value  ------------- Distribution ------------- count    
297              128 |                                         0        
298              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
299              512 |                                         0        
300
301    site.py, execsitecustomize, bytes total = 790 
302            value  ------------- Distribution ------------- count    
303               16 |                                         0        
304               32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     9        
305               64 |                                         0        
306              128 |                                         0        
307              256 |@@@@                                     1        
308              512 |                                         0        
309
310    UserDict.py, UserDict, bytes total = 1920 
311            value  ------------- Distribution ------------- count    
312              128 |                                         0        
313              256 |@@@@@@@@@@@@@@@@@@@@                     1        
314              512 |                                         0        
315             1024 |@@@@@@@@@@@@@@@@@@@@                     1        
316             2048 |                                         0        
317
318    stat.py, ?, bytes total = 1920 
319            value  ------------- Distribution ------------- count    
320              128 |                                         0        
321              256 |@@@@@@@@@@@@@@@@@@@@                     1        
322              512 |                                         0        
323             1024 |@@@@@@@@@@@@@@@@@@@@                     1        
324             2048 |                                         0        
325
326    types.py, ?, bytes total = 2680 
327            value  ------------- Distribution ------------- count    
328                2 |                                         0        
329                4 |@@@@@@                                   1        
330                8 |@@@@@@@@@@@                              2        
331               16 |                                         0        
332               32 |                                         0        
333               64 |                                         0        
334              128 |                                         0        
335              256 |@@@@@@@@@@@@@@@@@                        3        
336              512 |                                         0        
337             1024 |@@@@@@                                   1        
338             2048 |                                         0        
339
340    posixpath.py, ?, bytes total = 3306 
341            value  ------------- Distribution ------------- count    
342                8 |                                         0        
343               16 |@@@@@@@@@@@@@@@@                         2        
344               32 |                                         0        
345               64 |                                         0        
346              128 |                                         0        
347              256 |@@@@@@@@@@@@@@@@                         2        
348              512 |                                         0        
349             1024 |                                         0        
350             2048 |@@@@@@@@                                 1        
351             4096 |                                         0        
352
353    copy_reg.py, ?, bytes total = 3547 
354            value  ------------- Distribution ------------- count    
355                8 |                                         0        
356               16 |@@@@@@@@@@@@@@@@                         2        
357               32 |                                         0        
358               64 |                                         0        
359              128 |                                         0        
360              256 |@@@@@@@@                                 1        
361              512 |@@@@@@@@                                 1        
362             1024 |                                         0        
363             2048 |@@@@@@@@                                 1        
364             4096 |                                         0        
365
366    warnings.py, ?, bytes total = 3924 
367            value  ------------- Distribution ------------- count    
368                8 |                                         0        
369               16 |@@@@@@@@                                 1        
370               32 |@@@@@@@@                                 1        
371               64 |                                         0        
372              128 |                                         0        
373              256 |@@@@@@@@@@@@@@@@                         2        
374              512 |                                         0        
375             1024 |                                         0        
376             2048 |@@@@@@@@                                 1        
377             4096 |                                         0        
378
379    func_abc.py, func_a, bytes total = 5100 
380            value  ------------- Distribution ------------- count    
381              256 |                                         0        
382              512 |@@@@@@@@@@@@@@@@@@@@                     1        
383             1024 |                                         0        
384             2048 |                                         0        
385             4096 |@@@@@@@@@@@@@@@@@@@@                     1        
386             8192 |                                         0        
387
388    codecs.py, ?, bytes total = 5612 
389            value  ------------- Distribution ------------- count    
390               32 |                                         0        
391               64 |@@@@@@                                   1        
392              128 |@@@@@@                                   1        
393              256 |@@@@@@@@@@@                              2        
394              512 |                                         0        
395             1024 |@@@@@@@@@@@@@@@@@                        3        
396             2048 |                                         0        
397
398    aliases.py, ?, bytes total = 8064 
399            value  ------------- Distribution ------------- count    
400              128 |                                         0        
401              256 |@@@@@@@@@@@@@                            1        
402              512 |                                         0        
403             1024 |@@@@@@@@@@@@@                            1        
404             2048 |                                         0        
405             4096 |@@@@@@@@@@@@@                            1        
406             8192 |                                         0        
407
408    func_abc.py, ?, bytes total = 16105 
409            value  ------------- Distribution ------------- count    
410                2 |                                         0        
411                4 |@@                                       1        
412                8 |@@@@@                                    2        
413               16 |@@@@@@@@@                                4        
414               32 |@@@@@                                    2        
415               64 |                                         0        
416              128 |@@                                       1        
417              256 |@@@@@@@                                  3        
418              512 |@@                                       1        
419             1024 |@@@@@                                    2        
420             2048 |                                         0        
421             4096 |                                         0        
422             8192 |@@                                       1        
423            16384 |                                         0        
424
425    os.py, ?, bytes total = 58957 
426            value  ------------- Distribution ------------- count    
427                2 |                                         0        
428                4 |@@                                       3        
429                8 |@@@@@                                    6        
430               16 |@                                        1        
431               32 |@@                                       2        
432               64 |                                         0        
433              128 |@                                        1        
434              256 |@@@@@@@@@@@@@@@@@@                       23       
435              512 |@@                                       3        
436             1024 |@@@@@                                    7        
437             2048 |                                         0        
438             4096 |@@@                                      4        
439             8192 |@                                        1        
440            16384 |                                         0        
441
442    site.py, ?, bytes total = 62589 
443            value  ------------- Distribution ------------- count    
444                8 |                                         0        
445               16 |@@@                                      2        
446               32 |                                         0        
447               64 |                                         0        
448              128 |                                         0        
449              256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@            20       
450              512 |@                                        1        
451             1024 |@@@                                      2        
452             2048 |@                                        1        
453             4096 |                                         0        
454             8192 |                                         0        
455            16384 |@@@                                      2        
456            32768 |                                         0        
457
458    __init__.py, ?, bytes total = 62593 
459            value  ------------- Distribution ------------- count    
460                0 |                                         0        
461                1 |@@                                       1        
462                2 |                                         0        
463                4 |                                         0        
464                8 |                                         0        
465               16 |@@@                                      2        
466               32 |@@                                       1        
467               64 |                                         0        
468              128 |                                         0        
469              256 |@@@@@@@@@@@                              7        
470              512 |@@@@@@@@@@@@@@@@                         10       
471             1024 |@@@                                      2        
472             2048 |                                         0        
473             4096 |                                         0        
474             8192 |                                         0        
475            16384 |@@@                                      2        
476            32768 |                                         0        
477
478    posixpath.py, join, bytes total = 262144 
479            value  ------------- Distribution ------------- count    
480           131072 |                                         0        
481           262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
482           524288 |                                         0        
483
484    os.py, _exists, bytes total = 362768 
485            value  ------------- Distribution ------------- count    
486                2 |                                         0        
487                4 |@                                        10       
488                8 |@                                        10       
489               16 |@@                                       20       
490               32 |                                         0        
491               64 |                                         0        
492              128 |                                         0        
493              256 |@                                        7        
494              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@       447      
495             1024 |@@                                       20       
496             2048 |                                         0        
497             4096 |@                                        10       
498             8192 |                                         0        
499
500
501 The results are divided into two sections.  If a malloc() occurred while in a
502 Python function, then that function is identified as responsible; and the
503 results will appear in the second section - Python malloc byte distributions
504 by Python file and function.
505
506 Otherwise the caller of malloc() is identified as responsible - which will be
507 a function from the Python engine, and these are noted in the first section -
508 Python malloc byte distributions by engine caller.