]> sourceware.org Git - systemtap.git/commitdiff
PR23285 (2): enable prometheus-exporter type scripts on stapbpf
authorSagar Patel <sapatel@redhat.com>
Thu, 29 Aug 2019 15:40:21 +0000 (11:40 -0400)
committerSagar Patel <sapatel@redhat.com>
Tue, 3 Sep 2019 16:49:14 +0000 (12:49 -0400)
The eBPF backend now supports prometheus-exporter scripts. This implementation
introduces character escaping macros enabling the array dump macros on stapbpf.
However, there are some issues with foreach loops which are used in the macros
(PR24953).

1) Developed character escaping macros helper functions.
2) Added prometheus probe tapset for stapbpf.
3) Added stapbpf procfs file path to stap-exporter.
4) Introduced a sample stapbpf prometheus-exporter script in EXAMPLES.
5) Updated NEWS.

16 files changed:
NEWS
bpf-internal.h
stap-exporter/default/EXAMPLE-BPF [new file with mode: 0755]
stap-exporter/default/syscallsrw.stp [new symlink]
stap-exporter/stap-exporter.in
stapbpf/bpfinterp.cxx
stapbpf/stapbpf.cxx
tapset/prometheus.stp
tapset/string.stp
testsuite/systemtap.examples/index.html
testsuite/systemtap.examples/index.txt
testsuite/systemtap.examples/keyword-index.html
testsuite/systemtap.examples/keyword-index.txt
testsuite/systemtap.examples/metadatabase.db
testsuite/systemtap.examples/profiling/syscallsrw.meta [new file with mode: 0644]
testsuite/systemtap.examples/profiling/syscallsrw.stp [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index d2115bc39f5fc18b2a6aeb11c6d83c037eb95d23..1177c83626f66a2f5e50145032615bcc69dd7a9e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 * What's new in version 4.2, PRERELEASE
 
+- The stapbpf backend now supports stap-exporter extensions. 
+
 - The stapbpf backend now supports procfs probes. The implementation 
   uses FIFO special files in /var/tmp/systemtap-$EFFUSER/MODNAME instead 
   of the proc filesystem files.
index a3d0c381f73e997c0b3230e34e795fad8a707973..db8ede7f18d8c913a6104c4a78f550bc619ea012 100644 (file)
@@ -180,7 +180,9 @@ const opcode BPF_LD_MAP = BPF_LD | BPF_IMM | BPF_DW | (BPF_PSEUDO_MAP_FD << 8);
   FN(set_procfs_value),           \
   FN(append_procfs_value),        \
   FN(get_procfs_value),           \
-  FN(str_concat),                 
+  FN(str_concat),                 \
+  FN(text_str),                   \
+  FN(string_quoted),
  
 const bpf_func_id BPF_FUNC_map_get_next_key    = (bpf_func_id) -1;
 const bpf_func_id BPF_FUNC_sprintf             = (bpf_func_id) -2;
@@ -191,6 +193,8 @@ const bpf_func_id BPF_FUNC_set_procfs_value    = (bpf_func_id) -6;
 const bpf_func_id BPF_FUNC_append_procfs_value = (bpf_func_id) -7;
 const bpf_func_id BPF_FUNC_get_procfs_value    = (bpf_func_id) -8;
 const bpf_func_id BPF_FUNC_str_concat          = (bpf_func_id) -9;
+const bpf_func_id BPF_FUNC_text_str            = (bpf_func_id) -10;
+const bpf_func_id BPF_FUNC_string_quoted       = (bpf_func_id) -11;
 
 struct insn
 {
diff --git a/stap-exporter/default/EXAMPLE-BPF b/stap-exporter/default/EXAMPLE-BPF
new file mode 100755 (executable)
index 0000000..c8f1798
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+# link to this generic shell script to invoke a non-guru stap example
+exec stap --bpf -v --example $@ `basename $0 | sed -e s,autostart-,,`
diff --git a/stap-exporter/default/syscallsrw.stp b/stap-exporter/default/syscallsrw.stp
new file mode 120000 (symlink)
index 0000000..3a16617
--- /dev/null
@@ -0,0 +1 @@
+EXAMPLE-BPF
\ No newline at end of file
index 8d07a80bf78dbf4bd45fc7a7d6d89a12f98d11df..e35d18acb8d3298707c0a584763e67fbaf67bb5b 100644 (file)
@@ -31,9 +31,9 @@ from time import time
 
 script_dir = "%sysconfdir%/stap-exporter"
 proc_basename = "__stap_exporter_" + str(os.getpid()) # permit concurrent exporters
-proc_path = "/proc/systemtap"
 sessmgr = None
-
+proc_path_lkm = "/proc/systemtap"
+proc_path_bpf = "/var/tmp/systemtap-root"
 
 class Session:
     """Represent a single systemtap script found $script_dir, whether or not
@@ -91,9 +91,21 @@ class Session:
         if self.keepalive is not None:
             self.killafter = time() + self.keepalive
 
-        path = proc_path + "/" + self.proc_subdirname + "/__prometheus"
-        with open(path) as metrics:
-            return bytes(metrics.read(), 'utf-8')
+        path_lkm = proc_path_lkm + "/" + self.proc_subdirname + "/__prometheus"
+        path_bpf = proc_path_bpf + "/" + self.proc_subdirname + "/__prometheus"
+
+        try:
+            with open(path_lkm) as metrics:
+                return bytes(metrics.read(), 'utf-8')
+        except FileNotFoundError:
+            pass
+
+        try:
+            with open(path_bpf) as metrics:
+                return bytes(metrics.read(), 'utf-8')
+        except FileNotFoundError:
+            raise Exception("[Error] Unable to find procfs files under search paths. "
+                             "Try again once the script has created the procfs files.")
 
 class SessionMgr:
     """Represent the set of possible systemtap scripts that can be exported.  Searches the $script_dir
@@ -179,6 +191,8 @@ if __name__ == "__main__":
     httpd.timeout = 5 # parametrize?
     
     print("listening on port %d" % port)
+    print("procfs files will be searched under: %s and %s" % (proc_path_lkm, proc_path_bpf)) 
+
     try:
         while True:
             sessmgr.poll()
index 9298b1a2f1683df956d4b161146a89b7a8b39ac3..ffdbdd108d4c06202799943cca06219ea8f409ec 100644 (file)
@@ -397,6 +397,48 @@ bpf_sprintf(std::vector<std::string> &strings, char *fstr,
   return reinterpret_cast<uint64_t>(strings.back().c_str());
 }
 
+uint64_t
+bpf_text_str(std::vector<std::string> &strings, char* input, bool quoted)
+{
+  std::string str(input);
+  std::stringstream stream;
+
+  for (std::string::iterator it = str.begin(); it != str.end(); ++it)
+    {
+      unsigned char c = *it;
+      unsigned int i = c;
+
+      if (std::isprint(c) && i < 128 && c != '\\' && c != '"')
+        stream << c;
+      else 
+        {
+          stream << '\\';
+          switch (c) {
+            case '\0': stream << '0'; break; // Not handled by translate_escapes
+            case '\a': stream << 'a'; break; // Not handled by translate_escapes
+            case '\b': stream << 'b'; break; // Not handled by translate_escapes
+            case '\f': stream << 'f'; break;
+            case '\n': stream << 'n'; break;
+            case '\r': stream << 'r'; break;
+            case '\t': stream << 't'; break;
+            case '\v': stream << 'v'; break;
+            case '"': stream << '"'; break;
+            case '\\': stream << '\\'; break;
+            default: 
+              stream << "x" << std::setfill('0') << std::setw(2) << std::hex << i;
+              break;
+          }
+        }
+    } 
+
+  if (quoted)
+    strings.push_back("\"" + stream.str() + "\"");
+  else  
+    strings.push_back(stream.str());
+
+  return reinterpret_cast<uint64_t>(strings.back().c_str());
+}
+
 uint64_t
 bpf_str_concat(std::vector<std::string> &strings, char* left, char* right)
 {
@@ -937,6 +979,12 @@ bpf_interpret(size_t ninsns, const struct bpf_insn insns[],
               dr = bpf_sprintf(strings, as_str(regs[1]),
                                regs[3], regs[4], regs[5]);
               break;
+            case bpf::BPF_FUNC_text_str:
+              dr = bpf_text_str(strings, as_str(regs[1]), false);
+              break;
+            case bpf::BPF_FUNC_string_quoted:
+              dr = bpf_text_str(strings, as_str(regs[1]), true);
+              break;
             case bpf::BPF_FUNC_str_concat:
               dr = bpf_str_concat(strings, as_str(regs[1]), 
                                   as_str(regs[2]));
@@ -953,7 +1001,7 @@ bpf_interpret(size_t ninsns, const struct bpf_insn insns[],
             case bpf::BPF_FUNC_gettimeofday_ns:
               dr = bpf_gettimeofday_ns();
               break;
-           case bpf::BPF_FUNC_get_target:
+            case bpf::BPF_FUNC_get_target:
               dr = bpf_get_target();
               break;
             case bpf::BPF_FUNC_set_procfs_value:
index 74f9f61cf5e4fc710c5281cbea1b1eb450d4904f..9b8037ec261667423bbcc519b546a7ba420131d7 100644 (file)
@@ -1861,8 +1861,9 @@ procfs_read_event_loop (procfsprobe_data* data, bpf_transport_context* uctx)
       // Run the probe and collect the message.
       bpf_interpret(prog->d_size / sizeof(bpf_insn), static_cast<bpf_insn *>(prog->d_buf), uctx);
 
-      // Make a copy of the message.
+      // Make a copy of the message and reset it.
       std::string msg = uctx->procfs_msg;
+      uctx->procfs_msg.clear();
 
       procfs_lock.unlock();
 
index cb12ceec060cbc1686ac47f803a7652ec1cc3da6..170ca3687a111608b6f263bae20d0300f2f6681c 100644 (file)
@@ -1 +1,7 @@
-probe prometheus = procfs("__prometheus").read.maxsize(0x10000) { }
+probe prometheus =
+%( runtime != "bpf" %?
+  procfs("__prometheus").read.maxsize(0x10000)
+%:
+  procfs("__prometheus").read
+%)
+{ }
index f9792ea7394d9fa53c452824003173943a5e33f2..df2c7a708b8c11736643bfba1080bacf74271c12 100644 (file)
@@ -100,12 +100,20 @@ function strpos:long(s1:string,s2:string)
  * printable are replaced by the corresponding escape sequence in the
  * returned string.
  */
-function text_str:string(input:string) 
-%{ /* pure */ /* unprivileged */ /* unmodified-fnargs */
-       if (_stp_text_str(STAP_RETVALUE, STAP_ARG_input, 0, 0, 0, 0, 0) < 0) {
-               STAP_RETVALUE[0] = '\0';
-       }
-%}
+function text_str:string(input:string)
+%( runtime != "bpf" %? 
+  %{ /* pure */ /* unprivileged */ /* unmodified-fnargs */
+         if (_stp_text_str(STAP_RETVALUE, STAP_ARG_input, 0, 0, 0, 0, 0) < 0) {
+                 STAP_RETVALUE[0] = '\0';
+         }
+  %}
+%:
+  %{  /* bpf */
+      0xbf, 1, $input, -, -;  /* mov r1, $input */
+      0x85, 0, 0, 0, -10;     /* call BPF_FUNC_TEXT_STR */
+      0xbf, $$, 0, -, -;      /* return r0 */
+  %}
+%)
 
 /**
  * sfunction text_strn - Escape any non-printable chars in a string
@@ -203,9 +211,17 @@ function isdigit:long(str:string)
  * string. Note that the string will be surrounded by double quotes.
  */
 function string_quoted:string (str:string)
-%{ /* pure */ /* unmodified-fnargs */
-  /* This can't fail, since the input string is already in stap context space. */
-  (void) _stp_text_str(STAP_RETVALUE,
-                       (char *)(uintptr_t)STAP_ARG_str,
-                       MAXSTRINGLEN, MAXSTRINGLEN, 1, 0, 0);
-%}
+%( runtime != "bpf" %? 
+  %{ /* pure */ /* unmodified-fnargs */
+    /* This can't fail, since the input string is already in stap context space. */
+    (void) _stp_text_str(STAP_RETVALUE,
+                         (char *)(uintptr_t)STAP_ARG_str,
+                         MAXSTRINGLEN, MAXSTRINGLEN, 1, 0, 0);
+  %}
+%:
+  %{  /* bpf */
+      0xbf, 1, $str, -, -;  /* mov r1, $input */
+      0x85, 0, 0, 0, -11;     /* call BPF_FUNC_STRING_QUOTED */
+      0xbf, $$, 0, -, -;      /* return r0 */
+  %}
+%)
index 77223cff3ce3e3c597a439f0df4ab1065ed59ca8..519ecad5bab175ac2330f3dce9dc5281ca68c94b 100644 (file)
@@ -38,7 +38,7 @@
                        <li><a href="keyword-index.html">By Keyword</a></li>
                </ul>
 
-<p><em>For systemtap version 4.1.</em></p><h2>Best Examples</h2>
+<p><em>For systemtap version 4.2.</em></p><h2>Best Examples</h2>
 <ul>
 <li><a href="#general/helloworld.stp">general/helloworld.stp - SystemTap "Hello World" Program</a></li>
 <li><a href="#general/para-callgraph.stp">general/para-callgraph.stp - Callgraph Tracing with Arguments</a></li>
 keywords: <a href="keyword-index.html#TRACE">TRACE</a> <br>
 <p>The gmalloc_watch.stp script from Colin Walters&#39; blog (https://blog.verbum.org/2011/03/19/analyzing-memory-use-with-systemtap/) traces the allocation of glib2 memory using the markers in glib2.</p><p><font size="-2"><pre># stap gmalloc_watch.stp -T 1</pre></font></p>
 </li><li><a name="apps/libguestfs_log.stp"></a><a href="#apps/libguestfs_log.stp">&para;</a> <a href="apps/libguestfs_log.stp">apps/libguestfs_log.stp</a> - Trace libguestfs startup<br>
-keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
+keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The libguestfs_log.stp script prints a log of when various libgueststartup steps are encountered.   The first column is microseconds since the script started.  The second column is the time elapsed in microseconds between the previous and current events and the third column is the event name.</p><p><font size="-2"><pre># stap libguestfs_log.stp -T 1</pre></font></p>
 </li><li><a name="apps/php-trace.stp"></a><a href="#apps/php-trace.stp">&para;</a> <a href="apps/php-trace.stp">apps/php-trace.stp</a> - Tracing of PHP code execution<br>
-keywords: <a href="keyword-index.html#TRACE">TRACE</a> <br>
+keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#DYNINST">DYNINST</a> <br>
 <p>Trace of executing PHP code using the enabled markers.</p><p><font size="-2"><pre># stap php-trace.stp -c &#39;php -f hello.php&#39;</pre></font></p>
 </li><li><a name="apps/stap_time.stp"></a><a href="#apps/stap_time.stp">&para;</a> <a href="apps/stap_time.stp">apps/stap_time.stp</a> - Provide elapsed times for Passes of SystemTap script compilation<br>
 keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
@@ -80,10 +80,10 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#STA
 keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <br>
 <p>The also_ran.stp script tallies each time a executable is started or a shared library is loaded for execution.  This information can be useful to determine what software is actually being used on the system.  The script makes the information available via procfs in Prometheus readable format.</p><p><font size="-2"><pre># stap also_ran.stp -T 1</pre></font></p>
 </li><li><a name="general/ansi_colors.stp"></a><a href="#general/ansi_colors.stp">&para;</a> <a href="general/ansi_colors.stp">general/ansi_colors.stp</a> - Color Table for ansi_set_color()<br>
-keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The script prints a table showing the available color combinations for the ansi_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors.stp</pre></font></p>
 </li><li><a name="general/ansi_colors2.stp"></a><a href="#general/ansi_colors2.stp">&para;</a> <a href="general/ansi_colors2.stp">general/ansi_colors2.stp</a> - Show Attribues in Table for ansi_set_color()<br>
-keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors2.stp</pre></font></p>
 </li><li><a name="general/badname.stp"></a><a href="#general/badname.stp">&para;</a> <a href="general/badname.stp">general/badname.stp</a> - Bad Filename Filter<br>
 keywords: <a href="keyword-index.html#FILESYSTEM">FILESYSTEM</a> <a href="keyword-index.html#GURU">GURU</a> <br>
@@ -104,7 +104,7 @@ keywords: <a href="keyword-index.html#FUNCTION">FUNCTION</a> <a href="keyword-in
 keywords: <a href="keyword-index.html#MONITORING">MONITORING</a> <br>
 <p>The script tracks the disk and CPU utilization.  It prints a stream of data which, when piped directly into gnuplot, draws historical curves for each.</p><p><font size="-2"><pre># stap graphs.stp -T 1</pre></font></p>
 </li><li><a name="general/helloworld.stp"></a><a href="#general/helloworld.stp">&para;</a> <a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br>
-keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
+keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>A basic &quot;Hello World&quot; program implemented in SystemTap script. It prints out &quot;hello world&quot; message and then immediately exits.</p><p><font size="-2"><pre># stap helloworld.stp</pre></font></p>
 </li><li><a name="general/key.stp"></a><a href="#general/key.stp">&para;</a> <a href="general/key.stp">general/key.stp</a> - make keyboard noises<br>
 keywords: <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
@@ -267,11 +267,8 @@ keywords: <a href="keyword-index.html#IO">IO</a> <br>
 keywords: <a href="keyword-index.html#IO">IO</a> <br>
 <p>This traces syscalls system-wide, and produces a summary report showing their counts by process ID, process name, and syscall types.</p><p><font size="-2"><pre># stap syscallbypid-nd.stp -T 1</pre></font></p>
 </li><li><a name="memory/cachestat.stp"></a><a href="#memory/cachestat.stp">&para;</a> <a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
-<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap cachestat.stp -T 1</pre></font></p>
-</li><li><a name="memory/cachestat.stp"></a><a href="#memory/cachestat.stp">&para;</a> <a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
-<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap --bpf cachestat.stp -T 1</pre></font></p>
+<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap cachestat.stp -T 1</pre></font></p>
 </li><li><a name="memory/glibc-malloc.stp"></a><a href="#memory/glibc-malloc.stp">&para;</a> <a href="memory/glibc-malloc.stp">memory/glibc-malloc.stp</a> - Overview glibc malloc internal operations<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
 <p>This script reports on internal statistics of the glibc malloc implementation, as used by a process restricted by stap -x/-c</p><p><font size="-2"><pre># stap glibc-malloc.stp -c &#39;stap --dump-functions&#39;</pre></font></p>
@@ -304,13 +301,13 @@ keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
 <p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active.  It&#39;s useful in debugging leaks in the anonymous regions of a process.</p><p><font size="-2"><pre># stap mmanonpage.stp -T 1</pre></font></p>
 </li><li><a name="memory/mmfilepage.stp"></a><a href="#memory/mmfilepage.stp">&para;</a> <a href="memory/mmfilepage.stp">memory/mmfilepage.stp</a> - Track Virtual Memory System Actions on File Backed Pages<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.</p><p><font size="-2"><pre># stap mmfilepage.stp -T 1</pre></font></p>
 </li><li><a name="memory/mmreclaim.stp"></a><a href="#memory/mmreclaim.stp">&para;</a> <a href="memory/mmreclaim.stp">memory/mmreclaim.stp</a> - Track Virtual Memory System Page Reclamation<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
 <p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It&#39;s useful in debugging performance problems that occur due to page reclamation.</p><p><font size="-2"><pre># stap mmreclaim.stp -T 1</pre></font></p>
 </li><li><a name="memory/mmwriteback.stp"></a><a href="#memory/mmwriteback.stp">&para;</a> <a href="memory/mmwriteback.stp">memory/mmwriteback.stp</a> - Track Virtual Memory System Writing to Disk<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running.  It&#39;s useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p><p><font size="-2"><pre># stap mmwriteback.stp -T 1</pre></font></p>
 </li><li><a name="memory/numa_faults.stp"></a><a href="#memory/numa_faults.stp">&para;</a> <a href="memory/numa_faults.stp">memory/numa_faults.stp</a> - Summarize Process Misses across NUMA Nodes<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#NUMA">NUMA</a> <br>
@@ -367,7 +364,7 @@ keywords: <a href="keyword-index.html#NFS">NFS</a> <a href="keyword-index.html#S
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br>
 <p>The packet_contents.stp script displays the length of each network packet and its contents in both hexadecimal and ASCII. Systemtap strings are MAXSTRINGLEN in length by default which may not be enough for larger packets. In order to print larger packets, this limit can be increased by passing in the &quot;-DMAXSTRINGLEN=65536&quot; command line option.</p><p><i><a href="network/packet_contents.txt">sample usage in network/packet_contents.txt</i></font></p>
 </li><li><a name="network/sk_stream_wait_memory.stp"></a><a href="#network/sk_stream_wait_memory.stp">&para;</a> <a href="network/sk_stream_wait_memory.stp">network/sk_stream_wait_memory.stp</a> - Track Start and Stop of Processes Due to Network Buffer Space<br>
-keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p><p><font size="-2"><pre># stap sk_stream_wait_memory.stp -T 1</pre></font></p>
 </li><li><a name="network/socket-trace.stp"></a><a href="#network/socket-trace.stp">&para;</a> <a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions Called in Network Socket Code<br>
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
@@ -559,6 +556,9 @@ keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keywor
 </li><li><a name="profiling/syscallsbypid.stp"></a><a href="#profiling/syscallsbypid.stp">&para;</a> <a href="profiling/syscallsbypid.stp">profiling/syscallsbypid.stp</a> - Provide a per-process syscall tally on the system<br>
 keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br>
 <p>The syscallsbypid.stp script tallies each syscall for each running process.  This information can be useful to determine the activity of various processes on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.</p><p><font size="-2"><pre># stap syscallsbypid.stp -T 1</pre></font></p>
+</li><li><a name="profiling/syscallsrw.stp"></a><a href="#profiling/syscallsrw.stp">&para;</a> <a href="profiling/syscallsrw.stp">profiling/syscallsrw.stp</a> - Provide a tally of read and write syscalls run on the system <br>
+keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The syscall_read_write.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.</p></p>
 </li><li><a name="profiling/thread-times.stp"></a><a href="#profiling/thread-times.stp">&para;</a> <a href="profiling/thread-times.stp">profiling/thread-times.stp</a> - Profile Kernel Functions<br>
 keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#PROFILING">PROFILING</a> <br>
 <p>The thread-times.stp script sets up time-based sampling.  Every five seconds it prints out a sorted list with the top twenty threads occupying the CPUs, broken down as a percentage of user and kernel time.</p><p><i><a href="profiling/thread-times.txt">sample usage in profiling/thread-times.txt</i></font></p>
index e496b4dbe9e142d6eb311337a6ec308fe9e9156e..2fce73727f3fa3a80f8010281ca0440c2430b0d4 100644 (file)
@@ -2,7 +2,7 @@ SYSTEMTAP EXAMPLES INDEX
 (see also keyword-index.txt)
 
 
-For systemtap version 4.1.
+For systemtap version 4.2.
 
 apps/gmalloc_watch.stp - Tracing glib2 memory allocations
 keywords: trace
@@ -16,7 +16,7 @@ keywords: trace
 
 
 apps/libguestfs_log.stp - Trace libguestfs startup
-keywords: application trace
+keywords: application trace bpf
 
   The libguestfs_log.stp script prints a log of when various
   libgueststartup steps are encountered.   The first column is
@@ -28,7 +28,7 @@ keywords: application trace
 
 
 apps/php-trace.stp - Tracing of PHP code execution
-keywords: trace
+keywords: trace dyninst
 
   Trace of executing PHP code using the enabled markers.
 
@@ -80,7 +80,7 @@ keywords: prometheus
 
 
 general/ansi_colors.stp - Color Table for ansi_set_color()
-keywords: format
+keywords: format bpf
 
   The script prints a table showing the available color combinations
   for the ansi_set_color() function in the ansi.stp tapset.
@@ -89,7 +89,7 @@ keywords: format
 
 
 general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color()
-keywords: format
+keywords: format bpf
 
   The script prints a table showing the available attributes (bold,
   underline, and inverse) with color combinations for the
@@ -166,7 +166,7 @@ keywords: monitoring
 
 
 general/helloworld.stp - SystemTap "Hello World" Program
-keywords: _best simple
+keywords: _best simple bpf
 
   A basic "Hello World" program implemented in SystemTap script. It
   prints out "hello world" message and then immediately exits.
@@ -768,22 +768,13 @@ keywords: io
   # stap syscallbypid-nd.stp -T 1
 
 
-memory/cachestat.stp - Count Page Cache Hits and Misses
-keywords: memory
-
-  Monitors hits and misses to the page cache and reports a count every
-  5 seconds. Based on a bpftrace tool by David Valin.
-
-  # stap cachestat.stp -T 1
-
-
 memory/cachestat.stp - Count Page Cache Hits and Misses
 keywords: memory bpf
 
   Monitors hits and misses to the page cache and reports a count every
   5 seconds. Based on a bpftrace tool by David Valin.
 
-  # stap --bpf cachestat.stp -T 1
+  # stap cachestat.stp -T 1
 
 
 memory/glibc-malloc.stp - Overview glibc malloc internal operations
@@ -916,7 +907,7 @@ keywords: memory
 
 
 memory/mmfilepage.stp - Track Virtual Memory System Actions on File Backed Pages
-keywords: memory
+keywords: memory bpf
 
   The mmfilepage.stp script uses the virtual memory tracepoints
   available in some kernels to track the number of faults, copy on
@@ -941,7 +932,7 @@ keywords: memory
 
 
 memory/mmwriteback.stp - Track Virtual Memory System Writing to Disk
-keywords: memory
+keywords: memory bpf
 
   The mmwriteback.stp script uses the virtual memory tracepoints
   available in some kernels to report all of the file writebacks that
@@ -1146,7 +1137,7 @@ keywords: network traffic
 
 
 network/sk_stream_wait_memory.stp - Track Start and Stop of Processes Due to Network Buffer Space
-keywords: network tcp process
+keywords: network tcp process bpf
 
   The sk_stream-wait_memory.stp prints a time stamp, executable, and
   pid each time a process blocks due to the send buffer being full. A
@@ -1888,6 +1879,14 @@ keywords: prometheus process syscall tracepoint
   # stap syscallsbypid.stp -T 1
 
 
+profiling/syscallsrw.stp - Provide a tally of read and write syscalls run on the system 
+keywords: prometheus syscall bpf
+
+  The syscall_read_write.stp script tallies the read and write
+  syscalls. This is a demo script for stapbpf prometheus-exporter
+  scripts.
+
+
 profiling/thread-times.stp - Profile Kernel Functions
 keywords: _best profiling
 
index 4c2fc93798b3c05f1d2f957b4bde68a69b39712e..5585753b11bdd03577b8fa01408972bacb2cbaab 100644 (file)
                        <li><a href="keyword-index.html">By Keyword</a></li>
                </ul>
 
-<p><em>For systemtap version 4.1.</em></p><h2>Examples by Keyword</h2>
-<p><tt><a href="#_BEST">_BEST(17)</a> <a href="#APPLICATION">APPLICATION(2)</a> <a href="#BACKTRACE">BACKTRACE(8)</a> <a href="#BPF">BPF(1)</a> <a href="#CALLGRAPH">CALLGRAPH(4)</a> <a href="#CONTAINER">CONTAINER(1)</a> <a href="#DIAGRAM">DIAGRAM(1)</a> <a href="#DISK">DISK(5)</a> <a href="#FILE">FILE(2)</a> <a href="#FILESYSTEM">FILESYSTEM(4)</a> <a href="#FORMAT">FORMAT(2)</a> <a href="#FUNCTION">FUNCTION(4)</a> <a href="#FUTEX">FUTEX(2)</a> <a href="#GURU">GURU(19)</a> <a href="#INTERACTIVE">INTERACTIVE(2)</a> <a href="#INTERRUPT">INTERRUPT(3)</a> <a href="#IO">IO(30)</a> <a href="#JSON">JSON(2)</a> <a href="#KVM">KVM(3)</a> <a href="#LIMITS">LIMITS(3)</a> <a href="#LOCKING">LOCKING(6)</a> <a href="#MEMORY">MEMORY(21)</a> <a href="#MONITORING">MONITORING(9)</a> <a href="#NANOSLEEP">NANOSLEEP(1)</a> <a href="#NETWORK">NETWORK(21)</a> <a href="#NFS">NFS(5)</a> <a href="#NUMA">NUMA(1)</a> <a href="#PACKETS">PACKETS(1)</a> <a href="#PROCESS">PROCESS(27)</a> <a href="#PROFILING">PROFILING(24)</a> <a href="#PROMETHEUS">PROMETHEUS(5)</a> <a href="#QEMU">QEMU(2)</a> <a href="#REGEX">REGEX(1)</a> <a href="#RETRANSMISSION">RETRANSMISSION(1)</a> <a href="#SCHEDULER">SCHEDULER(9)</a> <a href="#SCSI">SCSI(1)</a> <a href="#SECURITY">SECURITY(13)</a> <a href="#SIGNALS">SIGNALS(5)</a> <a href="#SIMPLE">SIMPLE(10)</a> <a href="#SOCKET">SOCKET(8)</a> <a href="#SPECULATION">SPECULATION(1)</a> <a href="#STAPGAMES">STAPGAMES(5)</a> <a href="#STATISTICS">STATISTICS(10)</a> <a href="#SYSCALL">SYSCALL(18)</a> <a href="#TCP">TCP(4)</a> <a href="#THREAD">THREAD(2)</a> <a href="#TIME">TIME(4)</a> <a href="#TRACE">TRACE(11)</a> <a href="#TRACEPOINT">TRACEPOINT(8)</a> <a href="#TRAFFIC">TRAFFIC(8)</a> <a href="#TTY">TTY(1)</a> <a href="#VIRTUALIZATION">VIRTUALIZATION(3)</a> <a href="#WATCHDOG">WATCHDOG(1)</a> <a href="#WATCHPOINT">WATCHPOINT(2)</a> </tt></p>
+<p><em>For systemtap version 4.2.</em></p><h2>Examples by Keyword</h2>
+<p><tt><a href="#_BEST">_BEST(17)</a> <a href="#APPLICATION">APPLICATION(2)</a> <a href="#BACKTRACE">BACKTRACE(8)</a> <a href="#BPF">BPF(9)</a> <a href="#CALLGRAPH">CALLGRAPH(4)</a> <a href="#CONTAINER">CONTAINER(1)</a> <a href="#DIAGRAM">DIAGRAM(1)</a> <a href="#DISK">DISK(5)</a> <a href="#DYNINST">DYNINST(1)</a> <a href="#FILE">FILE(2)</a> <a href="#FILESYSTEM">FILESYSTEM(4)</a> <a href="#FORMAT">FORMAT(2)</a> <a href="#FUNCTION">FUNCTION(4)</a> <a href="#FUTEX">FUTEX(2)</a> <a href="#GURU">GURU(19)</a> <a href="#INTERACTIVE">INTERACTIVE(2)</a> <a href="#INTERRUPT">INTERRUPT(3)</a> <a href="#IO">IO(30)</a> <a href="#JSON">JSON(2)</a> <a href="#KVM">KVM(3)</a> <a href="#LIMITS">LIMITS(3)</a> <a href="#LOCKING">LOCKING(6)</a> <a href="#MEMORY">MEMORY(20)</a> <a href="#MONITORING">MONITORING(9)</a> <a href="#NANOSLEEP">NANOSLEEP(1)</a> <a href="#NETWORK">NETWORK(21)</a> <a href="#NFS">NFS(5)</a> <a href="#NUMA">NUMA(1)</a> <a href="#PACKETS">PACKETS(1)</a> <a href="#PROCESS">PROCESS(27)</a> <a href="#PROFILING">PROFILING(24)</a> <a href="#PROMETHEUS">PROMETHEUS(6)</a> <a href="#QEMU">QEMU(2)</a> <a href="#REGEX">REGEX(1)</a> <a href="#RETRANSMISSION">RETRANSMISSION(1)</a> <a href="#SCHEDULER">SCHEDULER(9)</a> <a href="#SCSI">SCSI(1)</a> <a href="#SECURITY">SECURITY(13)</a> <a href="#SIGNALS">SIGNALS(5)</a> <a href="#SIMPLE">SIMPLE(10)</a> <a href="#SOCKET">SOCKET(8)</a> <a href="#SPECULATION">SPECULATION(1)</a> <a href="#STAPGAMES">STAPGAMES(5)</a> <a href="#STATISTICS">STATISTICS(10)</a> <a href="#SYSCALL">SYSCALL(19)</a> <a href="#TCP">TCP(4)</a> <a href="#THREAD">THREAD(2)</a> <a href="#TIME">TIME(4)</a> <a href="#TRACE">TRACE(11)</a> <a href="#TRACEPOINT">TRACEPOINT(8)</a> <a href="#TRAFFIC">TRAFFIC(8)</a> <a href="#TTY">TTY(1)</a> <a href="#VIRTUALIZATION">VIRTUALIZATION(3)</a> <a href="#WATCHDOG">WATCHDOG(1)</a> <a href="#WATCHPOINT">WATCHPOINT(2)</a> </tt></p>
 <h3><a name="_BEST"><a href="#_BEST">&para;</a> _BEST</a></h3>
 <ul>
 <li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br>
-keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
+keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>A basic &quot;Hello World&quot; program implemented in SystemTap script. It prints out &quot;hello world&quot; message and then immediately exits.</p><p><font size="-2"><pre># stap helloworld.stp</pre></font></p>
 </li><li><a href="general/para-callgraph.stp">general/para-callgraph.stp</a> - Callgraph Tracing with Arguments<br>
 keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#CALLGRAPH">CALLGRAPH</a> <br>
@@ -97,7 +97,7 @@ keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.ht
 <h3><a name="APPLICATION"><a href="#APPLICATION">&para;</a> APPLICATION</a></h3>
 <ul>
 <li><a href="apps/libguestfs_log.stp">apps/libguestfs_log.stp</a> - Trace libguestfs startup<br>
-keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
+keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The libguestfs_log.stp script prints a log of when various libgueststartup steps are encountered.   The first column is microseconds since the script started.  The second column is the time elapsed in microseconds between the previous and current events and the third column is the event name.</p><p><font size="-2"><pre># stap libguestfs_log.stp -T 1</pre></font></p>
 </li><li><a href="apps/stap_time.stp">apps/stap_time.stp</a> - Provide elapsed times for Passes of SystemTap script compilation<br>
 keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
@@ -133,9 +133,33 @@ keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.ht
 </li></ul>
 <h3><a name="BPF"><a href="#BPF">&para;</a> BPF</a></h3>
 <ul>
-<li><a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
+<li><a href="apps/libguestfs_log.stp">apps/libguestfs_log.stp</a> - Trace libguestfs startup<br>
+keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The libguestfs_log.stp script prints a log of when various libgueststartup steps are encountered.   The first column is microseconds since the script started.  The second column is the time elapsed in microseconds between the previous and current events and the third column is the event name.</p><p><font size="-2"><pre># stap libguestfs_log.stp -T 1</pre></font></p>
+</li><li><a href="general/ansi_colors.stp">general/ansi_colors.stp</a> - Color Table for ansi_set_color()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The script prints a table showing the available color combinations for the ansi_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors.stp</pre></font></p>
+</li><li><a href="general/ansi_colors2.stp">general/ansi_colors2.stp</a> - Show Attribues in Table for ansi_set_color()<br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors2.stp</pre></font></p>
+</li><li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br>
+keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>A basic &quot;Hello World&quot; program implemented in SystemTap script. It prints out &quot;hello world&quot; message and then immediately exits.</p><p><font size="-2"><pre># stap helloworld.stp</pre></font></p>
+</li><li><a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap cachestat.stp -T 1</pre></font></p>
+</li><li><a href="memory/mmfilepage.stp">memory/mmfilepage.stp</a> - Track Virtual Memory System Actions on File Backed Pages<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
-<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap --bpf cachestat.stp -T 1</pre></font></p>
+<p>The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.</p><p><font size="-2"><pre># stap mmfilepage.stp -T 1</pre></font></p>
+</li><li><a href="memory/mmwriteback.stp">memory/mmwriteback.stp</a> - Track Virtual Memory System Writing to Disk<br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running.  It&#39;s useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p><p><font size="-2"><pre># stap mmwriteback.stp -T 1</pre></font></p>
+</li><li><a href="network/sk_stream_wait_memory.stp">network/sk_stream_wait_memory.stp</a> - Track Start and Stop of Processes Due to Network Buffer Space<br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p><p><font size="-2"><pre># stap sk_stream_wait_memory.stp -T 1</pre></font></p>
+</li><li><a href="profiling/syscallsrw.stp">profiling/syscallsrw.stp</a> - Provide a tally of read and write syscalls run on the system <br>
+keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The syscall_read_write.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.</p></p>
 </li></ul>
 <h3><a name="CALLGRAPH"><a href="#CALLGRAPH">&para;</a> CALLGRAPH</a></h3>
 <ul>
@@ -183,6 +207,12 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#MON
 keywords: <a href="keyword-index.html#NFS">NFS</a> <a href="keyword-index.html#DISK">DISK</a> <br>
 <p>The nfsd_unlink.stp script lists the ip address and file name each time time a file is being removed or unlinked by the nfsd. This script is run on the nfs server.</p><p><font size="-2"><pre># stap nfsd_unlink.stp -T 1</pre></font></p>
 </li></ul>
+<h3><a name="DYNINST"><a href="#DYNINST">&para;</a> DYNINST</a></h3>
+<ul>
+<li><a href="apps/php-trace.stp">apps/php-trace.stp</a> - Tracing of PHP code execution<br>
+keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#DYNINST">DYNINST</a> <br>
+<p>Trace of executing PHP code using the enabled markers.</p><p><font size="-2"><pre># stap php-trace.stp -c &#39;php -f hello.php&#39;</pre></font></p>
+</li></ul>
 <h3><a name="FILE"><a href="#FILE">&para;</a> FILE</a></h3>
 <ul>
 <li><a href="io/iotime.stp">io/iotime.stp</a> - Trace Time Spent in Read and Write for Files <br>
@@ -210,10 +240,10 @@ keywords: <a href="keyword-index.html#IO">IO</a> <a href="keyword-index.html#FIL
 <h3><a name="FORMAT"><a href="#FORMAT">&para;</a> FORMAT</a></h3>
 <ul>
 <li><a href="general/ansi_colors.stp">general/ansi_colors.stp</a> - Color Table for ansi_set_color()<br>
-keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The script prints a table showing the available color combinations for the ansi_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors.stp</pre></font></p>
 </li><li><a href="general/ansi_colors2.stp">general/ansi_colors2.stp</a> - Show Attribues in Table for ansi_set_color()<br>
-keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <br>
+keywords: <a href="keyword-index.html#FORMAT">FORMAT</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color() function in the ansi.stp tapset.</p><p><font size="-2"><pre># stap ansi_colors2.stp</pre></font></p>
 </li></ul>
 <h3><a name="FUNCTION"><a href="#FUNCTION">&para;</a> FUNCTION</a></h3>
@@ -477,11 +507,8 @@ keywords: <a href="keyword-index.html#STATISTICS">STATISTICS</a> <a href="keywor
 keywords: <a href="keyword-index.html#STATISTICS">STATISTICS</a> <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#INTERACTIVE">INTERACTIVE</a> <br>
 <p>This script prints the size of a type, based on dwarf debuginfo for any kernel or userspace module, or trial-compilation of a given header file name. Types and corresponding locations are provided to the script at runtime via keyboard input. The format of the input is identical to that of sizeof.stp (see script source for more information). Types and locations can be repeatedly given until the process is terminated. </p><p><i><a href="general/sizeof_interactive.txt">sample usage in general/sizeof_interactive.txt</i></font></p>
 </li><li><a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
-<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap cachestat.stp -T 1</pre></font></p>
-</li><li><a href="memory/cachestat.stp">memory/cachestat.stp</a> - Count Page Cache Hits and Misses<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
-<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap --bpf cachestat.stp -T 1</pre></font></p>
+<p>Monitors hits and misses to the page cache and reports a count every 5 seconds. Based on a bpftrace tool by David Valin.</p><p><font size="-2"><pre># stap cachestat.stp -T 1</pre></font></p>
 </li><li><a href="memory/glibc-malloc.stp">memory/glibc-malloc.stp</a> - Overview glibc malloc internal operations<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
 <p>This script reports on internal statistics of the glibc malloc implementation, as used by a process restricted by stap -x/-c</p><p><font size="-2"><pre># stap glibc-malloc.stp -c &#39;stap --dump-functions&#39;</pre></font></p>
@@ -514,13 +541,13 @@ keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
 <p>The mmanonpage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, user space frees, page ins, copy on writes and unmaps for anonymous pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. This script displays the anonymous page statistics for each process that ran while the script is active.  It&#39;s useful in debugging leaks in the anonymous regions of a process.</p><p><font size="-2"><pre># stap mmanonpage.stp -T 1</pre></font></p>
 </li><li><a href="memory/mmfilepage.stp">memory/mmfilepage.stp</a> - Track Virtual Memory System Actions on File Backed Pages<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The mmfilepage.stp script uses the virtual memory tracepoints available in some kernels to track the number of faults, copy on writes mapping, and unmapping operations for file backed pages. When the script is terminated the counts are printed for each process that allocated pages while the script was running. The mmfilepage.stp script is useful in debugging leaks in the mapped file regions of a process.</p><p><font size="-2"><pre># stap mmfilepage.stp -T 1</pre></font></p>
 </li><li><a href="memory/mmreclaim.stp">memory/mmreclaim.stp</a> - Track Virtual Memory System Page Reclamation<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
 <p>The mmreclaim.stp script uses the virtual memory tracepoints available in some kernels to track page reclaim activity that occurred while the script was running. It&#39;s useful in debugging performance problems that occur due to page reclamation.</p><p><font size="-2"><pre># stap mmreclaim.stp -T 1</pre></font></p>
 </li><li><a href="memory/mmwriteback.stp">memory/mmwriteback.stp</a> - Track Virtual Memory System Writing to Disk<br>
-keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br>
+keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The mmwriteback.stp script uses the virtual memory tracepoints available in some kernels to report all of the file writebacks that occur form kupdate, pdflush and kjournald while the script is running.  It&#39;s useful in determining where writes are coming from on a supposedly idle system that is experiencing unexpected IO.</p><p><font size="-2"><pre># stap mmwriteback.stp -T 1</pre></font></p>
 </li><li><a href="memory/numa_faults.stp">memory/numa_faults.stp</a> - Summarize Process Misses across NUMA Nodes<br>
 keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.html#NUMA">NUMA</a> <br>
@@ -608,7 +635,7 @@ keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-inde
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <br>
 <p>The packet_contents.stp script displays the length of each network packet and its contents in both hexadecimal and ASCII. Systemtap strings are MAXSTRINGLEN in length by default which may not be enough for larger packets. In order to print larger packets, this limit can be increased by passing in the &quot;-DMAXSTRINGLEN=65536&quot; command line option.</p><p><i><a href="network/packet_contents.txt">sample usage in network/packet_contents.txt</i></font></p>
 </li><li><a href="network/sk_stream_wait_memory.stp">network/sk_stream_wait_memory.stp</a> - Track Start and Stop of Processes Due to Network Buffer Space<br>
-keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p><p><font size="-2"><pre># stap sk_stream_wait_memory.stp -T 1</pre></font></p>
 </li><li><a href="network/socket-trace.stp">network/socket-trace.stp</a> - Trace Functions Called in Network Socket Code<br>
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
@@ -683,7 +710,7 @@ keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <a href="keyword-index.
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
 <p>The connect_stat.stp script prints a task&#39;s entire ancestry (parent process name/uid/gid) whenever it attempts an outgoing socket connection to a given IP address.</p><p><font size="-2"><pre># stap connect_stat.stp 127.0.0.1 -T 1</pre></font></p>
 </li><li><a href="network/sk_stream_wait_memory.stp">network/sk_stream_wait_memory.stp</a> - Track Start and Stop of Processes Due to Network Buffer Space<br>
-keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p><p><font size="-2"><pre># stap sk_stream_wait_memory.stp -T 1</pre></font></p>
 </li><li><a href="process/cycle_thief.stp">process/cycle_thief.stp</a> - Track IRQ's and Other Processes Stealing Cycles from a Task<br>
 keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SCHEDULER">SCHEDULER</a> <a href="keyword-index.html#TIME">TIME</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <a href="keyword-index.html#INTERRUPT">INTERRUPT</a> <br>
@@ -846,6 +873,9 @@ keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keywor
 </li><li><a href="profiling/syscallsbypid.stp">profiling/syscallsbypid.stp</a> - Provide a per-process syscall tally on the system<br>
 keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br>
 <p>The syscallsbypid.stp script tallies each syscall for each running process.  This information can be useful to determine the activity of various processes on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.</p><p><font size="-2"><pre># stap syscallsbypid.stp -T 1</pre></font></p>
+</li><li><a href="profiling/syscallsrw.stp">profiling/syscallsrw.stp</a> - Provide a tally of read and write syscalls run on the system <br>
+keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The syscall_read_write.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.</p></p>
 </li></ul>
 <h3><a name="QEMU"><a href="#QEMU">&para;</a> QEMU</a></h3>
 <ul>
@@ -970,7 +1000,7 @@ keywords: <a href="keyword-index.html#SIGNALS">SIGNALS</a> <br>
 keywords: <a href="keyword-index.html#SIMPLE">SIMPLE</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#CALLGRAPH">CALLGRAPH</a> <br>
 <p>Print a timed per-thread microsecond-timed nested callgraph.  The first parameter names the function probe points to trace.</p><p><i><a href="general/callgraph.txt">sample usage in general/callgraph.txt</i></font></p>
 </li><li><a href="general/helloworld.stp">general/helloworld.stp</a> - SystemTap "Hello World" Program<br>
-keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
+keywords: <a href="keyword-index.html#_BEST">_BEST</a> <a href="keyword-index.html#SIMPLE">SIMPLE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>A basic &quot;Hello World&quot; program implemented in SystemTap script. It prints out &quot;hello world&quot; message and then immediately exits.</p><p><font size="-2"><pre># stap helloworld.stp</pre></font></p>
 </li><li><a href="general/key.stp">general/key.stp</a> - make keyboard noises<br>
 keywords: <a href="keyword-index.html#SIMPLE">SIMPLE</a> <br>
@@ -1135,6 +1165,9 @@ keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keywor
 </li><li><a href="profiling/syscallsbypid.stp">profiling/syscallsbypid.stp</a> - Provide a per-process syscall tally on the system<br>
 keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#TRACEPOINT">TRACEPOINT</a> <br>
 <p>The syscallsbypid.stp script tallies each syscall for each running process.  This information can be useful to determine the activity of various processes on the system.  The script makes the information available via procfs in Prometheus readable format.  When a process exits its data will be eliminated from the prometheus output.  To avoid exceeding the storage limitations of SystemTap older entries maybe overwritten by newer entries.  This can lead to some active process syscall counts disappearing and/or later reappearing with a lower value.  Also note that the script does not properly name syscalls for 32-bit applications running on 64-bit machines.</p><p><font size="-2"><pre># stap syscallsbypid.stp -T 1</pre></font></p>
+</li><li><a href="profiling/syscallsrw.stp">profiling/syscallsrw.stp</a> - Provide a tally of read and write syscalls run on the system <br>
+keywords: <a href="keyword-index.html#PROMETHEUS">PROMETHEUS</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-index.html#BPF">BPF</a> <br>
+<p>The syscall_read_write.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.</p></p>
 </li><li><a href="profiling/ucalls.stp">profiling/ucalls.stp</a> - Profile method invocations in Java, Perl, Php, Python, Ruby, and Tcl scripts<br>
 keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-index.html#SYSCALL">SYSCALL</a> <br>
 <p>The ucalls.stp script is modeled after the BCC ucalls script (https://github.com/iovisor/bcc/blob/master/tools/lib/ucalls.py) by Sasha Goldshtein. The ucalls.stp script monitors the process indicated by the -x or -c option.  When the scripts exits it prints out information about the number of times that each method is invoked for code written in Java, Perl, Php, Python, Ruby, and Tcl.  Include the word &quot;syscalls&quot; on the command line to count syscalls invoked by the process.  If you want latency information, include &quot;latency&quot; on the command line. Note that the latency option does not work for recursive functions</p><p><font size="-2"><pre># stap ucalls.stp syscalls latency -c &quot;python -c &#39;print(\&quot;hello world\&quot;)&#39; \
@@ -1143,7 +1176,7 @@ keywords: <a href="keyword-index.html#PROFILING">PROFILING</a> <a href="keyword-
 <h3><a name="TCP"><a href="#TCP">&para;</a> TCP</a></h3>
 <ul>
 <li><a href="network/sk_stream_wait_memory.stp">network/sk_stream_wait_memory.stp</a> - Track Start and Stop of Processes Due to Network Buffer Space<br>
-keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <br>
+keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The sk_stream-wait_memory.stp prints a time stamp, executable, and pid each time a process blocks due to the send buffer being full. A similar entry is printed each time a process continues because there is room in the buffer.</p><p><font size="-2"><pre># stap sk_stream_wait_memory.stp -T 1</pre></font></p>
 </li><li><a href="network/tcp_connections.stp">network/tcp_connections.stp</a> - Track Creation of Incoming TCP Connections<br>
 keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TCP">TCP</a> <a href="keyword-index.html#SOCKET">SOCKET</a> <br>
@@ -1185,10 +1218,10 @@ keywords: <a href="keyword-index.html#PROCESS">PROCESS</a> <a href="keyword-inde
 keywords: <a href="keyword-index.html#TRACE">TRACE</a> <br>
 <p>The gmalloc_watch.stp script from Colin Walters&#39; blog (https://blog.verbum.org/2011/03/19/analyzing-memory-use-with-systemtap/) traces the allocation of glib2 memory using the markers in glib2.</p><p><font size="-2"><pre># stap gmalloc_watch.stp -T 1</pre></font></p>
 </li><li><a href="apps/libguestfs_log.stp">apps/libguestfs_log.stp</a> - Trace libguestfs startup<br>
-keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
+keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#BPF">BPF</a> <br>
 <p>The libguestfs_log.stp script prints a log of when various libgueststartup steps are encountered.   The first column is microseconds since the script started.  The second column is the time elapsed in microseconds between the previous and current events and the third column is the event name.</p><p><font size="-2"><pre># stap libguestfs_log.stp -T 1</pre></font></p>
 </li><li><a href="apps/php-trace.stp">apps/php-trace.stp</a> - Tracing of PHP code execution<br>
-keywords: <a href="keyword-index.html#TRACE">TRACE</a> <br>
+keywords: <a href="keyword-index.html#TRACE">TRACE</a> <a href="keyword-index.html#DYNINST">DYNINST</a> <br>
 <p>Trace of executing PHP code using the enabled markers.</p><p><font size="-2"><pre># stap php-trace.stp -c &#39;php -f hello.php&#39;</pre></font></p>
 </li><li><a href="apps/stap_time.stp">apps/stap_time.stp</a> - Provide elapsed times for Passes of SystemTap script compilation<br>
 keywords: <a href="keyword-index.html#APPLICATION">APPLICATION</a> <a href="keyword-index.html#TRACE">TRACE</a> <br>
index f07fbf3cc83a50ceada0e3debd77d90a4008102c..0ffbfe78119bade4642596b912e2438c7345ff02 100644 (file)
@@ -2,12 +2,12 @@ SYSTEMTAP EXAMPLES INDEX BY KEYWORD
 (see also index.txt)
 
 
-For systemtap version 4.1.
+For systemtap version 4.2.
 
 = _BEST =
 
 general/helloworld.stp - SystemTap "Hello World" Program
-keywords: _best simple
+keywords: _best simple bpf
 
   A basic "Hello World" program implemented in SystemTap script. It
   prints out "hello world" message and then immediately exits.
@@ -214,7 +214,7 @@ keywords: _best virtualization kvm
 = APPLICATION =
 
 apps/libguestfs_log.stp - Trace libguestfs startup
-keywords: application trace
+keywords: application trace bpf
 
   The libguestfs_log.stp script prints a log of when various
   libgueststartup steps are encountered.   The first column is
@@ -337,13 +337,98 @@ keywords: _best profiling backtrace
 
 = BPF =
 
+apps/libguestfs_log.stp - Trace libguestfs startup
+keywords: application trace bpf
+
+  The libguestfs_log.stp script prints a log of when various
+  libgueststartup steps are encountered.   The first column is
+  microseconds since the script started.  The second column is the time
+  elapsed in microseconds between the previous and current events and
+  the third column is the event name.
+
+  # stap libguestfs_log.stp -T 1
+
+
+general/ansi_colors.stp - Color Table for ansi_set_color()
+keywords: format bpf
+
+  The script prints a table showing the available color combinations
+  for the ansi_set_color() function in the ansi.stp tapset.
+
+  # stap ansi_colors.stp
+
+
+general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color()
+keywords: format bpf
+
+  The script prints a table showing the available attributes (bold,
+  underline, and inverse) with color combinations for the
+  ans_set_color() function in the ansi.stp tapset.
+
+  # stap ansi_colors2.stp
+
+
+general/helloworld.stp - SystemTap "Hello World" Program
+keywords: _best simple bpf
+
+  A basic "Hello World" program implemented in SystemTap script. It
+  prints out "hello world" message and then immediately exits.
+
+  # stap helloworld.stp
+
+
 memory/cachestat.stp - Count Page Cache Hits and Misses
 keywords: memory bpf
 
   Monitors hits and misses to the page cache and reports a count every
   5 seconds. Based on a bpftrace tool by David Valin.
 
-  # stap --bpf cachestat.stp -T 1
+  # stap cachestat.stp -T 1
+
+
+memory/mmfilepage.stp - Track Virtual Memory System Actions on File Backed Pages
+keywords: memory bpf
+
+  The mmfilepage.stp script uses the virtual memory tracepoints
+  available in some kernels to track the number of faults, copy on
+  writes mapping, and unmapping operations for file backed pages. When
+  the script is terminated the counts are printed for each process that
+  allocated pages while the script was running. The mmfilepage.stp
+  script is useful in debugging leaks in the mapped file regions of a
+  process.
+
+  # stap mmfilepage.stp -T 1
+
+
+memory/mmwriteback.stp - Track Virtual Memory System Writing to Disk
+keywords: memory bpf
+
+  The mmwriteback.stp script uses the virtual memory tracepoints
+  available in some kernels to report all of the file writebacks that
+  occur form kupdate, pdflush and kjournald while the script is
+  running.  It's useful in determining where writes are coming from on
+  a supposedly idle system that is experiencing unexpected IO.
+
+  # stap mmwriteback.stp -T 1
+
+
+network/sk_stream_wait_memory.stp - Track Start and Stop of Processes Due to Network Buffer Space
+keywords: network tcp process bpf
+
+  The sk_stream-wait_memory.stp prints a time stamp, executable, and
+  pid each time a process blocks due to the send buffer being full. A
+  similar entry is printed each time a process continues because there
+  is room in the buffer.
+
+  # stap sk_stream_wait_memory.stp -T 1
+
+
+profiling/syscallsrw.stp - Provide a tally of read and write syscalls run on the system 
+keywords: prometheus syscall bpf
+
+  The syscall_read_write.stp script tallies the read and write
+  syscalls. This is a demo script for stapbpf prometheus-exporter
+  scripts.
 
 
 = CALLGRAPH =
@@ -478,6 +563,16 @@ keywords: nfs disk
   # stap nfsd_unlink.stp -T 1
 
 
+= DYNINST =
+
+apps/php-trace.stp - Tracing of PHP code execution
+keywords: trace dyninst
+
+  Trace of executing PHP code using the enabled markers.
+
+  # stap php-trace.stp -c 'php -f hello.php'
+
+
 = FILE =
 
 io/iotime.stp - Trace Time Spent in Read and Write for Files 
@@ -557,7 +652,7 @@ keywords: io filesystem
 = FORMAT =
 
 general/ansi_colors.stp - Color Table for ansi_set_color()
-keywords: format
+keywords: format bpf
 
   The script prints a table showing the available color combinations
   for the ansi_set_color() function in the ansi.stp tapset.
@@ -566,7 +661,7 @@ keywords: format
 
 
 general/ansi_colors2.stp - Show Attribues in Table for ansi_set_color()
-keywords: format
+keywords: format bpf
 
   The script prints a table showing the available attributes (bold,
   underline, and inverse) with color combinations for the
@@ -1402,22 +1497,13 @@ keywords: statistics memory interactive
   # echo "FILE '</usr/include/stdio.h>'" | stap sizeof_interactive.stp -T 1
 
 
-memory/cachestat.stp - Count Page Cache Hits and Misses
-keywords: memory
-
-  Monitors hits and misses to the page cache and reports a count every
-  5 seconds. Based on a bpftrace tool by David Valin.
-
-  # stap cachestat.stp -T 1
-
-
 memory/cachestat.stp - Count Page Cache Hits and Misses
 keywords: memory bpf
 
   Monitors hits and misses to the page cache and reports a count every
   5 seconds. Based on a bpftrace tool by David Valin.
 
-  # stap --bpf cachestat.stp -T 1
+  # stap cachestat.stp -T 1
 
 
 memory/glibc-malloc.stp - Overview glibc malloc internal operations
@@ -1550,7 +1636,7 @@ keywords: memory
 
 
 memory/mmfilepage.stp - Track Virtual Memory System Actions on File Backed Pages
-keywords: memory
+keywords: memory bpf
 
   The mmfilepage.stp script uses the virtual memory tracepoints
   available in some kernels to track the number of faults, copy on
@@ -1575,7 +1661,7 @@ keywords: memory
 
 
 memory/mmwriteback.stp - Track Virtual Memory System Writing to Disk
-keywords: memory
+keywords: memory bpf
 
   The mmwriteback.stp script uses the virtual memory tracepoints
   available in some kernels to report all of the file writebacks that
@@ -1879,7 +1965,7 @@ keywords: network traffic
 
 
 network/sk_stream_wait_memory.stp - Track Start and Stop of Processes Due to Network Buffer Space
-keywords: network tcp process
+keywords: network tcp process bpf
 
   The sk_stream-wait_memory.stp prints a time stamp, executable, and
   pid each time a process blocks due to the send buffer being full. A
@@ -2111,7 +2197,7 @@ keywords: network socket process
 
 
 network/sk_stream_wait_memory.stp - Track Start and Stop of Processes Due to Network Buffer Space
-keywords: network tcp process
+keywords: network tcp process bpf
 
   The sk_stream-wait_memory.stp prints a time stamp, executable, and
   pid each time a process blocks due to the send buffer being full. A
@@ -2772,6 +2858,14 @@ keywords: prometheus process syscall tracepoint
   # stap syscallsbypid.stp -T 1
 
 
+profiling/syscallsrw.stp - Provide a tally of read and write syscalls run on the system 
+keywords: prometheus syscall bpf
+
+  The syscall_read_write.stp script tallies the read and write
+  syscalls. This is a demo script for stapbpf prometheus-exporter
+  scripts.
+
+
 = QEMU =
 
 virtualization/qemu_count.stp - Tally the Number of User-Space QEMU Events
@@ -3099,7 +3193,7 @@ keywords: simple trace callgraph
 
 
 general/helloworld.stp - SystemTap "Hello World" Program
-keywords: _best simple
+keywords: _best simple bpf
 
   A basic "Hello World" program implemented in SystemTap script. It
   prints out "hello world" message and then immediately exits.
@@ -3669,6 +3763,14 @@ keywords: prometheus process syscall tracepoint
   # stap syscallsbypid.stp -T 1
 
 
+profiling/syscallsrw.stp - Provide a tally of read and write syscalls run on the system 
+keywords: prometheus syscall bpf
+
+  The syscall_read_write.stp script tallies the read and write
+  syscalls. This is a demo script for stapbpf prometheus-exporter
+  scripts.
+
+
 profiling/ucalls.stp - Profile method invocations in Java, Perl, Php, Python, Ruby, and Tcl scripts
 keywords: profiling syscall
 
@@ -3690,7 +3792,7 @@ keywords: profiling syscall
 = TCP =
 
 network/sk_stream_wait_memory.stp - Track Start and Stop of Processes Due to Network Buffer Space
-keywords: network tcp process
+keywords: network tcp process bpf
 
   The sk_stream-wait_memory.stp prints a time stamp, executable, and
   pid each time a process blocks due to the send buffer being full. A
@@ -3824,7 +3926,7 @@ keywords: trace
 
 
 apps/libguestfs_log.stp - Trace libguestfs startup
-keywords: application trace
+keywords: application trace bpf
 
   The libguestfs_log.stp script prints a log of when various
   libgueststartup steps are encountered.   The first column is
@@ -3836,7 +3938,7 @@ keywords: application trace
 
 
 apps/php-trace.stp - Tracing of PHP code execution
-keywords: trace
+keywords: trace dyninst
 
   Trace of executing PHP code using the enabled markers.
 
index a02b06e93a8a1855c10ec658889f9a2c3d6f8879..d3cccaa4f55f93385a2c590843ce494086c002ef 100644 (file)
Binary files a/testsuite/systemtap.examples/metadatabase.db and b/testsuite/systemtap.examples/metadatabase.db differ
diff --git a/testsuite/systemtap.examples/profiling/syscallsrw.meta b/testsuite/systemtap.examples/profiling/syscallsrw.meta
new file mode 100644 (file)
index 0000000..64fd74a
--- /dev/null
@@ -0,0 +1,13 @@
+title: Provide a tally of read and write syscalls run on the system 
+name: syscallsrw.stp
+version: 1.0
+author: Sagar Patel
+keywords: prometheus syscall bpf
+subsystem: process
+status: experimental
+exit: user-controlled
+output: proc
+scope: system-wide
+description: The syscall_read_write.stp script tallies the read and write syscalls. This is a demo script for stapbpf prometheus-exporter scripts.
+test_check_bpf: stap --bpf -p4 syscallsrw.stp
+test_installcheck_bpf: stap --bpf syscallsrw.stp -T 1
diff --git a/testsuite/systemtap.examples/profiling/syscallsrw.stp b/testsuite/systemtap.examples/profiling/syscallsrw.stp
new file mode 100755 (executable)
index 0000000..159c053
--- /dev/null
@@ -0,0 +1,18 @@
+#! /usr/bin/stap --bpf
+
+global arr
+
+probe kernel.function("ksys_read") !, kernel.function("vfs_read") {
+    arr[0]++;
+}
+
+probe kernel.function("ksys_write") !, kernel.function("vfs_write") {
+    arr[1]++;
+}
+
+probe prometheus {
+
+    $value .= ("count{syscall=\"ksys_read\"} " . sprint(arr[0]) . "\n")
+    $value .= ("count{syscall=\"ksys_write\"} " . sprint(arr[1]) . "\n")
+
+}
This page took 0.068176 seconds and 5 git commands to generate.