forked from facebook/rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perf Level By Bit Field #230
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9216d1c
implement perf level by bit field and redirect perf_level and its met…
LemonHX 5e888e7
removing chinese comment
LemonHX 02880fc
reformat code and rename the PerfLevelByBitField structure to PerfFlags.
LemonHX f1dae11
Reformat code and remove the usage of GetPerfLevel
LemonHX b5485ab
The data structure has been adjusted to make FFI more friendly. At th…
LemonHX c28cf61
Add FFI and restore the previous test cases and restore previous modi…
LemonHX a7357c3
git failed to diff this file for strage reason
LemonHX d39adb2
rollback design
LemonHX df2844c
removed nested if
LemonHX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#pragma once | ||
#include <cstdint> | ||
|
||
namespace rocksdb { | ||
struct PerfFlags { | ||
// represent original Level 2 | ||
// TODO: think a better design for context_by_level structure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo? |
||
uint8_t enable_perf_context_by_level_count_bit : 1; // 2 | ||
uint8_t enable_user_key_comparison_count_bit : 1; // 2 | ||
LemonHX marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uint8_t enable_block_cache_hit_count_bit : 1; // 2 | ||
uint8_t enable_block_read_count_bit : 1; // 2 | ||
uint8_t enable_block_read_byte_bit : 1; // 2 | ||
uint8_t enable_block_cache_index_hit_count_bit : 1; // 2 | ||
uint8_t enable_index_block_read_count_bit : 1; // 2 | ||
uint8_t enable_block_cache_filter_hit_count_bit : 1; // 2 | ||
uint8_t enable_filter_block_read_count_bit : 1; // 2 | ||
uint8_t enable_compression_dict_block_read_count_bit : 1; // 2 | ||
uint8_t enable_get_read_bytes_bit : 1; // 2 | ||
uint8_t enable_multiget_read_bytes_bit : 1; // 2 | ||
uint8_t enable_iter_read_bytes_bit : 1; // 2 | ||
uint8_t enable_internal_key_skipped_count_bit : 1; // 2 | ||
uint8_t enable_internal_delete_skipped_count_bit : 1; // 2 | ||
uint8_t enable_internal_recent_skipped_count_bit : 1; // 2 | ||
uint8_t enable_internal_merge_count_bit : 1; // 2 | ||
uint8_t enable_get_from_memtable_count_bit : 1; // 2 | ||
uint8_t enable_seek_on_memtable_count_bit : 1; // 2 | ||
uint8_t enable_next_on_memtable_count_bit : 1; // 2 | ||
uint8_t enable_prev_on_memtable_count_bit : 1; // 2 | ||
uint8_t enable_seek_child_seek_count_bit : 1; // 2 | ||
uint8_t enable_bloom_memtable_hit_count_bit : 1; // 2 | ||
uint8_t enable_bloom_memtable_miss_count_bit : 1; // 2 | ||
uint8_t enable_bloom_sst_hit_count_bit : 1; // 2 | ||
uint8_t enable_bloom_sst_miss_count_bit : 1; // 2 | ||
uint8_t enable_key_lock_wait_count_bit : 1; // 2 | ||
|
||
// represent original Level 3 | ||
uint8_t enable_measure_cpu_time_bit : 1; // 3 | ||
uint8_t enable_block_read_time_bit : 1; // 3 | ||
uint8_t enable_block_checksum_time_bit : 1; // 3 | ||
uint8_t enable_block_decompress_time_bit : 1; // 3 | ||
uint8_t enable_get_snapshot_time_bit : 1; // 3 | ||
uint8_t enable_get_from_memtable_time_bit : 1; // 3 | ||
uint8_t enable_get_post_process_time_bit : 1; // 3 | ||
uint8_t enable_get_from_output_files_time_bit : 1; // 3 | ||
uint8_t enable_seek_on_memtable_time_bit : 1; // 3 | ||
uint8_t enable_seek_child_seek_time_bit : 1; // 3 | ||
uint8_t enable_seek_min_heap_time_bit : 1; // 3 | ||
uint8_t enable_seek_max_heap_time_bit : 1; // 3 | ||
uint8_t enable_seek_internal_seek_time_bit : 1; // 3 | ||
uint8_t enable_find_next_user_entry_time_bit : 1; // 3 | ||
uint8_t enable_write_wal_time_bit : 1; // 3 | ||
uint8_t enable_write_memtable_time_bit : 1; // 3 | ||
uint8_t enable_write_delay_time_bit : 1; // 3 | ||
uint8_t enable_write_scheduling_flushes_compactions_time_bit : 1; // 3 | ||
uint8_t enable_write_pre_and_post_process_time_bit : 1; // 3 | ||
uint8_t enable_write_thread_wait_nanos_bit : 1; // 3 | ||
uint8_t enable_merge_operator_time_nanos_bit : 1; // 3 | ||
uint8_t enable_read_index_block_nanos_bit : 1; // 3 | ||
uint8_t enable_read_filter_block_nanos_bit : 1; // 3 | ||
uint8_t enable_new_table_block_iter_nanos_bit : 1; // 3 | ||
uint8_t enable_new_table_iterator_nanos_bit : 1; // 3 | ||
uint8_t enable_block_seek_nanos_bit : 1; // 3 | ||
uint8_t enable_find_table_nanos_bit : 1; // 3 | ||
uint8_t enable_key_lock_wait_time_bit : 1; // 3 | ||
uint8_t enable_env_new_sequential_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_new_random_access_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_new_writable_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_reuse_writable_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_new_random_rw_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_new_directory_nanos_bit : 1; // 3 | ||
uint8_t enable_env_file_exists_nanos_bit : 1; // 3 | ||
uint8_t enable_env_get_children_nanos_bit : 1; // 3 | ||
uint8_t enable_env_get_children_file_attributes_nanos_bit : 1; // 3 | ||
uint8_t enable_env_delete_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_create_dir_nanos_bit : 1; // 3 | ||
uint8_t enable_env_create_dir_if_missing_nanos_bit : 1; // 3 | ||
uint8_t enable_env_delete_dir_nanos_bit : 1; // 3 | ||
uint8_t enable_env_get_file_size_nanos_bit : 1; // 3 | ||
uint8_t enable_env_get_file_modification_time_nanos_bit : 1; // 3 | ||
uint8_t enable_env_rename_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_link_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_lock_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_unlock_file_nanos_bit : 1; // 3 | ||
uint8_t enable_env_new_logger_nanos_bit : 1; // 3 | ||
uint8_t enable_encrypt_data_nanos_bit : 1; // 3 | ||
uint8_t enable_decrypt_data_nanos_bit : 1; // 3 | ||
|
||
// represent original Level 4 | ||
// TODO: think a better design for iostats | ||
uint8_t enable_iostats_cpu_timer_bit : 1; // 4 | ||
uint8_t enable_get_cpu_nanos_bit : 1; // 4 | ||
uint8_t enable_iter_next_cpu_nanos_bit : 1; // 4 | ||
uint8_t enable_iter_prev_cpu_nanos_bit : 1; // 4 | ||
uint8_t enable_iter_seek_cpu_nanos_bit : 1; // 4 | ||
|
||
// represent original Level 5 | ||
uint8_t enable_db_mutex_lock_nanos_bit : 1; // 5 | ||
uint8_t enable_db_condition_wait_nanos_bit : 1; // 5 | ||
}; | ||
extern const PerfFlags PERF_LEVEL1; | ||
extern const PerfFlags PERF_LEVEL2; | ||
extern const PerfFlags PERF_LEVEL3; | ||
extern const PerfFlags PERF_LEVEL4; | ||
extern const PerfFlags PERF_LEVEL5; | ||
// set the perf flags for current thread | ||
void SetPerfFlags(PerfFlags pbf); | ||
|
||
// get current perf flags for current thread | ||
PerfFlags GetPerfFlags(); | ||
|
||
} // namespace rocksdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,14 @@ enum PerfLevel : unsigned char { | |
// time (neither wall time nor CPU time) for mutexes. | ||
kEnableTimeAndCPUTimeExceptForMutex = 4, | ||
kEnableTime = 5, // enable count and time stats | ||
kOutOfBounds = 6 // N.B. Must always be the last value! | ||
kCustomFlags = 6, // could not measured by level because is a custom bit flags configuration | ||
kOutOfBounds = 7, // N.B. Must always be the last value! | ||
}; | ||
|
||
// set the perf stats level for current thread | ||
void SetPerfLevel(PerfLevel level); | ||
|
||
// get current perf stats level for current thread | ||
// get current estimated perf stats level for current thread | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no longer estimated? |
||
PerfLevel GetPerfLevel(); | ||
|
||
} // namespace rocksdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect whether this will cause issues in some build platforms.