SWDEV-540648: Adding realtime clock to v3 tool. Update decoder header. (#666)

* SWDEV-540648: Adding realtime clock to v3 tool. Update header for decoder.

* Adding tests

* Review comments

* Review comment
This commit is contained in:
Giovanni Lenzi Baraldi
2025-09-10 12:39:27 +02:00
committed by GitHub
parent 4e9acd492d
commit 9849073836
18 changed files with 193 additions and 82 deletions
@@ -150,6 +150,7 @@ ROCPROFILER_CXX_DECLARE_OPERATORS(const rocprofiler_counter_record_dimension_ins
ROCPROFILER_CXX_DECLARE_OPERATORS(const rocprofiler_counter_dimension_info_t&)
ROCPROFILER_CXX_DECLARE_OPERATORS(rocprofiler_version_triplet_t)
ROCPROFILER_CXX_DECLARE_OPERATORS(rocprofiler_thread_trace_decoder_id_t)
ROCPROFILER_CXX_DECLARE_OPERATORS(rocprofiler_thread_trace_decoder_pc_t)
// definitions of operator==
ROCPROFILER_CXX_DEFINE_EQ_HANDLE_OPERATOR(rocprofiler_context_id_t)
@@ -226,6 +227,12 @@ operator==(rocprofiler_version_triplet_t lhs, rocprofiler_version_triplet_t rhs)
return std::tie(lhs.major, lhs.minor, lhs.patch) == std::tie(rhs.major, rhs.minor, rhs.patch);
}
inline bool
operator==(rocprofiler_thread_trace_decoder_pc_t lhs, rocprofiler_thread_trace_decoder_pc_t rhs)
{
return std::tie(lhs.code_object_id, lhs.address) == std::tie(rhs.code_object_id, rhs.address);
}
// definitions of operator!=
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(rocprofiler_context_id_t)
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(rocprofiler_address_t)
@@ -245,6 +252,7 @@ ROCPROFILER_CXX_DEFINE_NE_OPERATOR(hsa_region_t)
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(hsa_amd_memory_pool_t)
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(rocprofiler_version_triplet_t)
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(rocprofiler_thread_trace_decoder_id_t)
ROCPROFILER_CXX_DEFINE_NE_OPERATOR(rocprofiler_thread_trace_decoder_pc_t)
// definitions of operator<
ROCPROFILER_CXX_DEFINE_LT_HANDLE_OPERATOR(rocprofiler_context_id_t)
@@ -321,6 +329,12 @@ operator<(rocprofiler_version_triplet_t lhs, rocprofiler_version_triplet_t rhs)
return std::tie(lhs.major, lhs.minor, lhs.patch) < std::tie(rhs.major, rhs.minor, rhs.patch);
}
inline bool
operator<(rocprofiler_thread_trace_decoder_pc_t lhs, rocprofiler_thread_trace_decoder_pc_t rhs)
{
return std::tie(lhs.code_object_id, lhs.address) < std::tie(rhs.code_object_id, rhs.address);
}
// definitions of operator>, operator<=, operator>=
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(rocprofiler_context_id_t)
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(rocprofiler_address_t)
@@ -340,6 +354,7 @@ ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(hsa_region_t)
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(hsa_amd_memory_pool_t)
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(rocprofiler_version_triplet_t)
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(rocprofiler_thread_trace_decoder_id_t)
ROCPROFILER_CXX_DEFINE_COMPARE_OPERATORS(rocprofiler_thread_trace_decoder_pc_t)
// cleanup defines
#undef ROCPROFILER_CXX_DECLARE_OPERATORS
@@ -49,8 +49,8 @@ typedef enum rocprofiler_thread_trace_decoder_info_t
*/
typedef struct rocprofiler_thread_trace_decoder_pc_t
{
size_t addr; ///< Memory address (marker_id == 0), or ELF vaddr (marker_id != 0).
size_t marker_id; ///< Code object load ID. Zero if no code object was found.
uint64_t address; ///< Address (code_object_id == 0), or ELF vaddr (code_object_id != 0)
uint64_t code_object_id; ///< Zero if no code object was found.
} rocprofiler_thread_trace_decoder_pc_t;
/**
@@ -163,8 +163,8 @@ typedef struct rocprofiler_thread_trace_decoder_wave_t
int64_t begin_time; ///< Wave begin time. Should match occupancy event wave start.
int64_t end_time; ///< Wave end time. Should match occupancy event wave end.
size_t timeline_size; ///< timeline_array size
size_t instructions_size; ///< instructions_array size
uint64_t timeline_size; ///< timeline_array size
uint64_t instructions_size; ///< instructions_array size
rocprofiler_thread_trace_decoder_wave_state_t* timeline_array; ///< wave state change events
rocprofiler_thread_trace_decoder_inst_t* instructions_array; ///< Instructions executed
} rocprofiler_thread_trace_decoder_wave_t;
@@ -217,7 +217,7 @@ typedef struct rocprofiler_thread_trace_decoder_shaderdata_t
*/
typedef enum rocprofiler_thread_trace_decoder_record_type_t
{
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_GFXIP = 0, ///< Record is gfxip_major, type size_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_GFXIP = 0, ///< Record is gfxip_major, type uint64_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_OCCUPANCY, ///< rocprofiler_thread_trace_decoder_occupancy_t*
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_PERFEVENT, ///< rocprofiler_thread_trace_decoder_perfevent_t*
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_WAVE, ///< rocprofiler_thread_trace_decoder_wave_t*