Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
profiling.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
22#include <optional>
23#include <string>
24
25namespace shambase::profiling {
26
29
35 void set_enable_nvtx(bool enable_nvtx);
36
42 void set_enable_profiling(bool enable_profiling);
43
49 void set_use_complete_event(bool use_complete_event);
50
59 void set_event_record_threshold(f64 threshold);
60
71 f64 t_start,
72 const std::optional<std::string> &name = std::nullopt,
73 const std::optional<std::string> &category_name = std::nullopt);
74
84 void stack_entry_end(
86 f64 t_start,
87 f64 tend,
88 const std::optional<std::string> &name = std::nullopt,
89 const std::optional<std::string> &category_name = std::nullopt);
90
100 const std::optional<std::string> &name = std::nullopt,
101 const std::optional<std::string> &category_name = std::nullopt);
102
111 const SourceLocation &fileloc,
112 const std::optional<std::string> &name = std::nullopt,
113 const std::optional<std::string> &category_name = std::nullopt);
114
122 void register_counter_val(const std::string &name, f64 time, f64 val);
123
124} // namespace shambase::profiling
Source location utility.
double f64
Alias for double.
void register_counter_val(u64 pid, f64 t, const std::string &name, f64 val)
Register a counter value in Chrome tracing.
Definition chrome.cpp:225
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
void set_use_complete_event(bool use_complete_event)
Use complete event, or start and begin event in chrome tracing.
Definition profiling.cpp:98
void set_event_record_threshold(f64 threshold)
Set the event record threshold.
Definition profiling.cpp:99
bool is_profiling_enabled()
Check if profiling is enabled.
Definition profiling.cpp:94
void stack_entry_start_no_time(const SourceLocation &fileloc, const std::optional< std::string > &name=std::nullopt, const std::optional< std::string > &category_name=std::nullopt)
Start a profiling event without a time info.
void set_enable_profiling(bool enable_profiling)
Set wether to enable profiling.
Definition profiling.cpp:97
void set_enable_nvtx(bool enable_nvtx)
Set wether to enable NVTX profiling.
Definition profiling.cpp:96
void stack_entry_end_no_time(const SourceLocation &fileloc, const std::optional< std::string > &name=std::nullopt, const std::optional< std::string > &category_name=std::nullopt)
End a profiling event without a time info.
void stack_entry_start(const SourceLocation &fileloc, f64 t_start, const std::optional< std::string > &name=std::nullopt, const std::optional< std::string > &category_name=std::nullopt)
Register the start of a profiling event.
void stack_entry_end(const SourceLocation &fileloc, f64 t_start, f64 tend, const std::optional< std::string > &name=std::nullopt, const std::optional< std::string > &category_name=std::nullopt)
Register the end of a profiling event.
provide information about the source location