28 #ifndef DOZERG_ATTR_STATS_H_20130606 29 #define DOZERG_ATTR_STATS_H_20130606 31 #include "impl/attr_stats_impl.hh" 63 #define ATTR_ADD(attr, val) \ 65 __UNUSED typedef NS_SERVER::NS_IMPL::__AttrDummy<attr> attr_must_be_constant; \ 66 static uint64_t * __Attr = NULL; \ 68 __Attr = NS_SERVER::NS_IMPL::CAttrStats::Inst().attrAdd(attr, val); \ 70 NS_SERVER::NS_IMPL::CAttrStats::attrAdd(__Attr, val); \ 81 return NS_IMPL::CAttrStats::Inst().init(capacity);
93 return (NULL != NS_IMPL::CAttrStats::Inst().attrAdd(attr, val));
122 #define ATTR_SET(attr, val) \ 124 __UNUSED typedef NS_SERVER::NS_IMPL::__AttrDummy<attr> attr_must_be_constant; \ 125 static uint64_t * __Attr = NULL; \ 127 __Attr = NS_SERVER::NS_IMPL::CAttrStats::Inst().attrSet(attr, val); \ 129 NS_SERVER::NS_IMPL::CAttrStats::attrSet(__Attr, val); \ 145 #define ATTR_SET_EX(attr, val, old) \ 147 __UNUSED typedef NS_SERVER::NS_IMPL::__AttrDummy<attr> attr_must_be_constant; \ 148 static uint64_t * __Attr = NULL; \ 150 __Attr = NS_SERVER::NS_IMPL::CAttrStats::Inst().attrSet(attr, val, old); \ 152 NS_SERVER::NS_IMPL::CAttrStats::attrSet(__Attr, val, old); \ 165 return (NULL != NS_IMPL::CAttrStats::Inst().attrSet(attr, val, old));
180 return NS_IMPL::CAttrStats::Inst().iterate(op);
bool ATTR_ADD_SLOW(int attr, uint64_t val)
Increase an attribute atomically.
Definition: attr_stats.hh:91
void ATTR_ITERATE(Op op)
Iterate and apply an operation to all attributes.
Definition: attr_stats.hh:178
bool ATTR_INIT(size_t capacity=1000)
Initialize statistics APIs.
Definition: attr_stats.hh:79
bool ATTR_SET_SLOW(int attr, uint64_t val, uint64_t *old=NULL)
Get an attribute and then modify it atomically.
Definition: attr_stats.hh:163