summaryrefslogtreecommitdiff
path: root/src/mongo/db/stats/counters.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/stats/counters.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/stats/counters.h')
-rw-r--r--src/mongo/db/stats/counters.h114
1 files changed, 63 insertions, 51 deletions
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;
}