Skip to content
Snippets Groups Projects
Commit ada97980 authored by Tomasz Grabiec's avatar Tomasz Grabiec Committed by Pekka Enberg
Browse files

trace: allow atomic changes of _log_backtrace via tracepoint_base::log_backtrace()


Sampler will need to set and later restore value of this option.

Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 0fa88c55
No related branches found
No related tags found
No related merge requests found
......@@ -291,11 +291,11 @@ std::unordered_set<tracepoint_id>& tracepoint_base::known_ids()
return _known_ids;
}
bool tracepoint_base::_log_backtrace;
std::atomic<bool> tracepoint_base::_log_backtrace;
void tracepoint_base::log_backtraces()
bool tracepoint_base::log_backtraces(bool should_log)
{
_log_backtrace = true;
return _log_backtrace.exchange(should_log);
}
void tracepoint_base::do_log_backtrace(trace_record* tr, u8*& buffer)
......
......@@ -273,7 +273,7 @@ public:
const char* _name, const char* _format);
~tracepoint_base();
void enable();
static void log_backtraces();
static bool log_backtraces(bool should_log = true);
void add_probe(probe* p);
void del_probe(probe* p);
tracepoint_id id;
......@@ -311,7 +311,7 @@ private:
void deactivate(const tracepoint_id &, void * site, void * slow_path);
void update();
static std::unordered_set<tracepoint_id>& known_ids();
static bool _log_backtrace;
static std::atomic<bool> _log_backtrace;
static const size_t backtrace_len = 10;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment