linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Campos <rodrigo@sdfg.com.ar>
To: Junjie Qian <junjie.qian@yahoo.com>
Cc: "linux-perf-users@vger.kernel.org" <linux-perf-users@vger.kernel.org>
Subject: Re: Profile the waiting time for lock or lock stats for one application
Date: Fri, 28 Feb 2014 18:43:43 +0000	[thread overview]
Message-ID: <20140228184343.GD10080@sdfg.com.ar> (raw)
In-Reply-To: <1393351991.27573.YahooMailNeo@web124901.mail.ne1.yahoo.com>

On Tue, Feb 25, 2014 at 10:13:11AM -0800, Junjie Qian wrote:
> Dear all,
> 
> I am working on one project, which tries to profile the lock stats for one application, such as total waiting time for locks or how many locks happens during the execution.

perf lock wouldn't help with that, IIUC. perf lock is for locks inside the
kernel.

There are ways (not sure if the patch is in) to track for lock contension using
perf, but not sure (I think not easy at least) if the lock is not contended. As,
if using glibc, lot of locks are implemented using futex and then solved
entirely in userspace lot of times (at least without contention).

Also, about stats such as the total waiting time, take into account that if you
have more threads than cores, there WILL be waiting time you can't reduce. For
some experiments I did (with #threads >> #cores) trying to measure waiting time
was pointeless, as that didn't help us in any way. And in some scenarios (cpu
hungry tasks, for example), it's not important to have threads waiting if all
your cores are active "most of the time".

So, for me (for my workloads), the waiting time was pointless and it was WAY
more useful trying to see "wasted" time. As I was trying to optimize a library,
I did some instrumentation on it to get the CPU time used by the library and
compare it against #cores * elapsed_time.





Hope it helps,
Rodrigo

  parent reply	other threads:[~2014-02-28 19:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 18:13 Profile the waiting time for lock or lock stats for one application Junjie Qian
2014-02-27  3:17 ` Junjie Qian
2014-02-27  3:29   ` David Ahern
2014-02-28 20:00     ` Junjie Qian
2014-02-28 18:43 ` Rodrigo Campos [this message]
2014-03-01 15:30   ` David Ahern
2014-03-01 16:03     ` Rodrigo Campos
2014-03-03 16:11       ` Junjie Qian
2014-03-03 16:23         ` Rodrigo Campos

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=20140228184343.GD10080@sdfg.com.ar \
    --to=rodrigo@sdfg.com.ar \
    --cc=junjie.qian@yahoo.com \
    --cc=linux-perf-users@vger.kernel.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 NNTP newsgroup(s).