26namespace shambase::details {
35#ifdef SHAMROCK_USE_PROFILING
110#ifdef SHAMROCK_USE_PROFILING
124#ifdef SHAMROCK_USE_PROFILING
129 shambase::profiling::stack_entry_start_no_time(
loc);
143#ifdef SHAMROCK_USE_PROFILING
148 shambase::profiling::stack_entry_start_no_time(
loc);
159#ifdef SHAMROCK_USE_PROFILING
164 shambase::profiling::stack_entry_end_no_time(
loc);
175#ifdef SHAMROCK_USE_PROFILING
191#ifdef SHAMROCK_USE_PROFILING
196 shambase::profiling::stack_entry_start_no_time(
loc,
name);
207#ifdef SHAMROCK_USE_PROFILING
212 shambase::profiling::stack_entry_end_no_time(
loc);
231 void set_callstack_process_identifier(std::string
identifier);
233 void add_callstack_gen_info_generator(std::string (*generator)());
257#define __shamrock_stack_entry() \
258 [[maybe_unused]] StackEntry __shamrock_unique_name(stack_loc_) {}
266#define __shamrock_log_callsite(callsite) \
267 [[maybe_unused]] shambase::details::CallStackEntry __shamrock_unique_name(call_site_loc) { \
277#define __shamrock_stack_entry_with_callsite(callsite) \
278 [[maybe_unused]] StackEntry __shamrock_unique_name(stack_loc_) { callsite }
double f64
Alias for double.
std::uint32_t u32
32 bit unsigned integer
namespace for basic c++ utilities
std::string fmt_callstack()
Get the formatted callstack.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
std::stack< SourceLocation > call_stack
The call stack used to keep track of the stack trace. It is used to print the stack trace when an exc...
void register_profile_entry(std::source_location loc, f64 start_time, f64 end_time)
Register a profile entry. This register the end of a profile entry for chrome tracing and a complete ...
void dump_profilings(const std::string &process_prefix, u32 world_rank)
Dump the profiling data in a JSON format to a file.
void dump_profilings_chrome(const std::string &process_prefix, u32 world_rank)
Dump the profiling data in a Chrome Tracing format.
void register_profile_entry_start(std::source_location loc, f64 start_time)
Register the start of a profile entry. This is required for chrome profiling as there is a separate e...
f64 get_wtime()
Returns the current wall clock time in seconds.
void clear_profiling_data()
Clear the profiling data. (should be done in large run to avoid out-of-memory)
provide information about the source location
SourceLocation loc
Source location attached to the entry.
~BasicStackEntry()
Destroy the Basic Stack Entry object.
CallStackEntry scoped_callstack_entry
scoped call stack entry
BasicStackEntry(bool do_timer=true, SourceLocation &&loc=SourceLocation{})
Construct a new Basic Stack Entry object.
bool do_timer
is the timer enabled for this entry
BasicStackEntry(SourceLocation &callsite, bool do_timer=true, SourceLocation &&loc=SourceLocation{})
Construct a new Basic Stack Entry object.
f64 wtime_start
start time of the entry
Helper class to manage the call stack entry.
bool do_timer
is the timer enabled for this entry
SourceLocation loc
Source location attached to the entry.
CallStackEntry scoped_callstack_entry
scoped call stack entry
~NamedBasicStackEntry()
Destroy the Named Basic Stack Entry object.
NamedBasicStackEntry(std::string name, bool do_timer=true, SourceLocation &&loc=SourceLocation{})
Construct a new Named Basic Stack Entry object.
f64 wtime_start
start time of the entry
std::string name
Name of the entry.
Utility class to emulates std::source_location class introduced in c++20 This class provides informat...
Provides macros for generating unique identifiers at compile time.