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 <[email protected]>
> ---
>  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

Attachment: pgpZoNhS9VLEu.pgp
Description: PGP signature

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to