Which clock is used in GTE timestamps?

In Welcome — Jetson Linux<br/>Developer Guide 34.1 documentation

gte_mon prints “HW timestamp GPIO EVENT xxxx.”

What is the clock of this timestamp? How can I read this clock used by GPIO timestamps so that I can correlate the GPIO timestamps to system time? The clock was not the same with CLOCK_MONOTONIC in my tests.

hello xlz,

it’s TSC for hardware timestamp.
you may also refer to forum discussion thread, Topic 78821 for the details of timestamps.
thanks

Ah yes, thanks.

This is documented by the NVIDIA Xavier Series System-on-ChipTechnical Reference Manual, section 8.1.2.21.8 Timestamping (GTE): The AON cluster implements a timestamp module (GTE) for logging the current TSC value when interrupts or GPIO events occur.

The TSC can be read with

int64_t tsc;
asm volatile("mrs %0, cntvct_el0" : "=r"(tsc));
int64_t freq;
asm volatile("mrs %0, cntfrq_el0" : "=r"(freq));

freq should be 31.25M.