Re: [PATCH v4] trace-cmd: Stop recording when processes traced with -P exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 May 2020 11:42:44 -0500
Bijan Tabatabai <bijan311@xxxxxxxxx> wrote:

> From: Bijan Tabatabai <bijan311@xxxxxxxxx>
> 
> When the -F flag is used in trace-cmd record, trace-cmd stops recording
> when the executable it is tracing terminates.
> This patch makes the -P flag act similarly.
> 
> Signed-off-by: Bijan Tabatabai <bijan311@xxxxxxxxx>
> ---
>  v4 fixes a bug where trace-cmd would stop tracing after the processes in
>  the first instance exited.
> ---
>  

Looks good, but there's one small nit.

> @@ -6361,7 +6441,16 @@ static void record_trace(int argc, char **argv,
>  		}
>  		/* sleep till we are woken with Ctrl^C */
>  		printf("Hit Ctrl^C to stop recording\n");
> -		while (!finished)
> +		for_all_instances(instance) {
> +			/* If an instance is not tracing individual processes
> +			 * or there is an error while waiting for a process to
> +			 * exit, fallback to waiting indefinitely.
> +			 */
> +			if (!instance->nr_process_pids
> +			    || trace_wait_for_processes(instance))

My preference is:

			if (!instance->nr_process_pids ||
			    trace_wait_for_processes(instance))

But I can make this change.

Thanks!

-- Steve

> +				wait_indefinitely = true;
> +		}
> +		while (!finished && wait_indefinitely)
>  			trace_or_sleep(type, pwait);
>  	}
>  




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux