add a few funccount examples
authorBrendan Gregg <brendan.d.gregg@gmail.com>
Wed, 11 Jan 2017 01:36:07 +0000 (17:36 -0800)
committerBrendan Gregg <brendan.d.gregg@gmail.com>
Wed, 11 Jan 2017 01:36:07 +0000 (17:36 -0800)
tools/funccount.py
tools/funccount_example.txt

index 66aa011..2fd683a 100755 (executable)
@@ -43,6 +43,7 @@ class Probe(object):
 
             func            -- probe a kernel function
             lib:func        -- probe a user-space function in the library 'lib'
+            /path:func      -- probe a user-space function in binary '/path'
             p::func         -- same thing as 'func'
             p:lib:func      -- same thing as 'lib:func'
             t:cat:event     -- probe a kernel tracepoint
@@ -219,8 +220,11 @@ class Tool(object):
     ./funccount -Ti 5 'vfs_*'       # output every 5 seconds, with timestamps
     ./funccount -p 185 'vfs_*'      # count vfs calls for PID 181 only
     ./funccount t:sched:sched_fork  # count calls to the sched_fork tracepoint
-    ./funccount -p 185 u:node:gc*   # count all GC USDT probes in node
+    ./funccount -p 185 u:node:gc*   # count all GC USDT probes in node, PID 185
     ./funccount c:malloc            # count all malloc() calls in libc
+    ./funccount go:os.*             # count all "os.*" calls in libgo
+    ./funccount -p 185 go:os.*      # count all "os.*" calls in libgo, PID 185
+    ./funccount ./test:read*        # count "read*" calls in the ./test binary
     """
         parser = argparse.ArgumentParser(
             description="Count functions, tracepoints, and USDT probes",
index 9b090c5..16efe1b 100644 (file)
@@ -169,7 +169,7 @@ Ctrl-C has been hit.
 User functions can be traced in executables or libraries, and per-process
 filtering is allowed:
 
-# ./funccount -p 1442 contentions:*
+# ./funccount -p 1442 /home/ubuntu/contentions:*
 Tracing 15 functions for "/home/ubuntu/contentions:*"... Hit Ctrl-C to end.
 ^C
 FUNC                                           COUNT
@@ -180,6 +180,10 @@ insert_result                                  87186
 is_prime                                     1252772
 Detaching...
 
+If /home/ubuntu is in the $PATH, then the following command will also work:
+
+# ./funccount -p 1442 contentions:*
+
 
 Counting libc write and read calls using regular expression syntax (-r):
 
@@ -314,6 +318,8 @@ examples:
     ./funccount -Ti 5 'vfs_*'       # output every 5 seconds, with timestamps
     ./funccount -p 185 'vfs_*'      # count vfs calls for PID 181 only
     ./funccount t:sched:sched_fork  # count calls to the sched_fork tracepoint
-    ./funccount -p 185 u:node:gc*   # count all GC USDT probes in node
+    ./funccount -p 185 u:node:gc*   # count all GC USDT probes in node, PID 185
     ./funccount c:malloc            # count all malloc() calls in libc
+    ./funccount go:os.*             # count all "os.*" calls in libgo
+    ./funccount -p 185 go:os.*      # count all "os.*" calls in libgo, PID 185
+    ./funccount ./test:read*        # count "read*" calls in the ./test binary