@@ -125,6 +125,7 @@ enum {
TRACECMD_OPTION_TRACEID,
TRACECMD_OPTION_TIME_SHIFT,
TRACECMD_OPTION_GUEST,
+ TRACECMD_OPTION_TSC2NSEC,
};
enum {
@@ -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);
Added a define for a new trace.dat file option for tsc2nsec conversion. Added logic in "trace-cmd dump" for parsig the option and printing its content. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- .../include/private/trace-cmd-private.h | 1 + tracecmd/trace-dump.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)