public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Jamie Bainbridge <jamie.bainbridge@gmail.com>
To: systemtap@sourceware.org
Subject: [PATCH] examples: add timestamp to dropwatch.stp
Date: Tue, 17 Nov 2020 10:44:58 +1000	[thread overview]
Message-ID: <1aa57ad4ab800448ce23d00096d58ab48955a65e.1605573722.git.jamie.bainbridge@gmail.com> (raw)

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


                 reply	other threads:[~2020-11-17  0:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1aa57ad4ab800448ce23d00096d58ab48955a65e.1605573722.git.jamie.bainbridge@gmail.com \
    --to=jamie.bainbridge@gmail.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).