Documented new trace-cmd options
cover Documented new trace-cmd options
Documented newly added trace-cmd options. Extended trace-cmd list command to show new clock.
Tzvetomir Stoyanov (VMware) (4):
trace-cmd: Add internal API to check if tsc2nsec is supported
trace-cmd: Add tsc2nsec clock to "list -C" command
trace-cmd: Document --tsc2nsec option
trace-cmd: Document --raw-ts option
Documentation/trace-cmd/trace-cmd-record.1.txt | 5 +++++ Documentation/trace-cmd/trace-cmd-report.1.txt | 3 +++ tracecmd/include/trace-local.h | 2 ++ tracecmd/trace-list.c | 16 +++++++++++++++- tracecmd/trace-record.c | 5 +++++ tracecmd/trace-usage.c | 3 +++ 6 files changed, 33 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
PATCH 1/4 trace-cmd: Add internal API to check if tsc2nsec is supported
A new internal API is added to check is tsc to nanoseconds conversion is supported:
bool trace_tsc2nsec_is_supported(void);
--- tracecmd/include/trace-local.h | 2 ++ tracecmd/trace-record.c | 5 +++++ 2 files changed, 7 insertions(+)
tracecmd/include/trace-local.h +2 -0
@@ -341,4 +341,6 @@ static inline bool is_digits(const char *s) return true; } +bool trace_tsc2nsec_is_supported (void ); +#endif /* __TRACE_LOCAL_H */
tracecmd/trace-record.c +5 -0
@@ -5827,6 +5827,11 @@ static int get_tsc_nsec(int *shift, int *mult) }#endif +bool trace_tsc2nsec_is_supported (void ) +{ +return (get_tsc_nsec (NULL ,NULL ) ==0 ); +} + static void parse_record_options(int argc, char **argv, enum trace_cmd curr_cmd,
Signature · 1 line
2.30.2
Re: [PATCH 1/4] trace-cmd: Add internal API to check if tsc2nsec is supported
Quoted 26 lines · On Mon, 29 Mar 2021 15:58:18 +0300 "Tzvetomir Stoyanov (VMware)"…
A new internal API is added to check is tsc to nanoseconds conversion is supported:
booltrace_tsc2nsec_is_supported(void);Signed-off-by Tzvetomir Stoyanov (VMware) <[email protected]>--- tracecmd/include/trace-local.h | 2 ++ tracecmd/trace-record.c | 5 +++++ 2 files changed, 7 insertions(+)tracecmd/include/trace-local.h +2
-0@@ -341,4 +341,6 @@ static inline bool is_digits(const char *s) return true; } +bool trace_tsc2nsec_is_supported (void ); +#endif /* __TRACE_LOCAL_H */ tracecmd/trace-record.c +0
-0
tracecmd/trace-record.c static int get_tsc_nsec(int *shift, int *mult) · line 5832
Quoted 6 lines
tracecmd/trace-record.c +3
-0@@ -5827,6 +5827,11 @@ static int get_tsc_nsec(int *shift, int *mult) }#endif +bool trace_tsc2nsec_is_supported (void ) +{ +return (get_tsc_nsec (NULL ,NULL ) ==0 );
Return is not a function, no need for the external parenthesis.
-- Steve
Quoted 5 lines
tracecmd/trace-record.c +2
-0+} + static void parse_record_options(int argc, char **argv, enum trace_cmd curr_cmd,
PATCH 2/4 trace-cmd: Add tsc2nsec clock to "list -C" command
In reply to Tzvetomir Stoyanov (VMware)Extended the "trace-cmd list -C" command to show tsc2nsec clock, if supported.
--- tracecmd/trace-list.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
tracecmd/trace-list.c +15 -1
@@ -264,7 +264,21 @@ static void show_options(void)static void show_clocks (void ) { -show_file ("trace_clock" ); +char *clocks; +int size; + + clocks =tracefs_instance_file_read (NULL ,"trace_clock" , &size); +if (!clocks) +die ("getting clocks" ); +if (clocks[size -1 ] =='\n' ) + clocks[size -1 ] =0 ; + +if (trace_tsc2nsec_is_supported ()) +printf ("%s %s\n" , clocks,TSCNSEC_CLOCK ); +else +printf ("%s\n" , clocks); + +free (clocks); }
Signature · 1 line
2.30.2
PATCH 3/4 trace-cmd: Document --tsc2nsec option
In reply to Tzvetomir Stoyanov (VMware)Document the "trace-cmd record --tsc2nsec" option.
--- Documentation/trace-cmd/trace-cmd-record.1.txt | 5 +++++ tracecmd/trace-usage.c | 2 ++ 2 files changed, 7 insertions(+)
Documentation/trace-cmd/trace-cmd-record.1.txt +5 -0
@@ -349,6 +349,11 @@ OPTIONS at the beginning and at the end of the trace. Timestamps synchronization with guests works only if there is support for VSOCK.\n" +*--tsc2nsec*:: + Convert the current clock to nanoseconds, using tsc multiplier and shift from the Linux + kernel's perf interface. This option does not change the trace clock, just assumes that + the tsc multiplier and shift are applicable for the selected clock. You may use the + "-C tsc2nsec" clock, if not sure what clock to select. *--stderr*:: Have output go to stderr instead of stdout, but the output of the command executed will not be changed. This is useful if you want to monitor the
tracecmd/trace-usage.c +2 -0
@@ -62,6 +62,8 @@ static struct usage_help usage_help[] = {" --no-filter include trace-cmd threads in the trace\n" " --proc-map save the traced processes address map into the trace.dat file\n" " --user execute the specified [command ...] as given user\n" +" --tsc2nsec Convert the current clock to nanoseconds, using tsc multiplier and shift from the Linux" +" kernel's perf interface\n" " --tsync-interval set the loop interval, in ms, for timestamps synchronization with guests:" " If a negative number is specified, timestamps synchronization is disabled" " If 0 is specified, no loop is performed - timestamps offset is calculated only twice,"
Signature · 1 line
2.30.2
PATCH 4/4 trace-cmd: Document --raw-ts option
In reply to Tzvetomir Stoyanov (VMware)Documented "trace-cmd report --raw-ts" option
--- Documentation/trace-cmd/trace-cmd-report.1.txt | 3 +++ tracecmd/trace-usage.c | 1 + 2 files changed, 4 insertions(+)
Documentation/trace-cmd/trace-cmd-report.1.txt +3 -0
@@ -309,6 +309,9 @@ OPTIONS Make sure no timestamp goes backwards, and if it does, print out a warning message of the fact. +*--raw-ts*:: + Display raw timestamps, without any corrections. + EXAMPLES --------
tracecmd/trace-usage.c +1 -0
@@ -233,6 +233,7 @@ static struct usage_help usage_help[] = {" previous data file, in which case it becomes default\n" " --ts-diff Show the delta timestamp between events.\n" " --ts-check Check to make sure no time stamp on any CPU goes backwards.\n" +" --raw-ts Display raw timestamps, without any corrections.\n" }, { "stream",
Signature · 1 line
2.30.2