[PATCH] Optionally produce stats on syscall latency
Dmitry V. Levin
ldv at altlinux.org
Fri May 30 00:42:34 UTC 2014
On Wed, May 28, 2014 at 05:52:40PM +0100, Mark Hills wrote:
> Time spent in system time is not useful where a syscall depends on some
> non-CPU resource, eg. typically open() or stat() to a network drive.
>
> This patch adds a new flag (-w) to produce a summary of the time
> difference between beginning and end of the system call (ie. latency)
>
> This functionality has been useful to profile slow processes that
> are not CPU-bound.
>
> Signed-off-by: Mark Hills <mark.hills at framestore.com>
> ---
> NEWS | 3 +++
> count.c | 4 ++--
> defs.h | 1 +
> strace.1 | 4 ++++
> strace.c | 11 ++++++++++-
> 5 files changed, 20 insertions(+), 3 deletions(-)
[...]
> @@ -72,7 +72,7 @@ count_syscall(struct tcb *tcp, struct timeval *tv)
> tv_sub(tv, tv, &tcp->etime);
>
> /* Spent more wall clock time than spent system time? (usually yes) */
> - if (tv_cmp(tv, &tcp->dtime) > 0) {
> + if (!count_wallclock && tv_cmp(tv, &tcp->dtime) > 0) {
> static struct timeval one_tick = { -1, 0 };
>
> if (one_tick.tv_sec == -1) {
One of simple tests I wrote for this new option failed:
strace -cw -enanosleep sleep 1
I had to change count_syscall() a bit so that -w option wouldn't affect
overhead estimation algorithm. Besides that, everything looks fine.
Thanks!
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140530/177bf6c4/attachment.bin>
More information about the Strace-devel
mailing list