On Tue, 16 Nov 2021 20:21:52 +0100 Nicolas Saenz Julienne <nsaenzju@xxxxxxxxxx> wrote: > 'trace-cmd list -C' outputs 'tsc2nsec' on my arm64 machine. TSC is an > x86 specific counter, so it shouldn't be supported. Fix this by making > sure TSC exists as a trace clock in trace_tsc2nsec_is_supported(). TSC is just an acronym for Time Stamp Counter. Yes, x86 calls it the TSC, but really it can be any raw clock. If arm or any other arch has a raw clock that can write directly to the ring buffer, and perf has a way to convert that to nsecs, we should still be able to support it. For instance, I believe that powerpc has a ppc-tb clock that is similar to the tsc of x86. We probably should allow that too. Hmm, I wonder if the kernel should have a "raw_clock" if the raw time stamp is used for any arch, and the tsc2nsec can still be used if raw_clock is supported. That said, I agree that we should verify that the raw clock that is converted is available along with the perf info. -- Steve > > Signed-off-by: Nicolas Saenz Julienne <nsaenzju@xxxxxxxxxx> > --- > tracecmd/trace-record.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c > index 1767a6c..78e9566 100644 > --- a/tracecmd/trace-record.c > +++ b/tracecmd/trace-record.c > @@ -6122,6 +6122,9 @@ static int get_tsc_nsec(int *shift, int *mult) > > bool trace_tsc2nsec_is_supported(void) > { > + if (!clock_is_supported(NULL, TSC_CLOCK)) > + return false; > + > return get_tsc_nsec(NULL, NULL) == 0; > } >