diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/stats/fine_clock.h | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/stats/fine_clock.h')
-rw-r--r-- | src/mongo/db/stats/fine_clock.h | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/src/mongo/db/stats/fine_clock.h b/src/mongo/db/stats/fine_clock.h index 21f72d212a1..78762b73870 100644 --- a/src/mongo/db/stats/fine_clock.h +++ b/src/mongo/db/stats/fine_clock.h @@ -35,45 +35,41 @@ namespace mongo { - /** - * This is a nano-second precision clock. We're skipping the - * harware TSC in favor of clock_gettime() which in some systems - * does not involve a trip to the OS (VDSO). - * - * We're exporting a type WallTime that is and should remain - * opaque. The business of getting accurate time is still ongoing - * and we may change the internal representation of this class. - * (http://lwn.net/Articles/388188/) - * - * Really, you shouldn't be using this class in hot code paths for - * platforms you're not sure whether the overhead is low. - */ - class FineClock { - public: - - typedef timespec WallTime; +/** + * This is a nano-second precision clock. We're skipping the + * harware TSC in favor of clock_gettime() which in some systems + * does not involve a trip to the OS (VDSO). + * + * We're exporting a type WallTime that is and should remain + * opaque. The business of getting accurate time is still ongoing + * and we may change the internal representation of this class. + * (http://lwn.net/Articles/388188/) + * + * Really, you shouldn't be using this class in hot code paths for + * platforms you're not sure whether the overhead is low. + */ +class FineClock { +public: + typedef timespec WallTime; - static WallTime now() { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return ts; - } + static WallTime now() { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts; + } - static uint64_t diffInNanos( WallTime end, WallTime start ) { - uint64_t diff; - if ( end.tv_nsec < start.tv_nsec ) { - diff = 1000000000 * ( end.tv_sec - start.tv_sec - 1); - diff += 1000000000 + end.tv_nsec - start.tv_nsec; - } - else { - diff = 1000000000 * ( end.tv_sec - start.tv_sec ); - diff += end.tv_nsec - start.tv_nsec; - } - return diff; + static uint64_t diffInNanos(WallTime end, WallTime start) { + uint64_t diff; + if (end.tv_nsec < start.tv_nsec) { + diff = 1000000000 * (end.tv_sec - start.tv_sec - 1); + diff += 1000000000 + end.tv_nsec - start.tv_nsec; + } else { + diff = 1000000000 * (end.tv_sec - start.tv_sec); + diff += end.tv_nsec - start.tv_nsec; } - - }; + return diff; + } +}; } #endif // DB_STATS_FINE_CLOCK_HEADER - |