94 lines
3.5 KiB
Diff
94 lines
3.5 KiB
Diff
From 1c2831a2c1277c69f9649200d74a75c04a4b0296 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Mon, 21 Mar 2016 14:24:35 +0000
|
|
Subject: [PATCH] common/Cycles: Do not initialize Cycles globally.
|
|
|
|
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 | 11 ++++++-----
|
|
src/test/msgr/perf_msgr_client.cc | 1 +
|
|
src/test/msgr/perf_msgr_server.cc | 1 -
|
|
src/test/objectstore/ObjectStoreTransactionBenchmark.cc | 1 +
|
|
src/test/perf_local.cc | 1 +
|
|
5 files changed, 9 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/common/Cycles.cc b/src/common/Cycles.cc
|
|
index b0b687e..656f08b 100644
|
|
--- a/src/common/Cycles.cc
|
|
+++ b/src/common/Cycles.cc
|
|
@@ -38,14 +38,15 @@
|
|
#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()
|
|
{
|
|
diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc
|
|
index fa21b49..1cb3db2 100644
|
|
--- a/src/test/msgr/perf_msgr_client.cc
|
|
+++ b/src/test/msgr/perf_msgr_client.cc
|
|
@@ -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();
|
|
diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc
|
|
index 3eae9a5..dde679c 100644
|
|
--- a/src/test/msgr/perf_msgr_server.cc
|
|
+++ b/src/test/msgr/perf_msgr_server.cc
|
|
@@ -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"
|
|
diff --git a/src/test/objectstore/ObjectStoreTransactionBenchmark.cc b/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
|
|
index 7c0dc09..46fd25d 100644
|
|
--- a/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
|
|
+++ b/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
|
|
@@ -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) {
|
|
diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc
|
|
index 49440c2..7c33dc5 100644
|
|
--- a/src/test/perf_local.cc
|
|
+++ b/src/test/perf_local.cc
|
|
@@ -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) {
|
|
--
|
|
2.7.4
|
|
|