[PATCH] examples: add timestamp to dropwatch.stp

Jamie Bainbridge jamie.bainbridge@gmail.com
Tue Nov 17 00:44:58 GMT 2020


When using dropwatch.stp to troubleshoot packet drops, it is often done
with additional troubleshooting such as packet captures and collections
of other commands like "ethtool -S" or "netstat -s".

To correspond traffic loss events across the various output, these
should all have timestamps.

Add ctime timestamp to dropwatch to enable this. Update documentation to
show example timestamp collection.

Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com>
---
 .../en-US/Useful_Scripts-dropwatch.xml                         | 3 +++
 testsuite/systemtap.examples/network/dropwatch.stp             | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-dropwatch.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-dropwatch.xml
index 73e4b0c347005758c2876449de4cd4c2acac38b2..f4afd00f9b466a9cf997f412b1d02bff75f0fa24 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-dropwatch.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-dropwatch.xml
@@ -85,14 +85,17 @@ each tracepoint location with either the function name or the address.
 	<title><xref linkend="dropwatch"/> Sample Output</title>
 <screen>Monitoring for dropped packets
 
+Tue Nov 17 00:26:51 2020
 1762 packets dropped at unix_stream_recvmsg
 4 packets dropped at tun_do_read
 2 packets dropped at nf_hook_slow
 
+Tue Nov 17 00:26:56 2020
 467 packets dropped at unix_stream_recvmsg
 20 packets dropped at nf_hook_slow
 6 packets dropped at tun_do_read
 
+Tue Nov 17 00:27:01 2020
 446 packets dropped at unix_stream_recvmsg
 4 packets dropped at tun_do_read
 4 packets dropped at nf_hook_slow
diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp
index 99062009ac2104762e264083fcd9ed322cbe6b5e..90419d5410225bc0fd0f13bff27d888f07d2cf6e 100755
--- a/testsuite/systemtap.examples/network/dropwatch.stp
+++ b/testsuite/systemtap.examples/network/dropwatch.stp
@@ -20,7 +20,7 @@ probe kernel.trace("kfree_skb") { locations[$location] <<< 1 }
 # Every 5 seconds report our drop locations
 probe timer.sec(5)
 {
-  printf("\n")
+  printf("\n%s\n", ctime(gettimeofday_s()))
   foreach (l in locations-) {
     printf("%d packets dropped at %s\n",
            @count(locations[l]), symname(l))
-- 
2.25.1



More information about the Systemtap mailing list