Re: [PATCH v2 05/18] trace-cmd: Add a new option in trace file metadata for tsc2nsec conversion

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

 



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

> A new option is added in the trace.dat file for holding the multiplier
> and shift, used for converting TSC trace clock to nanoseconds.
> 

Did you forgot to commit something in this patch? because the below
change doesn't match the change log. I was expecting to see the code
that adds the new option, but the code below is only code to have
trace-cmd dump output it.

-- Steve


> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> ---
>  .../include/private/trace-cmd-private.h       |  1 +
>  tracecmd/trace-dump.c                         | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
> index a4637046..ce3d8dc0 100644
> --- a/lib/trace-cmd/include/private/trace-cmd-private.h
> +++ b/lib/trace-cmd/include/private/trace-cmd-private.h
> @@ -125,6 +125,7 @@ enum {
>  	TRACECMD_OPTION_TRACEID,
>  	TRACECMD_OPTION_TIME_SHIFT,
>  	TRACECMD_OPTION_GUEST,
> +	TRACECMD_OPTION_TSC2NSEC,
>  };
>  
>  enum {
> diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
> index 4bdfd53f..31b9d201 100644
> --- a/tracecmd/trace-dump.c
> +++ b/tracecmd/trace-dump.c
> @@ -483,6 +483,22 @@ out:
>  	free(buf);
>  }
>  
> +void dump_option_tsc2nsec(int fd, int size)
> +{
> +	int mult, shift;
> +	unsigned long long offset;
> +
> +	do_print(OPTIONS, "\n\t\t[Option TSC2NSEC, %d bytes]\n", size);
> +
> +	if (read_file_number(fd, &mult, 4))
> +		die("cannot read tsc2nsec multiplier");
> +	if (read_file_number(fd, &shift, 4))
> +		die("cannot read tsc2nsec shift");
> +	if (read_file_number(fd, &offset, 8))
> +		die("cannot read tsc2nsec offset");
> +	do_print(OPTIONS, "%d %d %llu [multiplier, shift, offset]\n", mult, shift, offset);
> +}
> +
>  static void dump_options(int fd)
>  {
>  	unsigned short option;
> @@ -543,6 +559,9 @@ static void dump_options(int fd)
>  		case TRACECMD_OPTION_GUEST:
>  			dump_option_guest(fd, size);
>  			break;
> +		case TRACECMD_OPTION_TSC2NSEC:
> +			dump_option_tsc2nsec(fd, size);
> +			break;
>  		default:
>  			do_print(OPTIONS, " %d %d\t[Unknown option, size - skipping]\n",
>  				 option, size);




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

  Powered by Linux