Skip to content

Commit

Permalink
fix: break execute some method when disable latency tracer (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored Nov 16, 2021
1 parent cba16ed commit a81b31c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/latency_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ latency_tracer::latency_tracer(bool is_sub,

latency_tracer::~latency_tracer()
{
if (_is_sub) {
if (!_enable_trace || _is_sub) {
return;
}

Expand Down Expand Up @@ -190,6 +190,10 @@ void latency_tracer::add_sub_tracer(const std::shared_ptr<latency_tracer> &trace

std::shared_ptr<latency_tracer> latency_tracer::sub_tracer(const std::string &name)
{
if (!_enable_trace) {
return nullptr;
}

utils::auto_read_lock read(_sub_lock);
auto iter = _sub_tracers.find(name);
if (iter != _sub_tracers.end()) {
Expand Down

0 comments on commit a81b31c

Please sign in to comment.