perf_context.h 866 字节
Newer Older
1 2
#ifndef STORAGE_ROCKSDB_INCLUDE_PERF_CONTEXT_H
#define STORAGE_ROCKSDB_INCLUDE_PERF_CONTEXT_H
3 4 5 6 7

#include <stdint.h>

namespace leveldb {

8 9 10 11 12 13 14 15 16
enum PerfLevel {
  kDisable        = 0,  // disable perf stats
  kEnableCount    = 1,  // enable only count stats
  kEnableTime     = 2   // enable time stats too
};

// set the perf stats level
void SetPerfLevel(PerfLevel level);

17 18 19 20 21 22 23 24
// A thread local context for gathering performance counter efficiently
// and transparently.

struct PerfContext {

  void Reset(); // reset all performance counters to zero

  uint64_t user_key_comparison_count; // total number of user key comparisons
25 26 27 28 29 30
  uint64_t block_cache_hit_count;
  uint64_t block_read_count;
  uint64_t block_read_byte;
  uint64_t block_read_time;
  uint64_t block_checksum_time;
  uint64_t block_decompress_time;
31 32 33 34 35 36 37 38
};

extern __thread PerfContext perf_context;

}


#endif