• Brenden Blanco's avatar
    Add uprobe strlen histogram example · 7adab964
    Brenden Blanco authored
    This example traces all calls to libc's strlen(). The program is attached as a
    retprobe, therefore giving access to the resulting string length. The value is
    kept in a log2 histogram that is printed to console once per second.
    
    Example:
    ```
    $ sudo ./strlen_hist.py
    22:12:51
         strlen return:      : count     distribution
             0 -> 1          : 2041     |****************                        |
             2 -> 3          : 1120     |********                                |
             4 -> 7          : 3300     |**************************              |
             8 -> 15         : 4995     |****************************************|
            16 -> 31         : 2130     |*****************                       |
            32 -> 63         : 562      |****                                    |
    ^C
    ```
    Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
    7adab964
strlen_hist.py 1.81 KB