c594b0e89d
Summary: Allow GetThreadList() to report operation stage. Test Plan: ./thread_list_test ./db_bench --benchmarks=fillrandom --num=100000 --threads=40 \ --max_background_compactions=10 --max_background_flushes=3 \ --thread_status_per_interval=1000 --key_size=16 --value_size=1000 \ --num_column_families=10 export ROCKSDB_TESTS=ThreadStatus ./db_test Sample output ThreadID ThreadType cfName Operation OP_StartTime ElapsedTime Stage State 140116265861184 Low Pri 140116270055488 Low Pri 140116274249792 High Pri column_family_name_000005 Flush 2015/03/10-14:58:11 0 us FlushJob::WriteLevel0Table 140116400078912 Low Pri column_family_name_000004 Compaction 2015/03/10-14:58:11 0 us CompactionJob::FinishCompactionOutputFile 140116358135872 Low Pri column_family_name_000006 Compaction 2015/03/10-14:58:10 1 us CompactionJob::FinishCompactionOutputFile 140116341358656 Low Pri 140116295221312 High Pri default Flush 2015/03/10-14:58:11 0 us FlushJob::WriteLevel0Table 140116324581440 Low Pri column_family_name_000009 Compaction 2015/03/10-14:58:11 0 us CompactionJob::ProcessKeyValueCompaction 140116278444096 Low Pri 140116299415616 Low Pri column_family_name_000008 Compaction 2015/03/10-14:58:11 0 us CompactionJob::FinishCompactionOutputFile 140116291027008 High Pri column_family_name_000001 Flush 2015/03/10-14:58:11 0 us FlushJob::WriteLevel0Table 140116286832704 Low Pri column_family_name_000002 Compaction 2015/03/10-14:58:11 0 us CompactionJob::FinishCompactionOutputFile 140116282638400 Low Pri Reviewers: rven, igor, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D34683
78 lines
2.0 KiB
C++
78 lines
2.0 KiB
C++
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#include "rocksdb/env.h"
|
|
#include "rocksdb/thread_status.h"
|
|
#include "util/thread_operation.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
#if ROCKSDB_USING_THREAD_STATUS
|
|
const std::string& ThreadStatus::GetThreadTypeName(
|
|
ThreadStatus::ThreadType thread_type) {
|
|
static std::string thread_type_names[NUM_THREAD_TYPES + 1] = {
|
|
"High Pri", "Low Pri", "User", "Unknown"};
|
|
return thread_type_names[thread_type];
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetOperationName(
|
|
ThreadStatus::OperationType op_type) {
|
|
return global_operation_table[op_type].name;
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetOperationStageName(
|
|
ThreadStatus::OperationStage stage) {
|
|
return global_op_stage_table[stage].name;
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetStateName(
|
|
ThreadStatus::StateType state_type) {
|
|
return global_state_table[state_type].name;
|
|
}
|
|
|
|
const std::string ThreadStatus::TimeToString(
|
|
int64_t time) {
|
|
if (time == 0) {
|
|
return "";
|
|
}
|
|
return Env::Default()->TimeToString(time);
|
|
}
|
|
|
|
#else
|
|
|
|
const std::string& ThreadStatus::GetThreadTypeName(
|
|
ThreadStatus::ThreadType thread_type) {
|
|
static std::string dummy_str = "";
|
|
return dummy_str;
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetOperationName(
|
|
ThreadStatus::OperationType op_type) {
|
|
static std::string dummy_str = "";
|
|
return dummy_str;
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetOperationStageName(
|
|
ThreadStatus::OperationStage stage) {
|
|
static std::string dummy_str = "";
|
|
return dummy_str;
|
|
}
|
|
|
|
const std::string& ThreadStatus::GetStateName(
|
|
ThreadStatus::StateType state_type) {
|
|
static std::string dummy_str = "";
|
|
return dummy_str;
|
|
}
|
|
|
|
const std::string ThreadStatus::TimeToString(
|
|
int64_t time) {
|
|
static std::string dummy_str = "";
|
|
return dummy_str;
|
|
}
|
|
|
|
#endif // ROCKSDB_USING_THREAD_STATUS
|
|
} // namespace rocksdb
|