PC sampling: online partial PC sampling decoding (#1004)

* PC sampling: online partial PC sampling decoding

PC sampling service decodes a PC sample partially
by replacing the PC with an id of the loaded code object instance
containing PC and the offset of the PC within that code object instance.

* PC sampling: marker records removed

* PC sampling parser: minor doc update in mock

* PC sampling: introducing rocprofiler_pc_t

* NULL value of the code object id introduced.

* Clarifying documenation related to PC offset.

* PC offset documentation improvement

* PC sampling parser benchmark: Reducing the number of samples to recreate half of performance.
이 커밋은 다음에 포함됨:
Vladimir Indic
2024-09-05 18:35:46 +02:00
커밋한 사람 GitHub
부모 fa91169479
커밋 93e82663d9
12개의 변경된 파일160개의 추가작업 그리고 129개의 파일을 삭제
+6 -22
파일 보기
@@ -339,7 +339,8 @@ rocprofiler_pc_sampling_callback(rocprofiler_context_id_t /*context_id*/,
auto* pc_sample =
static_cast<rocprofiler_pc_sampling_record_t*>(cur_header->payload);
ss << "pc: " << std::hex << pc_sample->pc << ", "
ss << "(code_obj_id, offset): (" << pc_sample->pc.loaded_code_object_id
<< ", 0x" << std::hex << pc_sample->pc.loaded_code_object_offset << "), "
<< "timestamp: " << std::dec << pc_sample->timestamp << ", "
<< "exec: " << std::hex << std::setw(16) << pc_sample->exec_mask << ", "
<< "workgroup_id_(x=" << std::dec << std::setw(5)
@@ -372,30 +373,13 @@ rocprofiler_pc_sampling_callback(rocprofiler_context_id_t /*context_id*/,
assert(corr_id.external.value > 0);
// Decoding the PC
auto inst = translator.get(pc_sample->pc);
auto inst = translator.get(pc_sample->pc.loaded_code_object_id,
pc_sample->pc.loaded_code_object_offset);
flat_profile.add_sample(std::move(inst), pc_sample->exec_mask);
}
else if(cur_header->kind == ROCPROFILER_PC_SAMPLING_RECORD_CODE_OBJECT_LOAD_MARKER)
else
{
auto* marker = static_cast<rocprofiler_pc_sampling_code_object_load_marker_t*>(
cur_header->payload);
auto code_object_id = marker->code_object_id;
ss << "code object loading: " << code_object_id << std::endl;
// The code object load event can be reported once per code object id.
assert(pc_sampler->active_code_objects.count(code_object_id) == 0);
pc_sampler->active_code_objects.emplace(code_object_id);
}
else if(cur_header->kind ==
ROCPROFILER_PC_SAMPLING_RECORD_CODE_OBJECT_UNLOAD_MARKER)
{
auto* marker =
static_cast<rocprofiler_pc_sampling_code_object_unload_marker_t*>(
cur_header->payload);
auto code_object_id = marker->code_object_id;
ss << "code object unloading: " << code_object_id << std::endl;
// The code object unload event can be reported once per code object id.
assert(pc_sampler->active_code_objects.count(code_object_id) == 1);
pc_sampler->active_code_objects.erase(code_object_id);
assert(false);
}
}
else