Manages Statistics from various services and consolidates them

A service wishing to generate stats needs to instantiate one of the StatsGroup objects specifying the group name of these stats as well as the send out frequency in terms of number of updates to this object.

Stats currently are either ints or doubles. And the constuction of the object must specify how many stats of each type will be stored in this object.

Then each int or double stat value must be bound by calling bindInt or bindDouble passing in the string display name of the stat and the index.

Subsequent access to update or increment the stat value is done via the index.

    Assuming STAT_DNS_MESSAGE is 0, and STAT_LOOKUP_OK is 1

    // ... Initialize the Stat Group
    StatsGroup m_pStatgroup = new StatsGroup("Lookup", a_dispatcher, 10, 2, 0);
    m_pStatgroup->bindInt("DNSMessage", STAT_DNS_MESSAGE);
    m_pStatgroup->bindInt("DNS Lookup OK", STAT_LOOKUP_OK);

    // ... Updating the stats. The stats will be sent to the stats service
    // ... every nth increment specified frequency.
    m_pStatgroup->incrementInt(STAT_DNS_MESSAGE);

Generated on Wed Oct 12 2011 21:46:52. © CodeLathe LLC 2007-2011. All Rights Reserved.