Statistics Library

The statistics library can be used to provide statistics services within App. The following functionality is implemented:

Interface

class IStatisticsProvider * CreateStatisticsProvider()

Global function to instaniate the library. Usually called from the App main module. To have the library instantiated with this function, allows it to be replaced by a test library for unit testing.

The function class IStatistics * IStatisticsProvider::CreateStatistics() can be used to create the instance used within the AppInstance.

class IStatistics

Interface class to be used by the App Code

void Init(class UStatistics * user, class IDatabase * database)
Has to be called for initialization. As long a no StatisticsInitComplete is called all other calls to the interface are ignored
void StartMonitor(const char * type, class json_io & send, word base, char *& tmp)
Starts monitoring of a given value with the "Monitor" functionality outside the scope of the library
void Close()
Close the library. Has to be done for graceful AppInstance shutdown. Is acknowledged with StatisticsCloseComplete()
void CreateCategory(const char * name)
Used to create a category
void CreateChart(const char * category, const char * name, const char * condition)
Used to create a Chart. The condition identifies the datasets for the chart. Currently only a single dataset identified with the name is supported.
class IStatisticsDataset * CreateDataset(const char * name, enum StatisticsType type, class UStatisticsDataset * provider = 0)
Creates a dataset. If a provider pointer is given, no data is stored in the library, but the data is retrieved from the App itself using the void UStatisticsDataset::Get(class IStatisticsGet * user, long64 start, long64 end) function.

class IStatisticsDataset

Interface class to a dataset

void Data(long64 value)
Provide a value. The timestamp of the value is the current system timestamp as read from ITime::TimeStampMilliseconds()
void BusyStart()/void BusyEnd()
With the call to BusyEnd the time since the call to BusyStart is stored as value.

Steps to include the libray into an App