Class Stats

Class Documentation

class switchml::Stats

A class that groups up all statistics.

The class does no attempt to syncrhonize in any of its calls. It is the user classes responsibility to synchronize when needed.

Public Functions

Stats()

Initialize all members.

InitStats() must be called before any of the stats functions are used.

See

InitStats()

~Stats()

Cleans up the memory that has been allocated by InitStats()

See

InitStats()

Stats(Stats const&) = delete
void operator=(Stats const&) = delete
Stats(Stats&&) = default
Stats &operator=(Stats&&) = default
void InitStats(WorkerTid num_worker_threads)

Dynamically allocate necessary objects and reset all stats using ResetStats().

Parameters

num_worker_threads[in] The number of worker threads which will use this stats object.

void LogStats()

Parse and log all of the statistics using glog.

void ResetStats()

Clear all accumulated statistics.

std::string DescribeIntList(std::vector<uint64_t> list)

Describe the distribution of a list of integers.

Computes sum, mean, max, min, median, stdev

Parameters

list – The list of integers to describe

Returns

std::string a single line with all of the metrics.

std::string DescribeFloatList(std::vector<double> list)

Describe the distribution of a list of doubles.

Computes sum, mean, max, min, median, stdev

Parameters

list – The list of doubles to describe

Returns

std::string a single line with all of the metrics.

template<typename T>
std::string List2Str(std::vector<T> list)

Create a string representation of a list.

Parameters

list – The vector representing the list

Returns

std::string A single line with all of the elements

inline void IncJobsSubmittedNum()
inline void AppendJobSubmittedNumel(uint64_t size)
inline void IncJobsFinishedNum()
inline void AddTotalPktsSent(WorkerTid wtid, uint64_t to_add)
inline void AddCorrectPktsReceived(WorkerTid wtid, uint64_t to_add)
inline void AddWrongPktsReceived(WorkerTid wtid, uint64_t to_add)
inline void AddTimeouts(WorkerTid wtid, uint64_t to_add)