From 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 Mon Sep 17 00:00:00 2001 From: Mark Benvenuto Date: Sat, 20 Jun 2015 00:22:50 -0400 Subject: SERVER-18579: Clang-Format - reformat code, no comment reflow --- src/mongo/db/stats/counters.h | 114 +++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 51 deletions(-) (limited to 'src/mongo/db/stats/counters.h') diff --git a/src/mongo/db/stats/counters.h b/src/mongo/db/stats/counters.h index b29ebcce618..1821f7b7f1e 100644 --- a/src/mongo/db/stats/counters.h +++ b/src/mongo/db/stats/counters.h @@ -38,64 +38,76 @@ namespace mongo { - /** - * for storing operation counters - * note: not thread safe. ok with that for speed - */ - class OpCounters { - public: +/** + * for storing operation counters + * note: not thread safe. ok with that for speed + */ +class OpCounters { +public: + OpCounters(); + void incInsertInWriteLock(int n); + void gotInsert(); + void gotQuery(); + void gotUpdate(); + void gotDelete(); + void gotGetMore(); + void gotCommand(); + + void gotOp(int op, bool isCommand); + + BSONObj getObj() const; - OpCounters(); - void incInsertInWriteLock(int n); - void gotInsert(); - void gotQuery(); - void gotUpdate(); - void gotDelete(); - void gotGetMore(); - void gotCommand(); + // thse are used by snmp, and other things, do not remove + const AtomicUInt32* getInsert() const { + return &_insert; + } + const AtomicUInt32* getQuery() const { + return &_query; + } + const AtomicUInt32* getUpdate() const { + return &_update; + } + const AtomicUInt32* getDelete() const { + return &_delete; + } + const AtomicUInt32* getGetMore() const { + return &_getmore; + } + const AtomicUInt32* getCommand() const { + return &_command; + } - void gotOp( int op , bool isCommand ); +private: + void _checkWrap(); - BSONObj getObj() const; - - // thse are used by snmp, and other things, do not remove - const AtomicUInt32 * getInsert() const { return &_insert; } - const AtomicUInt32 * getQuery() const { return &_query; } - const AtomicUInt32 * getUpdate() const { return &_update; } - const AtomicUInt32 * getDelete() const { return &_delete; } - const AtomicUInt32 * getGetMore() const { return &_getmore; } - const AtomicUInt32 * getCommand() const { return &_command; } + // todo: there will be a lot of cache line contention on these. need to do something + // else eventually. + AtomicUInt32 _insert; + AtomicUInt32 _query; + AtomicUInt32 _update; + AtomicUInt32 _delete; + AtomicUInt32 _getmore; + AtomicUInt32 _command; +}; - private: - void _checkWrap(); - - // todo: there will be a lot of cache line contention on these. need to do something - // else eventually. - AtomicUInt32 _insert; - AtomicUInt32 _query; - AtomicUInt32 _update; - AtomicUInt32 _delete; - AtomicUInt32 _getmore; - AtomicUInt32 _command; - }; +extern OpCounters globalOpCounters; +extern OpCounters replOpCounters; - extern OpCounters globalOpCounters; - extern OpCounters replOpCounters; +class NetworkCounter { +public: + NetworkCounter() : _bytesIn(0), _bytesOut(0), _requests(0), _overflows(0) {} + void hit(long long bytesIn, long long bytesOut); + void append(BSONObjBuilder& b); - class NetworkCounter { - public: - NetworkCounter() : _bytesIn(0), _bytesOut(0), _requests(0), _overflows(0) {} - void hit( long long bytesIn , long long bytesOut ); - void append( BSONObjBuilder& b ); - private: - long long _bytesIn; - long long _bytesOut; - long long _requests; +private: + long long _bytesIn; + long long _bytesOut; + long long _requests; - long long _overflows; + long long _overflows; - SpinLock _lock; - }; + SpinLock _lock; +}; - extern NetworkCounter networkCounter; +extern NetworkCounter networkCounter; } -- cgit v1.2.1