Parse benchmark names like: - BM_Fory_NumericStruct_Serialize - BM_Protobuf_Sample_Deserialize - BM_Msgpack_MediaContent_Deserialize Returns: (library, datatype, operation)
(name)
| 117 | |
| 118 | # === Parse benchmark name === |
| 119 | def parse_benchmark_name(name): |
| 120 | """ |
| 121 | Parse benchmark names like: |
| 122 | - BM_Fory_NumericStruct_Serialize |
| 123 | - BM_Protobuf_Sample_Deserialize |
| 124 | - BM_Msgpack_MediaContent_Deserialize |
| 125 | Returns: (library, datatype, operation) |
| 126 | """ |
| 127 | # Remove BM_ prefix |
| 128 | if name.startswith("BM_"): |
| 129 | name = name[3:] |
| 130 | |
| 131 | parts = name.split("_") |
| 132 | if len(parts) >= 3: |
| 133 | library = parts[0].lower() |
| 134 | datatype = parts[1].lower() |
| 135 | if datatype == "numericstruct": |
| 136 | datatype = "struct" |
| 137 | elif datatype == "numericstructlist": |
| 138 | datatype = "structlist" |
| 139 | operation = parts[2].lower() |
| 140 | return library, datatype, operation |
| 141 | return None, None, None |
| 142 | |
| 143 | |
| 144 | def format_datatype_label(datatype): |