|
3 | 3 | // LICENSE file in the root directory of this source tree. An additional grant
|
4 | 4 | // of patent rights can be found in the PATENTS file in the same directory.
|
5 | 5 | //
|
| 6 | + |
| 7 | +#include <sstream> |
6 | 8 | #include "util/perf_context_imp.h"
|
7 | 9 |
|
8 | 10 | namespace rocksdb {
|
@@ -38,6 +40,35 @@ void PerfContext::Reset() {
|
38 | 40 | write_memtable_time = 0;
|
39 | 41 | }
|
40 | 42 |
|
| 43 | +#define OUTPUT(counter) #counter << " = " << counter << ", " |
| 44 | + |
| 45 | +std::string PerfContext::ToString() const { |
| 46 | + std::ostringstream ss; |
| 47 | + ss << OUTPUT(user_key_comparison_count) |
| 48 | + << OUTPUT(block_cache_hit_count) |
| 49 | + << OUTPUT(block_read_count) |
| 50 | + << OUTPUT(block_read_byte) |
| 51 | + << OUTPUT(block_read_time) |
| 52 | + << OUTPUT(block_checksum_time) |
| 53 | + << OUTPUT(block_decompress_time) |
| 54 | + << OUTPUT(internal_key_skipped_count) |
| 55 | + << OUTPUT(internal_delete_skipped_count) |
| 56 | + << OUTPUT(write_wal_time) |
| 57 | + << OUTPUT(get_snapshot_time) |
| 58 | + << OUTPUT(get_from_memtable_time) |
| 59 | + << OUTPUT(get_from_memtable_count) |
| 60 | + << OUTPUT(get_post_process_time) |
| 61 | + << OUTPUT(get_from_output_files_time) |
| 62 | + << OUTPUT(seek_child_seek_time) |
| 63 | + << OUTPUT(seek_child_seek_count) |
| 64 | + << OUTPUT(seek_min_heap_time) |
| 65 | + << OUTPUT(seek_internal_seek_time) |
| 66 | + << OUTPUT(find_next_user_entry_time) |
| 67 | + << OUTPUT(write_pre_and_post_process_time) |
| 68 | + << OUTPUT(write_memtable_time); |
| 69 | + return ss.str(); |
| 70 | +} |
| 71 | + |
41 | 72 | __thread PerfContext perf_context;
|
42 | 73 |
|
43 | 74 | }
|
0 commit comments