CMAKE_DEPENDENT_OPTION(WITH_CEPH_DEBUG_MUTEX "Use debug ceph::mutex with lockdep" ON
"CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
+option(WITH_CPUTRACE "Enable Cputrace support via the admin socket" OFF)
+
#if allocator is set on command line make sure it matches below strings
set(ALLOCATOR "" CACHE STRING
"specify memory allocator to use. currently tcmalloc, tcmalloc_minimal, \
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-DCEPH_DEBUG_MUTEX>)
endif()
+if(WITH_CPUTRACE)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-DWITH_CPUTRACE>)
+endif()
+
include(CheckCCompilerFlag)
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STACK_PROTECT)
// for CINIT_FLAGS
#include "common/common_init.h"
+#ifdef WITH_CPUTRACE
+#include "common/cputrace.h"
+#endif
+
#include <iostream>
#include <pthread.h>
else if (command == "log reopen") {
_log->reopen_log_file();
}
+#ifdef WITH_CPUTRACE
+ else if (command == "cputrace start") {
+ cputrace_start(f);
+ }
+ else if (command == "cputrace stop") {
+ cputrace_stop(f);
+ }
+ else if (command == "cputrace dump") {
+ std::string logger;
+ std::string counter;
+ cmd_getval(cmdmap, "logger", logger);
+ cmd_getval(cmdmap, "counter", counter);
+ cputrace_dump(f, logger, counter);
+ }
+ else if (command == "cputrace reset") {
+ cputrace_reset(f);
+ }
+#endif
else {
ceph_abort_msg("registered under wrong command?");
}
_admin_socket->register_command("log dump", _admin_hook, "dump recent log entries to log file");
_admin_socket->register_command("log reopen", _admin_hook, "reopen log file");
+#ifdef WITH_CPUTRACE
+ _admin_socket->register_command("cputrace start", _admin_hook, "start cpu profiling");
+ _admin_socket->register_command("cputrace stop", _admin_hook, "stop cpu profiling");
+ _admin_socket->register_command("cputrace reset", _admin_hook, "reset cpu profiling");
+ _admin_socket->register_command("cputrace dump name=logger,type=CephString,req=false name=counter,type=CephString,req=false", _admin_hook, "dump cpu profiling results");
+#endif
_crypto_none = CryptoHandler::create(CEPH_CRYPTO_NONE);
_crypto_aes = CryptoHandler::create(CEPH_CRYPTO_AES);
_crypto_random.reset(new CryptoRandom());