diff options
author | Evgeny Pinchuk <evgeny.pinchuk@amd.com> | 2014-07-29 13:57:10 +0300 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@amd.com> | 2014-07-29 13:57:10 +0300 |
commit | 5f106cf3e4be1de36ea1380cb1d43845c30ccec3 (patch) | |
tree | 278e29e5d50a779b0e4d81e2b10b752fa92dd2be | |
parent | 678287d98b2948d488dba604a3e87cfff94a0dbc (diff) |
Add clock counters module
Signed-off-by: Evgeny Pinchuk <evgeny.pinchuk@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
-rw-r--r-- | src/time.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -33,7 +33,29 @@ hsaKmtGetClockCounters( HsaClockCounters* Counters //OUT ) { + HSAKMT_STATUS result; + uint32_t gpu_id; + struct kfd_ioctl_get_clock_counters_args args; + int err; + CHECK_KFD_OPEN(); - return HSAKMT_STATUS_NOT_SUPPORTED; + result = validate_nodeid(NodeId, &gpu_id); + if (result != HSAKMT_STATUS_SUCCESS) + return result; + + args.gpu_id = gpu_id; + + err = kfd_ioctl(KFD_IOC_GET_CLOCK_COUNTERS, &args); + if (err < 0) { + result = HSAKMT_STATUS_ERROR; + } else { + /* At this point the result is already HSAKMT_STATUS_SUCCESS */ + Counters->GPUClockCounter = args.gpu_clock_counter; + Counters->CPUClockCounter = args.cpu_clock_counter; + Counters->SystemClockCounter = args.system_clock_counter; + Counters->SystemClockFrequencyHz = args.system_clock_freq; + } + + return result; } |