public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] fix aggregate stats in mutex-contention example
@ 2013-05-22 20:04 Peter Feiner
  2013-06-24 18:16 ` David Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Feiner @ 2013-05-22 20:04 UTC (permalink / raw)
  To: systemtap; +Cc: Peter Feiner

Stats that were supposed to be collected per FUTEX_WAIT call site were being
collected per mutex init stack. So, in the "aggregate stats" section of the
report, you'd see a bunch of stacks with pthread_mutex_init at the top ... which
was very confusing because a futex isn't contended when it's created :-)
---
 .../process/mutex-contention.stp                   |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/testsuite/systemtap.examples/process/mutex-contention.stp b/testsuite/systemtap.examples/process/mutex-contention.stp
index 4bd0486..eec4b4c 100755
--- a/testsuite/systemtap.examples/process/mutex-contention.stp
+++ b/testsuite/systemtap.examples/process/mutex-contention.stp
@@ -65,26 +65,22 @@ probe syscall.futex.return {
   if (keep_stats) {
     mutex_contention[$uaddr] <<< elapsed
     stack = sprint_ubacktrace()
+    mutex_cont_stack[stack] <<< elapsed
     mutex_last_cont_stack[$uaddr] = stack
     if ($uaddr in mutex_init_stack) {
       if (verbose) {
         printf("contention time %d on mutex %p initialized at\n%s\n", elapsed, $uaddr, mutex_init_stack[$uaddr])
       }
-      stack = mutex_init_stack[$uaddr]
-      mutex_cont_stack[stack] <<< elapsed
     } else if ($uaddr in mutex_uninit) {
       if (verbose) {
         printf("contention time %d on popup mutex %p at\n%s\n", elapsed, $uaddr, stack)
       }
-      stack = mutex_uninit[$uaddr]
-      mutex_cont_stack[stack] <<< elapsed
     } else {
       if (verbose) {
         printf("contention time %d on popup mutex %p at\n%s\n", elapsed, $uaddr, stack)
       }
       mutex_uninit[$uaddr] = stack
       mutex_names[$uaddr] = usymdata ($uaddr)
-      mutex_cont_stack[stack] <<< elapsed
     }
   } else {
     printf("contention %p elapsed %d at\n%s\n", $uaddr, elapsed, sprint_ubacktrace())
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix aggregate stats in mutex-contention example
  2013-05-22 20:04 [PATCH] fix aggregate stats in mutex-contention example Peter Feiner
@ 2013-06-24 18:16 ` David Smith
  0 siblings, 0 replies; 2+ messages in thread
From: David Smith @ 2013-06-24 18:16 UTC (permalink / raw)
  To: Peter Feiner; +Cc: systemtap

On 05/22/2013 03:04 PM, Peter Feiner wrote:
> Stats that were supposed to be collected per FUTEX_WAIT call site were being
> collected per mutex init stack. So, in the "aggregate stats" section of the
> report, you'd see a bunch of stacks with pthread_mutex_init at the top ... which
> was very confusing because a futex isn't contended when it's created :-)

I've checked your change in with the following commit.

====
commit 8f923ff46ae2f91ccea95737fca3524c861a553c
Author: Peter Feiner <peter@gridcentric.ca>
Date:   Mon Jun 24 13:11:42 2013 -0500

    Updated testsuite/systemtap.examples/process/mutex_contention.stp
example.

    Stats that were supposed to be collected per FUTEX_WAIT call site were
    being collected per mutex init stack. So, in the "aggregate stats"
section
    of the report, you'd see a bunch of stacks with pthread_mutex_init
at the
    top, which was very confusing because a futex isn't contended when it's
    created.
====

Thanks for the update - sorry this response took so long.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-24 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-22 20:04 [PATCH] fix aggregate stats in mutex-contention example Peter Feiner
2013-06-24 18:16 ` David Smith

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).