Define new function attributes (#55)

- decorates several functions with OMNITRACE_HOT

[ROCm/rocprofiler-systems commit: 32a8d40d25]
This commit is contained in:
Jonathan R. Madsen
2022-06-20 00:44:31 -05:00
committed by GitHub
parent aa4bd96fa0
commit 1f3231bc95
5 changed files with 51 additions and 42 deletions
@@ -43,7 +43,7 @@ namespace omnitrace
inline namespace config
{
bool
settings_are_configured();
settings_are_configured() OMNITRACE_HOT;
void
configure_settings(bool _init = true);
@@ -92,7 +92,7 @@ std::string
get_config_file();
Mode
get_mode();
get_mode() OMNITRACE_HOT;
bool&
is_attached();
@@ -101,10 +101,10 @@ bool&
is_binary_rewrite();
bool
get_is_continuous_integration();
get_is_continuous_integration() OMNITRACE_HOT;
bool
get_debug_env();
get_debug_env() OMNITRACE_HOT;
bool
get_debug_init();
@@ -113,40 +113,40 @@ bool
get_debug_finalize();
bool
get_debug();
get_debug() OMNITRACE_HOT;
bool
get_debug_sampling();
get_debug_sampling() OMNITRACE_HOT;
bool
get_debug_tid();
get_debug_tid() OMNITRACE_HOT;
bool
get_debug_pid();
get_debug_pid() OMNITRACE_HOT;
int
get_verbose_env();
get_verbose_env() OMNITRACE_HOT;
int
get_verbose();
get_verbose() OMNITRACE_HOT;
bool&
get_use_perfetto();
get_use_perfetto() OMNITRACE_HOT;
bool&
get_use_timemory();
get_use_timemory() OMNITRACE_HOT;
bool&
get_use_roctracer();
get_use_roctracer() OMNITRACE_HOT;
bool&
get_use_rocm_smi();
get_use_rocm_smi() OMNITRACE_HOT;
bool&
get_use_sampling();
get_use_sampling() OMNITRACE_HOT;
bool&
get_use_thread_sampling();
get_use_thread_sampling() OMNITRACE_HOT;
bool&
get_use_pid();
@@ -155,7 +155,7 @@ bool&
get_use_mpip();
bool&
get_use_critical_trace();
get_use_critical_trace() OMNITRACE_HOT;
bool
get_use_kokkosp();
@@ -253,7 +253,7 @@ get_trace_thread_locks();
// Runtime configuration data
//
State&
get_state();
get_state() TIMEMORY_HOT;
/// returns old state
State set_state(State);
@@ -44,28 +44,28 @@ namespace omnitrace
inline namespace config
{
bool
get_debug();
get_debug() OMNITRACE_HOT;
int
get_verbose();
get_verbose() OMNITRACE_HOT;
bool
get_debug_env();
get_debug_env() OMNITRACE_HOT;
int
get_verbose_env();
get_verbose_env() OMNITRACE_HOT;
bool
get_is_continuous_integration();
get_is_continuous_integration() OMNITRACE_HOT;
bool
get_debug_tid();
get_debug_tid() OMNITRACE_HOT;
bool
get_debug_pid();
get_debug_pid() OMNITRACE_HOT;
bool
get_critical_trace_debug();
get_critical_trace_debug() OMNITRACE_HOT;
} // namespace config
namespace debug
@@ -57,10 +57,17 @@
#define OMNITRACE_SAMPLING_GPU_BUSY OMNITRACE_SAMPLING_GPU_BUSY_idx
#define OMNITRACE_SAMPLING_GPU_MEMORY_USAGE OMNITRACE_SAMPLING_GPU_MEMORY_USAGE_idx
#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE))
#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default")
#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden")
#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE))
#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default")
#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden")
#define OMNITRACE_INLINE OMNITRACE_ATTRIBUTE(always_inline) inline
#define OMNITRACE_NOINLINE OMNITRACE_ATTRIBUTE(noinline)
#define OMNITRACE_HOT OMNITRACE_ATTRIBUTE(hot)
#define OMNITRACE_CONST OMNITRACE_ATTRIBUTE(const)
#define OMNITRACE_PURE OMNITRACE_ATTRIBUTE(pure)
#define OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__packed__)
#define OMNITRACE_PACKED_ALIGN(VAL) OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__aligned__(VAL))
#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0
# if defined(NDEBUG)
@@ -22,6 +22,8 @@
#pragma once
#include "library/defines.hpp"
#include <array>
#include <iostream>
#include <ostream>
@@ -34,10 +36,10 @@ namespace omnitrace
inline namespace config
{
bool
get_debug();
get_debug() OMNITRACE_HOT;
int
get_verbose();
get_verbose() OMNITRACE_HOT;
} // namespace config
struct redirect
@@ -68,37 +68,37 @@ std::unique_ptr<gotcha_bundle_t>&
get_gotcha_bundle();
std::atomic<uint64_t>&
get_cpu_cid();
get_cpu_cid() TIMEMORY_HOT;
unique_ptr_t<std::vector<uint64_t>>&
get_cpu_cid_stack(int64_t _tid = threading::get_id(), int64_t _parent = 0);
get_cpu_cid_stack(int64_t _tid = threading::get_id(), int64_t _parent = 0) TIMEMORY_HOT;
using cpu_cid_data_t = std::tuple<uint64_t, uint64_t, uint32_t>;
using cpu_cid_pair_t = std::tuple<uint64_t, uint32_t>;
using cpu_cid_parent_map_t = std::unordered_map<uint64_t, cpu_cid_pair_t>;
unique_ptr_t<cpu_cid_parent_map_t>&
get_cpu_cid_parents(int64_t _tid = threading::get_id());
get_cpu_cid_parents(int64_t _tid = threading::get_id()) TIMEMORY_HOT;
cpu_cid_data_t
create_cpu_cid_entry(int64_t _tid = threading::get_id());
create_cpu_cid_entry(int64_t _tid = threading::get_id()) TIMEMORY_HOT;
cpu_cid_pair_t
get_cpu_cid_entry(uint64_t _cid, int64_t _tid = threading::get_id());
get_cpu_cid_entry(uint64_t _cid, int64_t _tid = threading::get_id()) TIMEMORY_HOT;
tim::mutex_t&
get_cpu_cid_stack_lock(int64_t _tid = threading::get_id());
get_cpu_cid_stack_lock(int64_t _tid = threading::get_id()) TIMEMORY_HOT;
ThreadState&
get_thread_state();
get_thread_state() TIMEMORY_HOT;
/// returns old state
ThreadState set_thread_state(ThreadState);
ThreadState set_thread_state(ThreadState) TIMEMORY_HOT;
ThreadState push_thread_state(ThreadState);
ThreadState push_thread_state(ThreadState) TIMEMORY_HOT;
ThreadState
pop_thread_state();
pop_thread_state() TIMEMORY_HOT;
struct scoped_thread_state
{