Last active
November 23, 2020 07:19
-
-
Save shubhamkumar13/9da6a9307de3c771f1a48cfe5e84a4ad to your computer and use it in GitHub Desktop.
snippet describing a way to get numbers for loop iterations for cached vs uncached
This file contains hidden or 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
def get_diff(loop_list): | |
return [[(loop_list[i][0] - loop_list[i - 1][0]),(loop_list[i][1] - loop_list[i - 1][1])] for i in range(1, len(loop_list) - 1)] |
This file contains hidden or 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
sub_str1 = 'did minor gc' | |
sub_str2 = 'requested minor gc' | |
file1_filtered_lines = [line for line in file1_lines if line.find(sub_str1) == True or line.find(sub_str2) == True] |
This file contains hidden or 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
def get_numbers(string): | |
value = re.search('[0-9]+\.[0-9]+', string) | |
value_str = str(value.group(0)) | |
value_lst = value_str.split('.') | |
return [int(value_lst[0]), int(value_lst[1])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment