TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
#include <metrics.h>
Classes | |
class | Timer |
Public Types | |
using | Timestamp = uint64_t |
using | Event = std::pair< Timestamp, float > |
using | Events = std::pair< Timestamp, std::vector< float >> |
using | TimeInterval = double |
using | Reducer = std::function< float(float, float)> |
Public Member Functions | |
void | pushEvent (std::string const &key, float value=1.0) |
void | pushEvents (std::string const &key, std::vector< float > values) |
Event | getLastEvent (std::string const &key) const |
std::vector< Event > | getLastEvents (std::string const &key, size_t n) const |
float | getLastEventValue (std::string const &key) const |
bool | hasEvent (std::string const &key) const |
std::unordered_map< std::string, float > | getMeanEventValues () const |
std::unordered_map< std::string, float > | reduceEventValues (const Reducer &reducer, float initValue) const |
Behaves exactly as std::accumulate on all the events streams. More... | |
void | incCounter (std::string const &key, float amount=1.0) |
void | setCounter (std::string const &key, float amount) |
bool | hasCounter (std::string const &key) const |
float | getCounter (std::string const &key) const |
float | getCounter (std::string const &key, float defaultValue) const |
void | snapshotCounter (std::string const &counterKey, std::string const &eventKey, float defaultValue) |
TimeInterval | getLastInterval (std::string const &key) const |
std::unordered_map< std::string, float > | getMeanIntervals () const |
std::unordered_map< std::string, float > | reduceIntervals (const Reducer &reducer, float initValue) const |
Behaves exactly as std::accumulate on all the intervals streams. More... | |
void | dumpJson (std::string const &path) const |
void | dumpJson (std::ostream &) const |
void | loadJson (std::string const &path) |
void | loadJson (std::istream &) |
void | clear () |
bool | operator== (const MetricsContext &) const |
Protected Attributes | |
std::unordered_map< std::string, std::vector< Event > > | timeSeries_ |
std::unordered_map< std::string, std::vector< Events > > | timeSeriesS_ |
std::unordered_map< std::string, float > | counters_ |
std::unordered_map< std::string, std::vector< TimeInterval > > | intervals_ |
std::mutex | mutex_ |
using cpid::MetricsContext::Event = std::pair<Timestamp, float> |
using cpid::MetricsContext::Events = std::pair<Timestamp, std::vector<float>> |
using cpid::MetricsContext::Reducer = std::function<float(float, float)> |
using cpid::MetricsContext::TimeInterval = double |
using cpid::MetricsContext::Timestamp = uint64_t |
void MetricsContext::clear | ( | ) |
void MetricsContext::dumpJson | ( | std::string const & | path | ) | const |
void MetricsContext::dumpJson | ( | std::ostream & | o | ) | const |
float MetricsContext::getCounter | ( | std::string const & | key | ) | const |
float MetricsContext::getCounter | ( | std::string const & | key, |
float | defaultValue | ||
) | const |
MetricsContext::Event MetricsContext::getLastEvent | ( | std::string const & | key | ) | const |
std::vector< MetricsContext::Event > MetricsContext::getLastEvents | ( | std::string const & | key, |
size_t | n | ||
) | const |
float MetricsContext::getLastEventValue | ( | std::string const & | key | ) | const |
MetricsContext::TimeInterval MetricsContext::getLastInterval | ( | std::string const & | key | ) | const |
std::unordered_map< std::string, float > MetricsContext::getMeanEventValues | ( | ) | const |
std::unordered_map< std::string, float > MetricsContext::getMeanIntervals | ( | ) | const |
bool MetricsContext::hasCounter | ( | std::string const & | key | ) | const |
bool MetricsContext::hasEvent | ( | std::string const & | key | ) | const |
void MetricsContext::incCounter | ( | std::string const & | key, |
float | amount = 1.0 |
||
) |
void MetricsContext::loadJson | ( | std::string const & | path | ) |
void MetricsContext::loadJson | ( | std::istream & | is | ) |
bool MetricsContext::operator== | ( | const MetricsContext & | o | ) | const |
void MetricsContext::pushEvent | ( | std::string const & | key, |
float | value = 1.0 |
||
) |
void MetricsContext::pushEvents | ( | std::string const & | key, |
std::vector< float > | values | ||
) |
std::unordered_map< std::string, float > MetricsContext::reduceEventValues | ( | const Reducer & | reducer, |
float | initValue | ||
) | const |
Behaves exactly as std::accumulate on all the events streams.
std::unordered_map< std::string, float > MetricsContext::reduceIntervals | ( | const Reducer & | reducer, |
float | initValue | ||
) | const |
Behaves exactly as std::accumulate on all the intervals streams.
void MetricsContext::setCounter | ( | std::string const & | key, |
float | amount | ||
) |
void MetricsContext::snapshotCounter | ( | std::string const & | counterKey, |
std::string const & | eventKey, | ||
float | defaultValue | ||
) |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |