|
23 | 23 | logs_file = open(logs_path, "r") |
24 | 24 | logs_lines = logs_file.readlines() |
25 | 25 | for line in logs_lines: |
26 | | - pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)" |
27 | | - result = re.findall(pattern, line) |
28 | | - if len(result): |
29 | | - task_name = result[0][1] |
30 | | - perf_type = result[0][2] |
| 26 | + # Handle both old format: tasks/task_type/task_name:perf_type:time |
| 27 | + # and new format: namespace_task_type_enabled:perf_type:time |
| 28 | + old_pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)" |
| 29 | + new_pattern = ( |
| 30 | + r"(\w+_test_task_(threads|processes))_(\w+)_enabled:(\w*):(-*\d*\.\d*)" |
| 31 | + ) |
| 32 | + |
| 33 | + old_result = re.findall(old_pattern, line) |
| 34 | + new_result = re.findall(new_pattern, line) |
| 35 | + |
| 36 | + if len(old_result): |
| 37 | + task_name = old_result[0][1] |
| 38 | + perf_type = old_result[0][2] |
31 | 39 | set_of_task_name.append(task_name) |
32 | 40 | result_tables[perf_type][task_name] = {} |
33 | 41 |
|
34 | 42 | for ttype in list_of_type_of_tasks: |
35 | 43 | result_tables[perf_type][task_name][ttype] = -1.0 |
| 44 | + elif len(new_result): |
| 45 | + # Extract task name from namespace (e.g., "example_threads" from "nesterov_a_test_task_threads") |
| 46 | + full_task_name = new_result[0][0] |
| 47 | + task_category = new_result[0][1] # "threads" or "processes" |
| 48 | + task_name = f"example_{task_category}" |
| 49 | + perf_type = new_result[0][3] |
| 50 | + |
| 51 | + if task_name not in set_of_task_name: |
| 52 | + set_of_task_name.append(task_name) |
| 53 | + |
| 54 | + if perf_type not in result_tables: |
| 55 | + result_tables[perf_type] = {} |
| 56 | + if task_name not in result_tables[perf_type]: |
| 57 | + result_tables[perf_type][task_name] = {} |
| 58 | + for ttype in list_of_type_of_tasks: |
| 59 | + result_tables[perf_type][task_name][ttype] = -1.0 |
36 | 60 |
|
37 | 61 | for line in logs_lines: |
38 | | - pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)" |
39 | | - result = re.findall(pattern, line) |
40 | | - if len(result): |
41 | | - task_type = result[0][0] |
42 | | - task_name = result[0][1] |
43 | | - perf_type = result[0][2] |
44 | | - perf_time = float(result[0][3]) |
| 62 | + # Handle both old format: tasks/task_type/task_name:perf_type:time |
| 63 | + # and new format: namespace_task_type_enabled:perf_type:time |
| 64 | + old_pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)" |
| 65 | + new_pattern = ( |
| 66 | + r"(\w+_test_task_(threads|processes))_(\w+)_enabled:(\w*):(-*\d*\.\d*)" |
| 67 | + ) |
| 68 | + |
| 69 | + old_result = re.findall(old_pattern, line) |
| 70 | + new_result = re.findall(new_pattern, line) |
| 71 | + |
| 72 | + if len(old_result): |
| 73 | + task_type = old_result[0][0] |
| 74 | + task_name = old_result[0][1] |
| 75 | + perf_type = old_result[0][2] |
| 76 | + perf_time = float(old_result[0][3]) |
45 | 77 | if perf_time < 0.1: |
46 | 78 | msg = f"Performance time = {perf_time} < 0.1 second : for {task_type} - {task_name} - {perf_type} \n" |
47 | 79 | raise Exception(msg) |
48 | 80 | result_tables[perf_type][task_name][task_type] = perf_time |
| 81 | + elif len(new_result): |
| 82 | + # Extract task details from namespace format |
| 83 | + full_task_name = new_result[0][0] |
| 84 | + task_category = new_result[0][1] # "threads" or "processes" |
| 85 | + task_type = new_result[0][2] # "all", "omp", "seq", etc. |
| 86 | + perf_type = new_result[0][3] |
| 87 | + perf_time = float(new_result[0][4]) |
| 88 | + task_name = f"example_{task_category}" |
| 89 | + |
| 90 | + if perf_time < 0.1: |
| 91 | + msg = f"Performance time = {perf_time} < 0.1 second : for {task_type} - {task_name} - {perf_type} \n" |
| 92 | + raise Exception(msg) |
| 93 | + |
| 94 | + if task_name in result_tables[perf_type]: |
| 95 | + result_tables[perf_type][task_name][task_type] = perf_time |
49 | 96 |
|
50 | 97 |
|
51 | 98 | for table_name in result_tables: |
|
0 commit comments