Updates/fixes for CI, docs, tests, samples, and common library (#528)

- .github/workflows/continuous_integration.yml
  - apt-get update before apt-get install
  - remove libgtest-dev
  - actions-comment-pull-request: v2.4.3 -> v2.5.0
- .github/workflows/formatting.yml
  - create-pull-request: v5 -> v6
- cmake/rocprofiler_options.cmake
  - remove unused ROCPROFILER_DEBUG_TRACE and ROCPROFILER_LD_AQLPROFILE options
- samples/counter_collection/callback_client.cpp
  - corr_id field renamed to correlation_id
- samples/counter_collection/client.cpp
  - corr_id field renamed to correlation_id
- include/rocprofiler-sdk/fwd.h
  - In rocprofiler_record_counter_t: rename corr_id field to correlation_id
  - doxygen fixes
- lib/common/utility.*
  - remove get_accurate_clock_id_impl
  - timestamp_ns() defaults to CLOCK_BOOTTIME
- lib/rocprofiler-sdk/counters/core.cpp
  - fix spelling mistake: extrenal -> external
  - corr_id field renamed to correlation_id
- lib/rocprofiler-sdk-tool/tool.cpp
  - fix destruction of static tool::output_file before finalization
- scripts/update-docs.sh
  - define PROJECT_NAME
- tests/async-copy-tracing/validate.py
  - init_time and fini_time checks
  - hip_api_traces, marker_api_tracing
- tests/common/serialization.hpp
  - fix save function for rocprofiler_record_counter_t following rename of corr_id to correlation_id
- tests/kernel-tracing/validate.py
  - init_time and fini_time checks
  - relax test_total_runtime range
- tests/rocprofv3/tracing/CMakeLists.txt
  - remove -M from rocprofv3-test-systrace-execute
  - exclude test_hsa_api_trace in rocprofv3-test-systrace-validate due to HIP API tracing
- tests/rocprofv3/tracing/validate.py
  - update test_kernel_trace to accept mangled or demangled
- tests/tools/json-tool.cpp
  - remove use of GLOG
  - include init_time and fini_time
  - write_json(...) function

[ROCm/rocprofiler-sdk commit: 0d939edbba]
This commit is contained in:
Jonathan R. Madsen
2024-02-22 00:16:43 -06:00
committed by GitHub
parent 2d9779ad96
commit f760a3ceaa
17 changed files with 292 additions and 233 deletions
@@ -62,35 +62,10 @@ get_clock_name(clockid_t _id)
default: break;
}
return "CLOCK_UNKNOWN";
#undef CLOCK_NAME_CASE_STATEMENT
}
} // namespace
clockid_t
get_accurate_clock_id_impl()
{
auto clock = CLOCK_MONOTONIC;
utsname kernelInfo;
if(uname(&kernelInfo) == 0)
{
try
{
std::string ver = kernelInfo.release;
size_t idx;
int major = std::stoi(ver, &idx);
int minor = std::stoi(ver.substr(idx + 1));
if(major > 4 || ((major == 4) && (minor >= 4)))
{
clock = CLOCK_MONOTONIC_RAW;
}
} catch(...)
{
// Kernel version string doesn't conform to the standard pattern.
// Keep using the "safe" (non-RAW) clock.
}
}
return clock;
}
uint64_t
get_clock_period_ns_impl(clockid_t _clk_id)
{
@@ -48,9 +48,6 @@ namespace rocprofiler
{
namespace common
{
clockid_t
get_accurate_clock_id_impl();
uint64_t
get_clock_period_ns_impl(clockid_t _clk_id);
@@ -62,20 +59,6 @@ get_tid()
return _v;
}
inline clockid_t
get_accurate_clock_id()
{
static auto clk_id = get_accurate_clock_id_impl();
return clk_id;
}
inline uint64_t
get_accurate_clock_period_ns()
{
static auto clk_period = get_clock_period_ns_impl(get_accurate_clock_id());
return clk_period;
}
inline uint64_t
get_ticks(clockid_t clk_id_v) noexcept
{
@@ -92,24 +75,17 @@ get_ticks(clockid_t clk_id_v) noexcept
return (static_cast<uint64_t>(ts.tv_sec) * nanosec) + static_cast<uint64_t>(ts.tv_nsec);
}
// this equates to HSA-runtime library implementation of os::ReadAccurateClock()
// CLOCK_MONOTONIC_RAW equates to HSA-runtime library implementation of os::ReadAccurateClock()
// CLOCK_BOOTTIME equates to HSA-runtime library implementation of os::ReadSystemClock()
template <int ClockT = CLOCK_BOOTTIME>
inline uint64_t
timestamp_ns()
{
auto&& clk_period = get_accurate_clock_period_ns();
if(ROCPROFILER_LIKELY(clk_period == 1)) return get_ticks(get_accurate_clock_id());
return get_ticks(get_accurate_clock_id()) / clk_period;
}
constexpr auto _clk = ClockT;
static auto _clk_period = get_clock_period_ns_impl(_clk);
// this equates to HSA-runtime library implementation of os::ReadSystemClock()
inline uint64_t
system_timestamp_ns()
{
constexpr auto boottime_clk = CLOCK_BOOTTIME;
static auto boottime_clk_period = get_clock_period_ns_impl(boottime_clk);
if(ROCPROFILER_LIKELY(boottime_clk_period == 1)) return get_ticks(boottime_clk);
return get_ticks(boottime_clk) / boottime_clk_period;
if(ROCPROFILER_LIKELY(_clk_period == 1)) return get_ticks(_clk);
return get_ticks(_clk) / _clk_period;
}
std::vector<std::string>