The Battle for Wesnoth  1.15.2+dev
Classes | Public Member Functions | Private Attributes | Friends | List of all members
metrics Class Reference

#include <metrics.hpp>

Classes

struct  sample
 

Public Member Functions

 metrics ()
 
 ~metrics ()
 
void service_request ()
 
void no_requests ()
 
void record_sample (const simple_wml::string_span &name, clock_t parsing_time, clock_t processing_time)
 
void game_terminated (const std::string &reason)
 
std::ostream & games (std::ostream &out) const
 
std::ostream & requests (std::ostream &out) const
 

Private Attributes

std::vector< samplesamples_
 
int most_consecutive_requests_
 
int current_requests_
 
int nrequests_
 
int nrequests_waited_
 
const std::time_t started_at_
 
std::map< std::string, int > terminations_
 

Friends

std::ostream & operator<< (std::ostream &out, metrics &met)
 

Detailed Description

Definition at line 27 of file metrics.hpp.

Constructor & Destructor Documentation

◆ metrics()

metrics::metrics ( )

Definition at line 39 of file metrics.cpp.

◆ ~metrics()

metrics::~metrics ( )

Definition at line 49 of file metrics.cpp.

References samples_.

Member Function Documentation

◆ game_terminated()

void metrics::game_terminated ( const std::string &  reason)

Definition at line 104 of file metrics.cpp.

References terminations_.

Referenced by wesnothd::server::cleanup_game().

◆ games()

std::ostream & metrics::games ( std::ostream &  out) const

Definition at line 109 of file metrics.cpp.

References i, n, and terminations_.

Referenced by wesnothd::server::games_handler().

◆ no_requests()

void metrics::no_requests ( )

Definition at line 73 of file metrics.cpp.

References current_requests_.

◆ record_sample()

void metrics::record_sample ( const simple_wml::string_span name,
clock_t  parsing_time,
clock_t  processing_time 
)

◆ requests()

std::ostream & metrics::requests ( std::ostream &  out) const

Definition at line 124 of file metrics.cpp.

References n, s, samples_, and sort().

Referenced by wesnothd::server::requests_handler().

◆ service_request()

void metrics::service_request ( )

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
metrics met 
)
friend

Definition at line 151 of file metrics.cpp.

Member Data Documentation

◆ current_requests_

int metrics::current_requests_
private

Definition at line 72 of file metrics.hpp.

Referenced by no_requests(), and service_request().

◆ most_consecutive_requests_

int metrics::most_consecutive_requests_
private

Definition at line 71 of file metrics.hpp.

Referenced by operator<<(), and service_request().

◆ nrequests_

int metrics::nrequests_
private

Definition at line 73 of file metrics.hpp.

Referenced by operator<<(), and service_request().

◆ nrequests_waited_

int metrics::nrequests_waited_
private

Definition at line 74 of file metrics.hpp.

Referenced by operator<<(), and service_request().

◆ samples_

std::vector<sample> metrics::samples_
private

Definition at line 69 of file metrics.hpp.

Referenced by record_sample(), requests(), and ~metrics().

◆ started_at_

const std::time_t metrics::started_at_
private

Definition at line 75 of file metrics.hpp.

Referenced by operator<<().

◆ terminations_

std::map<std::string,int> metrics::terminations_
private

Definition at line 76 of file metrics.hpp.

Referenced by game_terminated(), and games().


The documentation for this class was generated from the following files: