about summary refs log tree commit homepage
path: root/tapset/all.stp
diff options
context:
space:
mode:
Diffstat (limited to 'tapset/all.stp')
-rw-r--r--tapset/all.stp182
1 files changed, 109 insertions, 73 deletions
diff --git a/tapset/all.stp b/tapset/all.stp
index 600c07a..0b9e194 100644
--- a/tapset/all.stp
+++ b/tapset/all.stp
@@ -1,129 +1,165 @@
 /*
  * This is an extremely detailed tapset for capturing all supported probe
  * points in the current version of cmogstored.  It likely contains too much
- * information to be useful, extracting relevant probes is recommended.
+ * information to be useful, extracting relevant probes is recommended,
+ * as is filtering this through an awk (or your favorite scripting language)
  */
 
-/* keyed by: [pid(),fd] */
-global cmogstored_http_req_begin;
-global cmogstored_http_pipelined;
-global cmogstored_http_addr;
-global cmogstored_fd_by_tid;
+/* avoid triggering copy faults because systemtap avoids page faults */
+function cmogstored_user_string(a) {
+        try {
+                s = user_string(a);
+        } catch {
+                s = "???";
+        }
+        return s;
+}
 
 probe process("cmogstored").mark("http_accepted") {
         fd = $arg1;
-        host = user_string($arg2);
-        serv = user_string($arg3);
-        listen = user_string($arg4);
-        host_serv = sprintf("%s%s", host, serv);
-        printf("% 6d % 6d accepted %s on %s\n", pid(), fd, host_serv, listen);
-        cmogstored_http_addr[pid(),fd] = host_serv;
+        host = cmogstored_user_string($arg2);
+        serv = cmogstored_user_string($arg3);
+        listen = cmogstored_user_string($arg4);
+        printf("% 6d % 6d http_accepted %s %s %s\n",
+                pid(), fd, host, serv, listen);
 }
 
 /*
- * mog_ioq_ready..ioq_reschedule   = time waiting for others to finish IO
- * ioq_reschedule..mog_ioq_unblock = time inside epoll ready list
+ * ioq_blocked..ioq_reschedule   = time waiting for others to finish IO
+ * ioq_reschedule..ioq_unblocked = time inside epoll ready list
  */
+probe process("cmogstored").mark("ioq_blocked") {
+        fd = $arg1;
+        printf("% 6d % 6d ioq_blocked %u\n", pid(), fd, gettimeofday_us());
+}
 
-/* associate the fd with thread for the function return */
-probe process("cmogstored").function("mog_ioq_ready") {
-        cmogstored_fd_by_tid[tid()] = @cast($mfd, "struct mog_fd")->fd;
+probe process("cmogstored").mark("http_req_start") {
+        fd = $arg1;
+        method = cmogstored_user_string($arg2);
+        path = cmogstored_user_string($arg3);
+        printf("% 6d % 6d http_req_start %s %s\n", pid(), fd, method, path);
 }
 
-/*
- * if mog_ioq_ready returns false, we are blocked waiting on I/O and
- * will hit ioq_reschedule
- */
-probe process("cmogstored").function("mog_ioq_ready").return {
-        if (!$return)
-                printf("% 6d % 6d ioq blocked\n",
-                        pid(), cmogstored_fd_by_tid[tid()]);
+probe process("cmogstored").mark("http_res_start") {
+        fd = $arg1;
+        try {
+                code = user_string_n($arg2, 3);
+        } catch {
+                code = "???";
+        }
+        printf("% 6d % 6d http_res_start %s\n", pid(), fd, code);
 }
 
 /*
  * we hit ioq_reschedule when we are ready to enter the epoll ready-list
- * we will hit mog_ioq_unblock eventually
+ * we will hit ioq_unblocked eventually
  */
 probe process("cmogstored").mark("ioq_reschedule") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d ioq reschedule_enter\n", pid(), fd);
-}
-
-/* associate the fd with thread for the function return */
-probe process("cmogstored").function("mog_ioq_unblock") {
-        cmogstored_fd_by_tid[tid()] = @cast($mfd, "struct mog_fd")->fd;
+        fd = $arg1;
+        printf("% 6d % 6d ioq_reschedule %u\n", pid(), fd, gettimeofday_us());
 }
 
 /*
- * if mog_ioq_unblock returns true, it means the fd was previously
+ * if ioq_unblock returns true, it means the fd was previously
  * in ioq_reschedule
  */
-probe process("cmogstored").function("mog_ioq_unblock").return {
-        if ($return)
-                printf("% 6d % 6d ioq reschedule_done\n",
-                        pid(), cmogstored_fd_by_tid[tid()]);
+probe process("cmogstored").mark("ioq_unblocked") {
+        fd = $arg1;
+        printf("% 6d % 6d ioq_unblocked %u\n", pid(), fd, gettimeofday_us());
 }
 
 /*
  * HTTP client disconnected
  */
-probe process("cmogstored").function("http_close") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d closing\n", pid(), fd);
-        delete cmogstored_http_addr[pid(),fd];
+probe process("cmogstored").mark("http_client_close") {
+        fd = $arg1;
+        printf("% 6d % 6d http_client_close\n", pid(), fd);
 }
 
 /*
  * We start reading/buffering the HTTP request here
  */
 probe process("cmogstored").mark("http_req_begin") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        is_pipelined = $arg1;
-        cmogstored_http_req_begin[pid(),fd] = gettimeofday_us();
-        cmogstored_http_pipelined[pid(),fd] = is_pipelined;
-}
-
-/*
- * we start processing the HTTP request (opening/stat-ing files)
- */
-probe process("cmogstored").function("http_process_client") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        starttime = cmogstored_http_req_begin[pid(),fd];
-        diff = gettimeofday_us() - starttime;
-
-        is_pipelined = cmogstored_http_pipelined[pid(),fd];
-        printf("% 6d % 6d http_process_client time %ldus (pipelined:%s)\n",
-                pid(), fd, diff, is_pipelined ? "true" : "false");
+        fd = $arg1;
+        is_pipelined = $arg2;
+        printf("% 6d % 6d http_req_begin %u %u\n",
+                pid(), fd, gettimeofday_us(), is_pipelined);
 }
 
 /*
  * We blocked on writing (HTTP headers) to the client socket
  */
 probe process("cmogstored").mark("write_buffered") {
-        printf("% 6d % 6d blocked with %lu bytes to write\n",
-                pid(), $fd, $len);
+        fd = $arg1;
+        len = $arg2;
+        printf("% 6d % 6d write_buffered %lu\n", pid(), fd, len);
 }
 
 /* signals a client is making us reallocate on large requests */
-probe process("cmogstored").function("http_rbuf_grow") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d http_rbuf_grow %lu\n", pid(), fd, $buf_len);
+probe process("cmogstored").mark("http_rbuf_grow") {
+        fd = $arg1;
+        buf_len = $arg2;
+        printf("% 6d % 6d http_rbuf_grow %lu\n", pid(), fd, buf_len);
 }
 
 /* signals a client is making us reallocate on large requests */
-probe process("cmogstored").function("mgmt_rbuf_grow") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d mgmt_rbuf_grow %lu\n", pid(), fd, $buf_len);
+probe process("cmogstored").mark("mgmt_rbuf_grow") {
+        fd = $arg1;
+        buf_len = $arg2;
+        printf("% 6d % 6d mgmt_rbuf_grow %lu\n", pid(), fd, buf_len);
 }
 
 /* this signals a client is trickling requests to us */
-probe process("cmogstored").function("http_parse_continue") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d http_parse_continue %lu\n", pid(), fd, $buf_len);
+probe process("cmogstored").mark("http_parse_continue") {
+        fd = $arg1;
+        buf_len = $arg2;
+        printf("% 6d % 6d http_parse_continue %lu\n", pid(), fd, buf_len);
 }
 
 /* this signals a client is trickling requests to us */
-probe process("cmogstored").function("mgmt_parse_continue") {
-        fd = @cast($mfd, "struct mog_fd")->fd;
-        printf("% 6d % 6d mgmt_parse_continue %lu\n", pid(), fd, $buf_len);
+probe process("cmogstored").mark("mgmt_parse_continue") {
+        fd = $arg1;
+        buf_len = $arg2;
+        printf("% 6d % 6d mgmt_parse_continue %lu\n", pid(), fd, buf_len);
+}
+
+probe process("cmogstored").mark("mgmt_dig_start") {
+        fd = $arg1;
+
+        /* ref: lib/gc.h from gnulib */
+        if ($arg2 == 1) {
+                alg = "MD5";
+        } else if ($arg2 == 2) {
+                alg = "SHA-1";
+        } else {
+                alg = sprintf("???=%d", $arg2);
+        }
+
+        path = cmogstored_user_string($arg3);
+        printf("% 6d % 6d mgmt_dig_start %s %s\n", pid(), fd, alg, path);
+}
+
+probe process("cmogstored").mark("mgmt_dig_done") {
+        fd = $arg1;
+        if ($arg2 == 0) {
+                printf("% 6d % 6d mgmt_dig_done OK\n", pid(), fd);
+        } else if ($arg2 == -1) {
+                printf("% 6d % 6d mgmt_dig_done MISSING\n",
+                        pid(), fd);
+        } else {
+                printf("% 6d % 6d mgmt_dig_done fail_offset=%ld\n",
+                        pid(), fd, $arg2);
+        }
+}
+
+probe process("cmogstored").mark("http_bytes_xfer") {
+        fd = $arg1;
+        bytes = $arg2;
+
+        printf("% 6d % 6d http_bytes_xfer %d\n", pid(), fd, bytes);
+}
+
+probe process("cmogstored").mark("http_res_done") {
+        fd = $arg1;
+        printf("% 6d % 6d http_res_done %u\n", pid(), fd, gettimeofday_us());
 }