Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/include/cpu.h
Show All 34 Lines | if (pmu_attched) { | ||||
/* Make sure there was no wrap-around while we read the lo half. */ | /* Make sure there was no wrap-around while we read the lo half. */ | ||||
h2 = (uint64_t)atomic_load_acq_32(&ccnt_hi[cpu]); | h2 = (uint64_t)atomic_load_acq_32(&ccnt_hi[cpu]); | ||||
if (h != h2) | if (h != h2) | ||||
l = cp15_pmccntr_get(); | l = cp15_pmccntr_get(); | ||||
return (h2 << 32 | l); | return (h2 << 32 | l); | ||||
} else | } else | ||||
#endif | #endif | ||||
return cp15_pmccntr_get(); | return cp15_pmccntr_get(); | ||||
#else /* No performance counters, so use binuptime(9). This is slooooow */ | #else /* No performance counters, so use nanotime(9). */ | ||||
struct bintime bt; | struct timespec tv; | ||||
binuptime(&bt); | nanotime(&tv); | ||||
return ((uint64_t)bt.sec << 56 | bt.frac >> 8); | return (tv.tv_sec * (uint64_t)1000000000ull + tv.tv_nsec); | ||||
#endif | #endif | ||||
} | } | ||||
#endif | #endif | ||||
#define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) | #define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) | ||||
#define TRAPF_PC(tfp) ((tfp)->tf_pc) | #define TRAPF_PC(tfp) ((tfp)->tf_pc) | ||||
Show All 34 Lines |