Rename functioanl counter client, fix crash if no counters present on system (#242)

* Rename functioanl counter client, fix crash if no counters

Lack of counters for an agent should not crash this sample.

* source formatting (clang-format v11) (#243)

Co-authored-by: bwelton <bwelton@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: bwelton <bwelton@users.noreply.github.com>

[ROCm/rocprofiler-sdk commit: d40fc59703]
This commit is contained in:
Benjamin Welton
2023-11-17 15:15:39 -08:00
zatwierdzone przez GitHub
rodzic a009146494
commit 7b71c18cef
2 zmienionych plików z 16 dodań i 12 usunięć
@@ -52,21 +52,22 @@ set_tests_properties(
FAIL_REGULAR_EXPRESSION
"threw an exception")
add_library(counter-collection-test-counter-client SHARED)
target_sources(counter-collection-test-counter-client PRIVATE test_counter_client.cpp
client.hpp)
target_link_libraries(counter-collection-test-counter-client
add_library(counter-collection-functional-counter-client SHARED)
target_sources(counter-collection-functional-counter-client
PRIVATE print_functional_counters.cpp client.hpp)
target_link_libraries(counter-collection-functional-counter-client
PRIVATE rocprofiler::rocprofiler)
add_executable(counter-collection-test-counters)
target_sources(counter-collection-test-counters PRIVATE main.cpp)
target_link_libraries(counter-collection-test-counters
PRIVATE counter-collection-test-counter-client Threads::Threads)
add_executable(counter-collection-print-functional-counters)
target_sources(counter-collection-print-functional-counters PRIVATE main.cpp)
target_link_libraries(
counter-collection-print-functional-counters
PRIVATE counter-collection-functional-counter-client Threads::Threads)
add_test(NAME counter-collection-test-counters
COMMAND $<TARGET_FILE:counter-collection-test-counters>)
add_test(NAME counter-collection-print-functional-counters
COMMAND $<TARGET_FILE:counter-collection-print-functional-counters>)
set_tests_properties(
counter-collection-test-counters
counter-collection-print-functional-counters
PROPERTIES
TIMEOUT
300
@@ -148,7 +148,10 @@ dispatch_callback(rocprofiler_queue_id_t queue_id,
"Could not query name");
cap.expected_counter_names.emplace(found_counter.handle, std::string(name));
}
if(cap.expected.empty()) throw std::runtime_error("No counters found for agent");
if(cap.expected.empty())
{
std::clog << "No counters found for agent - " << agent->name;
}
}
if(cap.remaining.empty()) return;