ede6007f9b
* Testing and CI support for Ubuntu 22.04 * Fixes for ROCm - Jammy does not have ROCm installers * Name, timeout, and python updates - renamed ubuntu-jammy-external.yml to ubuntu-jammy.yml - increased all 5 minute timeouts to 10 minutes - include python 3.10 in testing * Update dyninst to remove interposed definition of _r_debug * Rebuild Dyninst + test install script * Revert container change * git safe directory * pushd -> cd * fix MPI include * Fix testing step * OMPI_ALLOW_RUN_AS_ROOT * Test script changes * Fix mismatched malloc / delete[] * Jammy workflow tweaks * CPack tweak for boost deb deps * pthread_mutex_gotcha config returns when not enabled * fix echoing config in CI * USE_CLANG_OMP - option to disable using LLVM OpenMP when building OpenMP test executables - Jammy workflow sets USE_CLANG_OMP=OFF * Dyninst submodule boost download - updated containers workflow to include jammy - updated workflow to use ci * Updates to workflows + replace test-install.sh - test-install.sh in this branch was replaced with one in main branch * Expand jammy test-install.sh args * Fix openmp-cg-sampling-duration test * update timemory submodule - use-after-free violation in popen::pclose * revert some tweaks to sampling-duration test * Fix env of test-install.sh * cmake format * jammy bash * CPack install for jammy * formatting workflow action version bump * Update timemory submodule - libunwind submodule via timemory sets SOVERSION to 99 to avoid ABI conflicts with v8 * Fix help menu for omnitrace-sample * Support other boolean forms in test-install.sh * Update docker files and build-docker.sh - consolidated cases in build-docker.sh - support rocm version of 0.0 (no rocm install) - support rocm v5.3 - updated centos handling * update opensuse actions/checkout version * Tweaks to ubuntu-focal testing - actions/checkout@v3 - use test-install script * update cpack - ubuntu 22.04 - rocm 5.3 - rename os matrix field to os-version - remove CI_ROCM_VERSION (no longer necessary) - remove default-rocm-version matrix field (no longer necessary) - CentOS packaging * fix argparsing and omnitrace-sample tests in install-tests.sh * focal rocm test install workflow fix * Fix omnitrace-sample build * Dockerfile.centos + build-docker.sh updates * Update actions/upload-artifact version * Dockerfile.ubuntu: install rocm-device-libs * Refactor cpack * fix cpack if quotes * Dockerfile.ubuntu rocm < 5 installs rocm-dev * build-release.sh defaults to boost version 1.79.0
78 строки
2.3 KiB
C++
78 строки
2.3 KiB
C++
// MIT License
|
|
//
|
|
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
// in the Software without restriction, including without limitation the rights
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
// copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
// SOFTWARE.
|
|
|
|
#include "library/tracing.hpp"
|
|
#include "library/config.hpp"
|
|
#include "library/state.hpp"
|
|
#include "library/thread_info.hpp"
|
|
|
|
namespace omnitrace
|
|
{
|
|
namespace tracing
|
|
{
|
|
perfetto::TraceConfig&
|
|
get_perfetto_config()
|
|
{
|
|
static auto _v = ::perfetto::TraceConfig{};
|
|
return _v;
|
|
}
|
|
|
|
std::unique_ptr<perfetto::TracingSession>&
|
|
get_perfetto_session()
|
|
{
|
|
static auto _v = std::unique_ptr<perfetto::TracingSession>{};
|
|
return _v;
|
|
}
|
|
|
|
std::vector<std::function<void()>>&
|
|
get_finalization_functions()
|
|
{
|
|
static auto _v = std::vector<std::function<void()>>{};
|
|
return _v;
|
|
}
|
|
|
|
tim::hash_map_ptr_t&
|
|
get_timemory_hash_ids(int64_t _tid)
|
|
{
|
|
static auto _v = std::array<tim::hash_map_ptr_t, omnitrace::max_supported_threads>{};
|
|
return _v.at(_tid);
|
|
}
|
|
|
|
tim::hash_alias_ptr_t&
|
|
get_timemory_hash_aliases(int64_t _tid)
|
|
{
|
|
static auto _v =
|
|
std::array<tim::hash_alias_ptr_t, omnitrace::max_supported_threads>{};
|
|
return _v.at(_tid);
|
|
}
|
|
|
|
void
|
|
record_thread_start_time()
|
|
{
|
|
static thread_local std::once_flag _once{};
|
|
std::call_once(_once, []() {
|
|
thread_info::set_start(comp::wall_clock::record(), get_mode() != Mode::Sampling);
|
|
});
|
|
}
|
|
} // namespace tracing
|
|
} // namespace omnitrace
|