Agora  1.2.0
Agora project
backtracer-inl.h
Go to the documentation of this file.
1 // Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
3 
4 #pragma once
5 
6 #ifndef SPDLOG_HEADER_ONLY
8 #endif
9 namespace spdlog {
10 namespace details {
12 {
13  std::lock_guard<std::mutex> lock(other.mutex_);
14  enabled_ = other.enabled();
15  messages_ = other.messages_;
16 }
17 
19 {
20  std::lock_guard<std::mutex> lock(other.mutex_);
21  enabled_ = other.enabled();
22  messages_ = std::move(other.messages_);
23 }
24 
26 {
27  std::lock_guard<std::mutex> lock(mutex_);
28  enabled_ = other.enabled();
29  messages_ = std::move(other.messages_);
30  return *this;
31 }
32 
34 {
35  std::lock_guard<std::mutex> lock{mutex_};
36  enabled_.store(true, std::memory_order_relaxed);
38 }
39 
41 {
42  std::lock_guard<std::mutex> lock{mutex_};
43  enabled_.store(false, std::memory_order_relaxed);
44 }
45 
47 {
48  return enabled_.load(std::memory_order_relaxed);
49 }
50 
52 {
53  std::lock_guard<std::mutex> lock{mutex_};
54  messages_.push_back(log_msg_buffer{msg});
55 }
56 
57 // pop all items in the q and apply the given fun on each of them.
59 {
60  std::lock_guard<std::mutex> lock{mutex_};
61  while (!messages_.empty())
62  {
63  auto &front_msg = messages_.front();
64  fun(front_msg);
65  messages_.pop_front();
66  }
67 }
68 } // namespace details
69 } // namespace spdlog
spdlog::details::backtracer::enabled_
std::atomic< bool > enabled_
Definition: backtracer.h:21
spdlog::details::backtracer::mutex_
std::mutex mutex_
Definition: backtracer.h:20
SPDLOG_NOEXCEPT
#define SPDLOG_NOEXCEPT
Definition: common.h:64
size
end IFFT Reshape the symbol vector into two different spatial streams size
Definition: generate_data.m:73
spdlog::details::backtracer::messages_
circular_q< log_msg_buffer > messages_
Definition: backtracer.h:22
spdlog::details::backtracer::operator=
backtracer & operator=(backtracer other)
Definition: backtracer-inl.h:25
spdlog::details::backtracer::enabled
bool enabled() const
Definition: backtracer-inl.h:46
spdlog
Definition: async.h:25
SPDLOG_INLINE
#define SPDLOG_INLINE
Definition: common.h:42
spdlog::details::log_msg_buffer
Definition: log_msg_buffer.h:14
spdlog::details::backtracer::foreach_pop
void foreach_pop(std::function< void(const details::log_msg &)> fun)
Definition: backtracer-inl.h:58
function
function[avg_proc_duration, std_proc_duration]
Definition: parse_dl_file.m:1
spdlog::details::log_msg
Definition: log_msg.h:11
spdlog::details::backtracer::backtracer
backtracer()=default
spdlog::details::backtracer::push_back
void push_back(const log_msg &msg)
Definition: backtracer-inl.h:51
spdlog::details::backtracer::enable
void enable(size_t size)
Definition: backtracer-inl.h:33
spdlog::details::backtracer
Definition: backtracer.h:18
spdlog::details::circular_q
Definition: circular_q.h:13
backtracer.h
spdlog::details::backtracer::disable
void disable()
Definition: backtracer-inl.h:40