AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Metric.h File Reference
#include "Define.h"
#include "Duration.h"
#include "MPSCQueue.h"
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>

Go to the source code of this file.

Classes

struct  MetricData
 
class  Metric
 
class  MetricStopWatch< LoggerType >
 

Namespaces

namespace  Acore
 
namespace  Acore::Asio
 

Macros

#define sMetric   Metric::instance()
 
#define METRIC_TAG(name, value)   { name, value }
 
#define METRIC_DO_CONCAT(a, b)   a##b
 
#define METRIC_CONCAT(a, b)   METRIC_DO_CONCAT(a, b)
 
#define METRIC_UNIQUE_NAME(name)   METRIC_CONCAT(name, __LINE__)
 
#define METRIC_EVENT(category, title, description)
 
#define METRIC_VALUE(category, value, ...)
 
#define METRIC_TIMER(category, ...)
 
#define METRIC_DETAILED_EVENT(category, title, description)   ((void)0)
 
#define METRIC_DETAILED_TIMER(category, ...)   ((void)0)
 
#define METRIC_DETAILED_NO_THRESHOLD_TIMER(category, ...)   ((void)0)
 

Typedefs

typedef std::pair< std::string, std::string > MetricTag
 

Enumerations

enum  MetricDataType {
  METRIC_DATA_VALUE ,
  METRIC_DATA_EVENT
}
 

Functions

template<typename LoggerType >
MetricStopWatch< LoggerType > MakeMetricStopWatch (LoggerType &&loggerFunc)
 

Macro Definition Documentation

◆ METRIC_CONCAT

#define METRIC_CONCAT (   a,
 
)    METRIC_DO_CONCAT(a, b)

◆ METRIC_DETAILED_EVENT

#define METRIC_DETAILED_EVENT (   category,
  title,
  description 
)    ((void)0)

◆ METRIC_DETAILED_NO_THRESHOLD_TIMER

#define METRIC_DETAILED_NO_THRESHOLD_TIMER (   category,
  ... 
)    ((void)0)

◆ METRIC_DETAILED_TIMER

#define METRIC_DETAILED_TIMER (   category,
  ... 
)    ((void)0)

◆ METRIC_DO_CONCAT

#define METRIC_DO_CONCAT (   a,
 
)    a##b

◆ METRIC_EVENT

#define METRIC_EVENT (   category,
  title,
  description 
)
Value:
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogEvent(category, title, description); \
} while (0) \
__pragma(warning(pop))
#define sMetric
Definition: Metric.h:130

◆ METRIC_TAG

#define METRIC_TAG (   name,
  value 
)    { name, value }

◆ METRIC_TIMER

#define METRIC_TIMER (   category,
  ... 
)
Value:
MetricStopWatch METRIC_UNIQUE_NAME(__ac_metric_stop_watch) = MakeMetricStopWatch([&](TimePoint start) \
{ \
sMetric->LogValue(category, std::chrono::steady_clock::now() - start, { __VA_ARGS__ }); \
});
MetricStopWatch< LoggerType > MakeMetricStopWatch(LoggerType &&loggerFunc)
Definition: Metric.h:154
#define METRIC_UNIQUE_NAME(name)
Definition: Metric.h:163
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition: Duration.h:69
Definition: Metric.h:134

◆ METRIC_UNIQUE_NAME

#define METRIC_UNIQUE_NAME (   name)    METRIC_CONCAT(name, __LINE__)

◆ METRIC_VALUE

#define METRIC_VALUE (   category,
  value,
  ... 
)
Value:
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { \
if (sMetric->IsEnabled()) \
sMetric->LogValue(category, value, { __VA_ARGS__ }); \
} while (0) \
__pragma(warning(pop))

◆ sMetric

#define sMetric   Metric::instance()

Typedef Documentation

◆ MetricTag

typedef std::pair<std::string, std::string> MetricTag

Enumeration Type Documentation

◆ MetricDataType

Enumerator
METRIC_DATA_VALUE 
METRIC_DATA_EVENT 
37{
40};
@ METRIC_DATA_EVENT
Definition: Metric.h:39
@ METRIC_DATA_VALUE
Definition: Metric.h:38

Function Documentation

◆ MakeMetricStopWatch()

template<typename LoggerType >
MetricStopWatch< LoggerType > MakeMetricStopWatch ( LoggerType &&  loggerFunc)
155{
156 return { std::forward<LoggerType>(loggerFunc) };
157}