proxygen
|
#include <TraceEvent.h>
Classes | |
class | Iterator |
struct | MetaData |
Public Types | |
using | MetaDataMap = std::map< TraceFieldType, MetaData > |
Public Member Functions | |
FB_EXPORT | TraceEvent (TraceEventType type, uint32_t parentID=0) |
void | start (const TimeUtil &tm) |
void | start (TimePoint startTime) |
void | end (const TimeUtil &tm) |
void | end (TimePoint endTime) |
bool | hasStarted () const |
bool | hasEnded () const |
TimePoint | getStartTime () const |
TimePoint | getEndTime () const |
TraceEventType | getType () const |
uint32_t | getID () const |
void | setParentID (uint32_t parent) |
uint32_t | getParentID () const |
bool | hasTraceField (TraceFieldType field) const |
template<typename T > | |
T | getTraceFieldDataAs (TraceFieldType field) const |
void | setMetaData (MetaDataMap &&input) |
const MetaDataMap & | getMetaData () const |
Iterator | getMetaDataItr () const |
template<typename T > | |
bool | addMeta (TraceFieldType key, T &&value) |
template<typename T > | |
bool | addMeta (TraceFieldType key, const T &value) |
template<typename T > | |
bool | readIntMeta (TraceFieldType key, T &dest) const |
bool | readBoolMeta (TraceFieldType key, bool &dest) const |
bool | readStrMeta (TraceFieldType key, std::string &dest) const |
std::string | toString () const |
Private Types | |
enum | State { NOT_STARTED = 0, STARTED = 1, ENDED = 2 } |
Private Member Functions | |
template<typename T > | |
bool | readMeta (TraceFieldType key, T &dest) const |
FB_EXPORT bool | addMetaInternal (TraceFieldType key, MetaData &&val) |
Private Attributes | |
uint8_t | stateFlags_ {0} |
TraceEventType | type_ |
uint32_t | id_ |
uint32_t | parentID_ |
TimePoint | start_ |
TimePoint | end_ |
MetaDataMap | metaData_ |
Friends | |
class | Iterator |
std::ostream & | operator<< (std::ostream &out, const TraceEvent &event) |
Simple structure to track timing of event in request flow then we can report back to the application.
Definition at line 37 of file TraceEvent.h.
Definition at line 99 of file TraceEvent.h.
|
private |
Enumerator | |
---|---|
NOT_STARTED | |
STARTED | |
ENDED |
Definition at line 264 of file TraceEvent.h.
|
explicit |
Definition at line 30 of file TraceEvent.cpp.
|
inline |
Definition at line 218 of file TraceEvent.h.
References addMetaInternal(), folly::gen::move, val, and value.
Referenced by TEST().
|
inline |
Definition at line 224 of file TraceEvent.h.
References addMetaInternal(), folly::gen::move, and val.
|
private |
Definition at line 72 of file TraceEvent.cpp.
References metaData_, and value.
Referenced by addMeta(), and readMeta().
void proxygen::TraceEvent::end | ( | const TimeUtil & | tm | ) |
Sets the end time to the current time according to the TimeUtil.
Definition at line 47 of file TraceEvent.cpp.
References end_, proxygen::TimeUtilGeneric< ClockType >::now(), and stateFlags_.
Referenced by TEST().
void proxygen::TraceEvent::end | ( | TimePoint | endTime | ) |
Sets the end time to the given TimePoint.
Definition at line 52 of file TraceEvent.cpp.
References end_, and stateFlags_.
|
inline |
Definition at line 174 of file TraceEvent.h.
References end_.
|
inline |
|
inline |
|
inline |
Definition at line 213 of file TraceEvent.h.
References Iterator.
Referenced by TEST(), and toString().
|
inline |
|
inline |
|
inline |
|
inline |
bool proxygen::TraceEvent::hasEnded | ( | ) | const |
true iff end() has been called on this TraceEvent.
Definition at line 61 of file TraceEvent.cpp.
References stateFlags_.
bool proxygen::TraceEvent::hasStarted | ( | ) | const |
true iff start() has been called on this TraceEvent.
Definition at line 57 of file TraceEvent.cpp.
References stateFlags_.
|
inline |
bool proxygen::TraceEvent::readBoolMeta | ( | TraceFieldType | key, |
bool & | dest | ||
) | const |
Definition at line 65 of file TraceEvent.cpp.
References readMeta().
Referenced by readIntMeta().
|
inline |
Definition at line 230 of file TraceEvent.h.
References upload::dest, operator<<, readBoolMeta(), readMeta(), readStrMeta(), string, toString(), and value.
|
inlineprivate |
Definition at line 249 of file TraceEvent.h.
References addMetaInternal(), FB_EXPORT, metaData_, T, and val.
Referenced by readBoolMeta(), readIntMeta(), and readStrMeta().
bool proxygen::TraceEvent::readStrMeta | ( | TraceFieldType | key, |
std::string & | dest | ||
) | const |
Definition at line 69 of file TraceEvent.cpp.
References readMeta().
Referenced by readIntMeta().
|
inline |
|
inline |
void proxygen::TraceEvent::start | ( | const TimeUtil & | tm | ) |
Sets the start time to the current time according to the TimeUtil.
Definition at line 37 of file TraceEvent.cpp.
References proxygen::TimeUtilGeneric< ClockType >::now(), start_, and stateFlags_.
Referenced by TEST().
void proxygen::TraceEvent::start | ( | TimePoint | startTime | ) |
Sets the start time to the given TimePoint.
Definition at line 42 of file TraceEvent.cpp.
References start_, and stateFlags_.
std::string proxygen::TraceEvent::toString | ( | ) | const |
Definition at line 83 of file TraceEvent.cpp.
References count, end_, getMetaDataItr(), proxygen::getTraceEventTypeString(), proxygen::getTraceFieldTypeString(), id_, parentID_, start_, string, and type_.
Referenced by readIntMeta(), and TEST().
|
friend |
Definition at line 245 of file TraceEvent.h.
Referenced by getMetaDataItr().
|
friend |
Definition at line 116 of file TraceEvent.cpp.
Referenced by readIntMeta().
|
private |
Definition at line 275 of file TraceEvent.h.
Referenced by end(), getEndTime(), and toString().
|
private |
Definition at line 272 of file TraceEvent.h.
Referenced by getID(), toString(), and TraceEvent().
|
private |
Definition at line 276 of file TraceEvent.h.
Referenced by addMetaInternal(), getMetaData(), getTraceFieldDataAs(), hasTraceField(), readMeta(), and setMetaData().
|
private |
Definition at line 273 of file TraceEvent.h.
Referenced by getParentID(), setParentID(), and toString().
|
private |
Definition at line 274 of file TraceEvent.h.
Referenced by getStartTime(), start(), and toString().
|
private |
Definition at line 270 of file TraceEvent.h.
Referenced by end(), hasEnded(), hasStarted(), and start().
|
private |
Definition at line 271 of file TraceEvent.h.
Referenced by getType(), and toString().