]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Examples/pl_malloc_example.txt
MFC r368207,368607:
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Examples / pl_malloc_example.txt
1 The following are examples of pl_malloc.d.
2
3 This is an expiremental script that attepmts to identify who is calling
4 malloc() from Perl, and to print byte distribution plots.
5
6 Here it traces the example program, Code/Perl/func_malloc.pl.
7
8 # pl_malloc.d -c ./func_malloc.pl
9 Function A
10 Function B
11 Function C
12 Tracing... Hit Ctrl-C to end.
13
14 Perl malloc byte distributions by engine caller,
15
16    perl`perl_alloc, total bytes = 1 
17            value  ------------- Distribution ------------- count    
18                0 |                                         0        
19                1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
20                2 |                                         0        
21
22    libc.so.1`_findbuf, total bytes = 520 
23            value  ------------- Distribution ------------- count    
24              256 |                                         0        
25              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
26             1024 |                                         0        
27
28    perl`Perl_safesysmalloc, total bytes = 72106 
29            value  ------------- Distribution ------------- count    
30                1 |                                         0        
31                2 |@@                                       26       
32                4 |@@@@@                                    72       
33                8 |@@@@@@                                   101      
34               16 |@@@@@@@@@@@@@@                           216      
35               32 |@@@@@@@@@@@                              178      
36               64 |@                                        21       
37              128 |                                         6        
38              256 |                                         2        
39              512 |                                         4        
40             1024 |                                         1        
41             2048 |@                                        11       
42             4096 |                                         1        
43             8192 |                                         0        
44
45
46 Perl malloc byte distributions by Perl file and subroutine,
47
48    func_malloc.pl, func_a, bytes total = 42504 
49            value  ------------- Distribution ------------- count    
50            16384 |                                         0        
51            32768 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
52            65536 |                                         0        
53
54    func_malloc.pl, func_b, bytes total = 100008 
55            value  ------------- Distribution ------------- count    
56                2 |                                         0        
57                4 |@@@@@@@@@@@@@@@@@@@@                     1        
58                8 |                                         0        
59               16 |                                         0        
60               32 |                                         0        
61               64 |                                         0        
62              128 |                                         0        
63              256 |                                         0        
64              512 |                                         0        
65             1024 |                                         0        
66             2048 |                                         0        
67             4096 |                                         0        
68             8192 |                                         0        
69            16384 |                                         0        
70            32768 |                                         0        
71            65536 |@@@@@@@@@@@@@@@@@@@@                     1        
72           131072 |                                         0        
73
74 The func_malloc.pl program allocated around 100 Kbytes by creating a 
75 variable ($b) and populating it with 100,000 "b" characters. This has been
76 identified in the last distribution plot printed, with one malloc event
77 of between 64 Kbytes and 128 Kbytes in size. There was also a malloc event
78 of between 4 and 7 bytes in size.
79