Introduce a new API roctracer_get_timestamp().

roctracer_status_t roctracer_get_timestamp(uint64_t* timestamp);

Get system timestamp for roctracer clients.

The API could be used to help roctracer clients understand the reference frame
of timestamps when receiving activity callbacks, as the nanoseconds reported in
the activity callbacks are not in the same reference frame as CPU walltime
clock.
This commit is contained in:
Wen-Heng (Jack) Chung
2019-12-19 18:03:40 +00:00
parent 23a1d54acf
commit b7aa8fedb7
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -1106,6 +1106,12 @@ PUBLIC_API void roctracer_unload(bool destruct) {
ONLOAD_TRACE_END();
}
PUBLIC_API roctracer_status_t roctracer_get_timestamp(uint64_t* timestamp) {
API_METHOD_PREFIX
*timestamp = util::HsaRsrcFactory::Instance().TimestampNs();
API_METHOD_SUFFIX
}
PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count,
const char* const* failed_tool_names) {
ONLOAD_TRACE_BEG();