26#ifndef ROUTING_TRACER_INCLUDED
27#define ROUTING_TRACER_INCLUDED
109 case Direction::kClientToRouter:
111 case Direction::kRouterToClient:
113 case Direction::kRouterToServer:
115 case Direction::kServerToRouter:
117 case Direction::kServerClose:
119 case Direction::kClientClose:
131 auto now = clock_type::now();
134 std::chrono::duration_cast<std::chrono::microseconds>(now -
start_);
136 std::chrono::duration_cast<std::chrono::microseconds>(now -
last_);
139 oss <<
"/* " << std::setw(10) << delta_now.count() <<
" us ("
140 << std::showpos << std::setw(10) << delta_last.count() << std::noshowpos
158 fputs(oss.str().c_str(), stderr);
163 explicit operator bool()
const {
return enabled_; }
std::string name_
Definition: tracer.h:70
std::string name() const
Definition: tracer.h:67
Stage(std::string name)
Definition: tracer.h:65
Direction
Definition: tracer.h:73
std::optional< Direction > direction() const
Definition: tracer.h:87
std::optional< Direction > direction_
Definition: tracer.h:101
std::optional< Stage > stage_
Definition: tracer.h:102
Wait
Definition: tracer.h:82
Event & stage(std::string_view s)
Definition: tracer.h:90
std::optional< Stage > stage() const
Definition: tracer.h:88
Event & direction(Direction dir)
Definition: tracer.h:95
traces the timestamps of events in a stderr log.
Definition: tracer.h:49
clock_type::time_point start_
Definition: tracer.h:168
static std::string direction(Event::Direction direction)
Definition: tracer.h:105
bool enabled_
Definition: tracer.h:166
clock_type::time_point last_
Definition: tracer.h:169
static std::string stage(Event::Stage st)
Definition: tracer.h:126
Tracer(bool enabled)
Definition: tracer.h:55
std::chrono::steady_clock clock_type
Definition: tracer.h:51
void trace(Event e)
Definition: tracer.h:128
std::string dir
Double write files location.
Definition: buf0dblwr.cc:77
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2872
required bool enabled
Definition: replication_group_member_actions.proto:33