saving time for roctx records
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ target_link_libraries ( ${TEST_LIB} ${ROCTRACER_TARGET} ${HSA_RUNTIME_LIB} c std
|
||||
|
||||
## Build HSA test
|
||||
execute_process ( COMMAND sh -xc "if [ ! -e ${TEST_DIR}/hsa ] ; then git clone https://github.com/ROCmSoftwarePlatform/hsa-class.git ${TEST_DIR}/hsa; fi" )
|
||||
execute_process ( COMMAND sh -xc "if [ -e ${TEST_DIR}/hsa ] ; then cd ${TEST_DIR}/hsa && git fetch origin && git checkout fff0102; fi" )
|
||||
execute_process ( COMMAND sh -xc "if [ -e ${TEST_DIR}/hsa ] ; then cd ${TEST_DIR}/hsa && git fetch origin && git checkout 777c308; fi" )
|
||||
set ( TEST_DIR ${HSA_TEST_DIR} )
|
||||
add_subdirectory ( ${TEST_DIR} ${PROJECT_BINARY_DIR}/test/hsa )
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ THE SOFTWARE.
|
||||
#include <src/core/trace_buffer.h>
|
||||
#include <util/xml.h>
|
||||
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
|
||||
#define PUBLIC_API __attribute__((visibility("default")))
|
||||
#define CONSTRUCTOR_API __attribute__((constructor))
|
||||
#define DESTRUCTOR_API __attribute__((destructor))
|
||||
@@ -164,7 +166,7 @@ struct roctx_trace_entry_t {
|
||||
uint32_t valid;
|
||||
uint32_t type;
|
||||
uint32_t cid;
|
||||
timestamp_t timestamp;
|
||||
timestamp_t time;
|
||||
uint32_t pid;
|
||||
uint32_t tid;
|
||||
const char* message;
|
||||
@@ -181,12 +183,11 @@ static inline void roctx_callback_fun(
|
||||
uint32_t tid,
|
||||
const char* message)
|
||||
{
|
||||
const timestamp_t timestamp = timer->timestamp_fn_ns();
|
||||
roctx_trace_entry_t* entry = roctx_trace_buffer.GetEntry();
|
||||
entry->valid = roctracer::TRACE_ENTRY_COMPL;
|
||||
entry->type = 0;
|
||||
entry->cid = cid;
|
||||
entry->timestamp = timestamp;
|
||||
entry->time = HsaTimer::clocktime_ns(HsaTimer::TIME_ID_CLOCK_MONOTONIC);
|
||||
entry->pid = GetPid();
|
||||
entry->tid = tid;
|
||||
entry->message = (message != NULL) ? strdup(message) : NULL;
|
||||
@@ -215,8 +216,10 @@ void stop_callback() { roctracer::RocTxLoader::Instance().RangeStackIterate(roct
|
||||
|
||||
// rocTX buffer flush function
|
||||
void roctx_flush_cb(roctx_trace_entry_t* entry) {
|
||||
timestamp_t timestamp = 0;
|
||||
HsaRsrcFactory::Instance().GetTimestamp(HsaTimer::TIME_ID_CLOCK_MONOTONIC, entry->time, ×tamp);
|
||||
std::ostringstream os;
|
||||
os << entry->timestamp << " " << entry->pid << ":" << entry->tid << " " << entry->cid;
|
||||
os << timestamp << " " << entry->pid << ":" << entry->tid << " " << entry->cid;
|
||||
if (entry->message != NULL) os << ":\"" << entry->message << "\"";
|
||||
else os << ":\"\"";
|
||||
fprintf(roctx_file_handle, "%s\n", os.str().c_str()); fflush(roctx_file_handle);
|
||||
|
||||
Reference in New Issue
Block a user