Re: [PATCH v2 13/18] trace-cmd: Set order and priorities when applying timestamp corrections

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

 



On Mon, 22 Mar 2021 11:59:40 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> @@ -1296,17 +1287,26 @@ static unsigned long long timestamp_correct(unsigned long long ts,
>  static unsigned long long timestamp_calc(unsigned long long ts,
>  					 struct tracecmd_input *handle)
>  {
> -	unsigned long long t;
> +	unsigned long long t = ts;

OK, now you are just wasting away extra variables!!!! ;-)

Just use ts, no need to create a local variable. It's OK to reuse the
parameters. gcc will just do it for you anyway.

-- Steve

>  
> -	t = timestamp_correct(ts, handle);
>  
> -	if (handle->ts2secs)
> +	/* Guest trace file, sync with host timestamps */
> +	if (handle->host.sync_enable)
> +		t = timestamp_host_sync(ts, handle);
> +
> +	if (handle->ts2secs) {
> +		/* user specified clock frequency */
>  		t *= handle->ts2secs;
> -	else if (handle->tsc_calc.mult) {
> +	} else if (handle->tsc_calc.mult) {
> +		/* auto calculated TSC clock frequency */
>  		t -= handle->tsc_calc.offset;
>  		t = mul_u64_u32_shr(t, handle->tsc_calc.mult, handle->tsc_calc.shift);
>  	}
>  
> +	/* User specified time offset with --ts-offset or --date options */
> +	if (handle->ts_offset)
> +		t += handle->ts_offset;
> +
>  	return t;
>  }
>  



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

  Powered by Linux