Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/dev/dtrace/aarch64/dtrace_subr.c
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
dtrace_sync(void) | dtrace_sync(void) | ||||
{ | { | ||||
dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL); | dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL); | ||||
} | } | ||||
/* | /* | ||||
* DTrace needs a high resolution time function which can | * DTrace needs a high resolution time function which can be called from a | ||||
* be called from a probe context and guaranteed not to have | * probe context and guaranteed not to have instrumented with probes itself. | ||||
* instrumented with probes itself. | |||||
* | * | ||||
* Returns nanoseconds since boot. | * Returns nanoseconds since some arbitrary point in time (likely SoC reset?). | ||||
*/ | */ | ||||
uint64_t | uint64_t | ||||
dtrace_gethrtime() | dtrace_gethrtime(void) | ||||
{ | { | ||||
struct timespec curtime; | uint64_t count, freq; | ||||
dtrace_getnanouptime(&curtime); | count = READ_SPECIALREG(cntvct_el0); | ||||
andrew: This is a generic counter, it may not be a cycle count in all implementations. | |||||
Done Inline ActionsMaybe just count? emaste: Maybe just `count`? | |||||
freq = READ_SPECIALREG(cntfrq_el0); | |||||
return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec); | return ((1000000000UL * count) / freq); | ||||
} | } | ||||
/* | |||||
* Return a much lower resolution wallclock time based on the system clock | |||||
* updated by the timer. If needed, we could add a version interpolated from | |||||
* the system clock as is the case with dtrace_gethrtime(). | |||||
*/ | |||||
uint64_t | uint64_t | ||||
dtrace_gethrestime(void) | dtrace_gethrestime(void) | ||||
{ | { | ||||
struct timespec current_time; | struct timespec current_time; | ||||
dtrace_getnanotime(¤t_time); | dtrace_getnanotime(¤t_time); | ||||
return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); | return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec); | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |
This is a generic counter, it may not be a cycle count in all implementations.