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>
Этот коммит содержится в:
Benjamin Welton
2023-11-17 15:15:39 -08:00
коммит произвёл GitHub
родитель e8a5845661
Коммит d40fc59703
2 изменённых файлов: 16 добавлений и 12 удалений
+12 -11
Просмотреть файл
@@ -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;