Additional 1.0.0 changes (#317)
* Additional 1.0.0 changes - Update VERSION - Add beta compatibility for rocprofiler_agent_set_profile_callback_t * Fix location of deprecated typedef rocprofiler_agent_set_profile_callback_t * rocprofiler_record_counter_t -> rocprofiler_counter_record_t * Experimental + deprecated annotations * rocprofiler_record_dimension_info_t -> rocprofiler_counter_record_dimension_info_t --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
zatwierdzone przez
GitHub
rodzic
6d6eec230c
commit
a1fcdf7f83
@@ -74,10 +74,11 @@ get_buffer()
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::unordered_map<uint64_t, std::vector<rocprofiler_record_dimension_info_t>>**
|
||||
std::unordered_map<uint64_t, std::vector<rocprofiler_counter_record_dimension_info_t>>**
|
||||
dimension_cache()
|
||||
{
|
||||
static std::unordered_map<uint64_t, std::vector<rocprofiler_record_dimension_info_t>>* cache;
|
||||
static std::unordered_map<uint64_t, std::vector<rocprofiler_counter_record_dimension_info_t>>*
|
||||
cache;
|
||||
return &cache;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ dimension_cache()
|
||||
* For a given counter, query the dimensions that it has. Typically you will
|
||||
* want to call this function once to get the dimensions and cache them.
|
||||
*/
|
||||
std::vector<rocprofiler_record_dimension_info_t>
|
||||
std::vector<rocprofiler_counter_record_dimension_info_t>
|
||||
counter_dimensions(rocprofiler_counter_id_t counter)
|
||||
{
|
||||
if(*dimension_cache() == nullptr) return {};
|
||||
@@ -102,15 +103,15 @@ void
|
||||
fill_dimension_cache(rocprofiler_counter_id_t counter)
|
||||
{
|
||||
assert(*dimension_cache() != nullptr);
|
||||
std::vector<rocprofiler_record_dimension_info_t> dims;
|
||||
rocprofiler_counter_info_v1_t info;
|
||||
std::vector<rocprofiler_counter_record_dimension_info_t> dims;
|
||||
rocprofiler_counter_info_v1_t info;
|
||||
ROCPROFILER_CALL(rocprofiler_query_counter_info(
|
||||
counter, ROCPROFILER_COUNTER_INFO_VERSION_1, static_cast<void*>(&info)),
|
||||
"Could not query info for counter");
|
||||
|
||||
(*dimension_cache())
|
||||
->emplace(counter.handle,
|
||||
std::vector<rocprofiler_record_dimension_info_t>{
|
||||
std::vector<rocprofiler_counter_record_dimension_info_t>{
|
||||
info.dimensions, info.dimensions + info.dimensions_count});
|
||||
}
|
||||
|
||||
@@ -149,7 +150,7 @@ buffered_callback(rocprofiler_context_id_t,
|
||||
header->kind == ROCPROFILER_COUNTER_RECORD_VALUE)
|
||||
{
|
||||
// Print the returned counter data.
|
||||
auto* record = static_cast<rocprofiler_record_counter_t*>(header->payload);
|
||||
auto* record = static_cast<rocprofiler_counter_record_t*>(header->payload);
|
||||
rocprofiler_counter_id_t counter_id = {.handle = 0};
|
||||
|
||||
rocprofiler_query_record_counter_id(record->id, &counter_id);
|
||||
@@ -436,7 +437,8 @@ rocprofiler_configure(uint32_t version,
|
||||
static_cast<void*>(output_stream)};
|
||||
|
||||
*dimension_cache() =
|
||||
new std::unordered_map<uint64_t, std::vector<rocprofiler_record_dimension_info_t>>();
|
||||
new std::unordered_map<uint64_t,
|
||||
std::vector<rocprofiler_counter_record_dimension_info_t>>();
|
||||
|
||||
// return pointer to configure data
|
||||
return &cfg;
|
||||
|
||||
@@ -74,7 +74,7 @@ get_client_ctx()
|
||||
|
||||
void
|
||||
record_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_record_counter_t* record_data,
|
||||
rocprofiler_counter_record_t* record_data,
|
||||
size_t record_count,
|
||||
rocprofiler_user_data_t /* user_data */,
|
||||
void* callback_data_args)
|
||||
|
||||
@@ -107,7 +107,7 @@ buffered_callback(rocprofiler_context_id_t,
|
||||
header->kind == ROCPROFILER_COUNTER_RECORD_VALUE)
|
||||
{
|
||||
// Print the returned counter data.
|
||||
auto* record = static_cast<rocprofiler_record_counter_t*>(header->payload);
|
||||
auto* record = static_cast<rocprofiler_counter_record_t*>(header->payload);
|
||||
ss << " (Id: " << record->id << " Value [D]: " << record->counter_value << ","
|
||||
<< " user_data: " << record->user_data.value << "),";
|
||||
|
||||
|
||||
@@ -75,16 +75,16 @@ public:
|
||||
counter_sampler(rocprofiler_agent_id_t agent);
|
||||
|
||||
// Decode the counter name of a record
|
||||
std::string decode_record_name(const rocprofiler_record_counter_t& rec) const;
|
||||
std::string decode_record_name(const rocprofiler_counter_record_t& rec) const;
|
||||
|
||||
// Get the dimensions of a record (what CU/SE/etc the counter is for). High cost operation
|
||||
// should be cached if possible.
|
||||
static std::unordered_map<std::string, size_t> get_record_dimensions(
|
||||
const rocprofiler_record_counter_t& rec);
|
||||
const rocprofiler_counter_record_t& rec);
|
||||
|
||||
// Sample the counter values for a set of counters, returns the records in the out parameter.
|
||||
rocprofiler_status_t sample_counter_values(const std::vector<std::string>& counters,
|
||||
std::vector<rocprofiler_record_counter_t>& out);
|
||||
std::vector<rocprofiler_counter_record_t>& out);
|
||||
|
||||
// Get the available agents on the system
|
||||
static std::vector<rocprofiler_agent_v0_t> get_available_agents();
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
rocprofiler_agent_id_t agent);
|
||||
|
||||
// Get the dimensions of a counter
|
||||
static std::vector<rocprofiler_record_dimension_info_t> get_counter_dimensions(
|
||||
static std::vector<rocprofiler_counter_record_dimension_info_t> get_counter_dimensions(
|
||||
rocprofiler_counter_id_t counter);
|
||||
};
|
||||
|
||||
@@ -162,7 +162,7 @@ counter_sampler::counter_sampler(rocprofiler_agent_id_t agent)
|
||||
}
|
||||
|
||||
std::string
|
||||
counter_sampler::decode_record_name(const rocprofiler_record_counter_t& rec) const
|
||||
counter_sampler::decode_record_name(const rocprofiler_counter_record_t& rec) const
|
||||
{
|
||||
if(id_to_name_.empty())
|
||||
{
|
||||
@@ -184,7 +184,7 @@ counter_sampler::decode_record_name(const rocprofiler_record_counter_t& rec) con
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, size_t>
|
||||
counter_sampler::get_record_dimensions(const rocprofiler_record_counter_t& rec)
|
||||
counter_sampler::get_record_dimensions(const rocprofiler_counter_record_t& rec)
|
||||
{
|
||||
std::unordered_map<std::string, size_t> out;
|
||||
rocprofiler_counter_id_t counter_id = {.handle = 0};
|
||||
@@ -202,7 +202,7 @@ counter_sampler::get_record_dimensions(const rocprofiler_record_counter_t& rec)
|
||||
|
||||
rocprofiler_status_t
|
||||
counter_sampler::sample_counter_values(const std::vector<std::string>& counters,
|
||||
std::vector<rocprofiler_record_counter_t>& out)
|
||||
std::vector<rocprofiler_counter_record_t>& out)
|
||||
{
|
||||
auto profile_cached = cached_profiles_.find(counters);
|
||||
if(profile_cached == cached_profiles_.end())
|
||||
@@ -330,14 +330,14 @@ counter_sampler::get_supported_counters(rocprofiler_agent_id_t agent)
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<rocprofiler_record_dimension_info_t>
|
||||
std::vector<rocprofiler_counter_record_dimension_info_t>
|
||||
counter_sampler::get_counter_dimensions(rocprofiler_counter_id_t counter)
|
||||
{
|
||||
rocprofiler_counter_info_v1_t info;
|
||||
ROCPROFILER_CALL(rocprofiler_query_counter_info(
|
||||
counter, ROCPROFILER_COUNTER_INFO_VERSION_1, static_cast<void*>(&info)),
|
||||
"Could not query info for counter");
|
||||
return std::vector<rocprofiler_record_dimension_info_t>{
|
||||
return std::vector<rocprofiler_counter_record_dimension_info_t>{
|
||||
info.dimensions, info.dimensions + info.dimensions_count};
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ tool_init(rocprofiler_client_finalize_t fini_func, void*)
|
||||
|
||||
sampler_thread = new std::thread{[=]() {
|
||||
size_t count = 1;
|
||||
std::vector<rocprofiler_record_counter_t> records;
|
||||
std::vector<rocprofiler_counter_record_t> records;
|
||||
while(sampler && exit_toggle().load() == false)
|
||||
{
|
||||
auto status = sampler->sample_counter_values({"SQ_WAVES"}, records);
|
||||
|
||||
@@ -85,7 +85,7 @@ struct validate_dim_presence
|
||||
{
|
||||
validate_dim_presence() {}
|
||||
|
||||
void maybe_forward(const rocprofiler_record_dimension_info_t& dim)
|
||||
void maybe_forward(const rocprofiler_counter_record_dimension_info_t& dim)
|
||||
{
|
||||
if(sub_vectors.empty())
|
||||
{
|
||||
@@ -118,8 +118,9 @@ struct validate_dim_presence
|
||||
sub_vectors.at(pos)->mark_seen(id);
|
||||
}
|
||||
|
||||
bool check_seen(std::stringstream& out,
|
||||
std::vector<std::pair<rocprofiler_record_dimension_info_t, size_t>>& pos_stack)
|
||||
bool check_seen(
|
||||
std::stringstream& out,
|
||||
std::vector<std::pair<rocprofiler_counter_record_dimension_info_t, size_t>>& pos_stack)
|
||||
{
|
||||
bool ret = true;
|
||||
if(sub_vectors.empty())
|
||||
@@ -150,9 +151,9 @@ struct validate_dim_presence
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::pair<rocprofiler_record_dimension_info_t, size_t> vector_pos;
|
||||
std::vector<std::unique_ptr<validate_dim_presence>> sub_vectors;
|
||||
bool has_value{false};
|
||||
std::pair<rocprofiler_counter_record_dimension_info_t, size_t> vector_pos;
|
||||
std::vector<std::unique_ptr<validate_dim_presence>> sub_vectors;
|
||||
bool has_value{false};
|
||||
};
|
||||
|
||||
struct CaptureRecords
|
||||
@@ -197,7 +198,7 @@ buffered_callback(rocprofiler_context_id_t,
|
||||
// Record the counters we have in the buffer and the number of instances of
|
||||
// the counter we have seen.
|
||||
rocprofiler_counter_id_t counter;
|
||||
auto* record = static_cast<rocprofiler_record_counter_t*>(header->payload);
|
||||
auto* record = static_cast<rocprofiler_counter_record_t*>(header->payload);
|
||||
rocprofiler_query_record_counter_id(record->id, &counter);
|
||||
cap.expected_data_dims.at(counter.handle).mark_seen(record->id);
|
||||
seen_counters.emplace(counter.handle, 0).first->second++;
|
||||
@@ -406,8 +407,8 @@ tool_fini(void*)
|
||||
else
|
||||
{
|
||||
// Counter collected OK
|
||||
std::stringstream ss;
|
||||
std::vector<std::pair<rocprofiler_record_dimension_info_t, size_t>> stack;
|
||||
std::stringstream ss;
|
||||
std::vector<std::pair<rocprofiler_counter_record_dimension_info_t, size_t>> stack;
|
||||
bool passed = cap.expected_data_dims.at(counter_id).check_seen(ss, stack);
|
||||
if(!PRINT_ONLY_FAILING || !passed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user