]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Cycles: Do not initialize Cycles globally.
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 21 Mar 2016 14:24:35 +0000 (14:24 +0000)
committerJosh Durgin <jdurgin@redhat.com>
Sat, 2 Apr 2016 19:34:10 +0000 (12:34 -0700)
Move initialization to the few tests that actually use it.

Fixes: http://tracker.ceph.com/issues/15225
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
src/common/Cycles.cc
src/test/msgr/perf_msgr_client.cc
src/test/msgr/perf_msgr_server.cc
src/test/objectstore/ObjectStoreTransactionBenchmark.cc
src/test/perf_local.cc

index b0b687e49d46b3d3ea1c4bfac449ecfd5950957d..656f08b40ceeab8a7a51225bee8e63ef833ce6f8 100644 (file)
 #include "Cycles.h"
 
 double Cycles::cycles_per_sec = 0;
-static Initialize _(Cycles::init);
 
 /**
  * Perform once-only overall initialization for the Cycles class, such
- * as calibrating the clock frequency.  This method is invoked automatically
- * during initialization, but it may be invoked explicitly by other modules
- * to ensure that initialization occurs before those modules initialize
- * themselves.
+ * as calibrating the clock frequency.  This method must be called
+ * before using the Cycles module.
+ *
+ * It is not initialized by default because the timing loops cause
+ * general process startup times to balloon
+ * (http://tracker.ceph.com/issues/15225).
  */
 void Cycles::init()
 {
index fa21b493119f3c23e492bff2dbbda27cfd257465..1cb3db2ce798ea3e40f2b8f1c2994c2880f3ff15 100644 (file)
@@ -196,6 +196,7 @@ int main(int argc, char **argv)
   cerr << "       message data bytes " << len << std::endl;
   MessengerClient client(g_ceph_context->_conf->ms_type, args[0], think_time);
   client.ready(concurrent, numjobs, ios, len);
+  Cycles::init();
   uint64_t start = Cycles::rdtsc();
   client.start();
   uint64_t stop = Cycles::rdtsc();
index 3eae9a513cce317ace69fd97653e3654703d9bce..dde679c433ee2e05a951d1214a54e2e9ec79067c 100644 (file)
@@ -25,7 +25,6 @@ using namespace std;
 #include "include/atomic.h"
 #include "common/ceph_argparse.h"
 #include "common/debug.h"
-#include "common/Cycles.h"
 #include "global/global_init.h"
 #include "msg/Messenger.h"
 #include "messages/MOSDOp.h"
index 7c0dc0915211dac847cb910408e7fcb31a612964..46fd25dcebbf6931971892ce548cd501ee725510 100644 (file)
@@ -249,6 +249,7 @@ int main(int argc, char **argv)
   global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
   common_init_finish(g_ceph_context);
   g_ceph_context->_conf->apply_changes(NULL);
+  Cycles::init();
 
   cerr << "args: " << args << std::endl;
   if (args.size() < 1) {
index 49440c2b3704d0c37891c92a136d89ddba2ac274..7c33dc5d45462249e754af89108aecb5fe496ee0 100644 (file)
@@ -1020,6 +1020,7 @@ int main(int argc, char *argv[])
 
   global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
   common_init_finish(g_ceph_context);
+  Cycles::init();
 
   bind_thread_to_cpu(3);
   if (argc == 1) {