Hi Vincent,

On Wed, 4 Feb 2015 10:06:44 +0100
Vincent Stehlé <[email protected]> wrote:


> diff --git a/trace-record.c b/trace-record.c
> index 18e2e2d..a230fde 100644
> --- a/trace-record.c
> +++ b/trace-record.c
> @@ -837,6 +837,7 @@ static pid_t trace_waitpid(enum trace_type type, pid_t 
> pid, int *status, int opt
>       struct timeval tv = { 1, 0 };
>       int ret;
>       int profile = (type & TRACE_TYPE_PROFILE) == TRACE_TYPE_PROFILE;
> +     struct timespec req;
>  

Instead of the nanosleep, I'm wondering if we should do this instead:

        if (type & TRACE_TYPE_STREAM)
                options |= WNOHANG;

Because it only needs not to wait if it is live streaming. Otherwise
we want to wait.

-- Steve

>       options |= WNOHANG;
>  
> @@ -847,6 +848,11 @@ static pid_t trace_waitpid(enum trace_type type, pid_t 
> pid, int *status, int opt
>  
>               if (type & TRACE_TYPE_STREAM)
>                       trace_stream_read(pids, recorder_threads, &tv, profile);
> +
> +             req.tv_sec = sleep_time / 1000000;
> +             req.tv_nsec = (sleep_time % 1000000) * 1000;
> +             nanosleep(&req, NULL);
> +
>       } while (1);
>  }
>  #ifndef NO_PTRACE

--
To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to