| atscppapi
    1.0.9
    C++ wrapper for Apache Traffic Server API | 
A Stat is an atomic variable that can be used to store counters, averages, time averages, or summations. More...
#include "Stat.h"
Inherits atscppapi::noncopyable.
| Public Types | |
| enum | SyncType { SYNC_SUM = 0, SYNC_COUNT, SYNC_AVG, SYNC_TIMEAVG } | 
| Public Member Functions | |
| bool | init (std::string name, Stat::SyncType type=SYNC_COUNT, bool persistent=false) | 
| void | increment (int64_t amount=1) | 
| void | decrement (int64_t amount=1) | 
| int64_t | get () const | 
| void | set (int64_t value) | 
A Stat is an atomic variable that can be used to store counters, averages, time averages, or summations.
All stats are exposed through the traffic_line program included with Apache Traffic Server. Additionally, if you've enabled HttpStats all Stats you define will be displayed there. Stats can be read via traffic_line -r stat_name.
Stats are very easy to use, here is a simple example of how you can create a counter and increment its value:
A full example is available in examples/stat_example/.
The available Stat types.
| void Stat::decrement | ( | int64_t | amount = 1 | ) | 
This method allows you to decrement a stat by a certain amount.
| amount | the amount to decrement the stat by the default value is 1. | 
| int64_t Stat::get | ( | ) | const | 
This method returns the current value of the stat.
| void Stat::increment | ( | int64_t | amount = 1 | ) | 
This method allows you to increment a stat by a certain amount.
| amount | the amount to increment the stat by the default value is 1. | 
| bool Stat::init | ( | std::string | name, | 
| Stat::SyncType | type = SYNC_COUNT, | ||
| bool | persistent = false | ||
| ) | 
You must initialize your Stat with a call to this init() method.
| name | The string name of the stat, this will be visbible via traffic_line -r, or through http stats. | 
| type | The SyncType of the Stat, this decides how TrafficServer will treat your inputs. The default value is SYNC_COUNT. | 
| persistent | This determines if your Stats will persist, the default value is false. | 
| void Stat::set | ( | int64_t | value | ) | 
This method sets the value of the stat.
| value | the value to set the stat to. | 
 1.8.3.1
 1.8.3.1