Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Functions | Variables
profiling.cpp File Reference
#include "shambase/profiling/chrome.hpp"
#include "shambase/profiling/profiling.hpp"
#include "shambase/string.hpp"
#include "fmt/base.h"
#include <fstream>
#include <iostream>
#include <utility>
+ Include dependency graph for profiling.cpp:

Go to the source code of this file.

Functions

std::string src_loc_to_name (const SourceLocation &loc)
 

Variables

auto get_profiling
 
auto get_nvtx
 
auto get_complete_event
 
auto get_threshold
 
bool enable_profiling = get_profiling()
 
bool use_complete_event = get_complete_event()
 
f64 threshold = get_threshold()
 
bool enable_nvtx = get_nvtx()
 

Detailed Description

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file profiling.cpp.

Function Documentation

◆ src_loc_to_name()

std::string src_loc_to_name ( const SourceLocation loc)

Definition at line 29 of file profiling.cpp.

Variable Documentation

◆ enable_nvtx

bool enable_nvtx = get_nvtx()

Definition at line 92 of file profiling.cpp.

◆ enable_profiling

bool enable_profiling = get_profiling()

Definition at line 89 of file profiling.cpp.

◆ get_complete_event

auto get_complete_event
Initial value:
= []() {
const char *val = std::getenv("SHAM_PROF_USE_COMPLETE_EVENT");
if (val != nullptr) {
if (std::string(val) == "1") {
return true;
} else if (std::string(val) == "0") {
return false;
}
}
return true;
}

Definition at line 69 of file profiling.cpp.

◆ get_nvtx

auto get_nvtx
Initial value:
= []() {
const char *val = std::getenv("SHAM_PROF_USE_NVTX");
if (val != nullptr) {
if (std::string(val) == "1") {
if (!get_profiling()) {
fmt::println(
"-- SHAM_PROF_USE_NVTX is set to 1 but SHAM_PROFILING is not set to 1.\n"
" please set SHAM_PROFILING=1 before SHAM_PROF_USE_NVTX=1");
}
return true;
} else if (std::string(val) == "0") {
return false;
}
}
return false;
}

Definition at line 50 of file profiling.cpp.

◆ get_profiling

auto get_profiling
Initial value:
= []() {
const char *val = std::getenv("SHAM_PROFILING");
if (val != nullptr) {
if (std::string(val) == "1") {
return true;
} else if (std::string(val) == "0") {
return false;
}
}
return false;
}

Definition at line 38 of file profiling.cpp.

◆ get_threshold

auto get_threshold
Initial value:
= []() {
const char *val = std::getenv("SHAM_PROF_EVENT_RECORD_THRES");
if (val != nullptr) {
return std::stod(val);
}
return 1e-5;
}

Definition at line 81 of file profiling.cpp.

◆ threshold

f64 threshold = get_threshold()

Definition at line 91 of file profiling.cpp.

◆ use_complete_event

bool use_complete_event = get_complete_event()

Definition at line 90 of file profiling.cpp.