|
30 | 30 | # These are matched in-order.
|
31 | 31 | CATEGORIES: dict[str, list[str]] = {
|
32 | 32 | "interpreter": [
|
33 |
| - "_Py_GetBaseOpcode", |
34 | 33 | "_Py_call_instrumentation_line",
|
| 34 | + "_Py_GetBaseOpcode", |
35 | 35 | "_PyCode_.+",
|
36 | 36 | "_PyEval.+",
|
37 | 37 | "_PyFrame_ClearExceptCode",
|
38 | 38 | "_PyFrame_New_NoTrack",
|
39 | 39 | "_PyFrame_Traverse",
|
40 | 40 | "_PyPegen_.+",
|
41 |
| - "_PyThreadState_.+", |
| 41 | + "_PyStack_.+", |
| 42 | + "_PyVectorcall_.+", |
42 | 43 | "advance",
|
43 | 44 | "call_instrumentation_vector.*",
|
44 | 45 | "initialize_locals",
|
45 | 46 | "PyAST_.+",
|
46 | 47 | "PyEval_.+",
|
| 48 | + "PyInterpreterState.*", |
47 | 49 | ],
|
48 | 50 | "lookup": [
|
49 |
| - "_Py_dict_lookup", |
| 51 | + "_Py_dict_lookup.*", |
50 | 52 | "_Py_hashtable_.+",
|
51 | 53 | "_Py_type_getattro",
|
52 | 54 | "_PyType_Lookup",
|
53 |
| - "_PyType_LookupRef", |
| 55 | + "_PyType_LookupRef.*", |
54 | 56 | "builtin_getattr",
|
55 | 57 | "find_name_in_mro",
|
56 | 58 | "lookdict_split",
|
57 | 59 | "lookdict_unicode_nodummy",
|
58 | 60 | "lookdict_unicode",
|
| 61 | + "lookup_maybe_method", |
| 62 | + "member_get", |
59 | 63 | "PyMember_.*",
|
60 |
| - "unicodekeys_lookup_unicode", |
| 64 | + "unicodekeys_lookup_unicode.*", |
61 | 65 | "update_one_slot",
|
62 | 66 | ],
|
63 | 67 | "gc": [
|
|
68 | 72 | ".+_traverse",
|
69 | 73 | ".+MaybeUntrack",
|
70 | 74 | "deduce_unreachable",
|
71 |
| - "gc_collect_main", |
72 |
| - "gc_collect_region.*", |
| 75 | + "gc_collect.*", |
| 76 | + "mark_heap_visitor", |
73 | 77 | "PyObject_IS_GC",
|
| 78 | + "scan_heap.+", |
74 | 79 | "type_is_gc",
|
| 80 | + "update_refs.*", |
75 | 81 | "visit_.+",
|
76 | 82 | ],
|
77 | 83 | "memory": [
|
| 84 | + "_?mi_.+", |
78 | 85 | "_?PyMem_.+",
|
| 86 | + "_Py_DecRefShared", |
| 87 | + "_Py_MergeZeroLocalRefcount", |
79 | 88 | "_Py_NewReference",
|
| 89 | + "_py_qsbr_.+", |
| 90 | + "_Py_TryIncrefCompare", |
80 | 91 | "_PyObject_Free",
|
81 | 92 | "_PyObject_Malloc",
|
| 93 | + "_PyType_AllocNoTrack", |
82 | 94 | ".+_alloc",
|
83 | 95 | ".+[Nn]ew.*",
|
84 | 96 | ".+Alloc",
|
85 | 97 | ".+Calloc",
|
86 | 98 | ".+dealloc",
|
87 | 99 | ".+Dealloc",
|
| 100 | + ".+MiMalloc", |
88 | 101 | ".+Realloc",
|
89 |
| - "memset.+", |
90 | 102 | "memcpy.+",
|
| 103 | + "memset.+", |
| 104 | + "Py_DECREF", |
91 | 105 | ],
|
92 | 106 | "dynamic": [
|
93 | 107 | "_?PyMapping_.+",
|
|
124 | 138 | "tuple.+",
|
125 | 139 | ],
|
126 | 140 | "dict": [
|
127 |
| - "_?PyDict_.+", |
| 141 | + "_?PyDict.+", |
| 142 | + "acquire_key_value", |
128 | 143 | "build_indices_unicode",
|
129 | 144 | "clone_combined_dict_keys.+",
|
130 | 145 | "dict_.+",
|
131 | 146 | "dictiter_.+",
|
| 147 | + "dictkeys_.+", |
132 | 148 | "dictresize",
|
133 | 149 | "find_empty_slot",
|
134 | 150 | "free_keys_object",
|
| 151 | + "insert_combined_dict", |
135 | 152 | "insert_to_emptydict",
|
136 | 153 | "insertdict",
|
| 154 | + "new_dict", |
137 | 155 | "new_keys_object",
|
138 | 156 | "OrderedDict_.+",
|
139 | 157 | ],
|
|
148 | 166 | ],
|
149 | 167 | "str": [
|
150 | 168 | "_?PyUnicode.+",
|
151 |
| - "_copy_characters.+", |
| 169 | + "_copy_characters.*", |
152 | 170 | "ascii_decode",
|
153 | 171 | "bytes_.+",
|
154 |
| - "intern_common.+", |
| 172 | + "find_first_nonascii", |
| 173 | + "intern_common.*", |
155 | 174 | "intern_constants",
|
156 | 175 | "intern_string_constants",
|
157 | 176 | "PyBytes_.+",
|
|
163 | 182 | "unicode_.+",
|
164 | 183 | ],
|
165 | 184 | "miscobj": [
|
| 185 | + "_?PyGen_.+", |
| 186 | + "_?PySet_.+", |
166 | 187 | "_?PySlice_.+",
|
167 | 188 | "_PyBuildSlice_ConsumeRefs",
|
168 | 189 | "_PyEval_SliceIndex",
|
| 190 | + "_PyMake_Coro", |
169 | 191 | "bytearray_.+",
|
170 | 192 | "deque_.+",
|
171 | 193 | "dequeiter_.+",
|
172 | 194 | "enum_.+",
|
173 | 195 | "gen_iternext",
|
| 196 | + "get_or_create_weakref", |
174 | 197 | "make_gen",
|
175 | 198 | "PyBool_.+",
|
176 | 199 | "PyBuffer_.+",
|
177 |
| - "_?PyGen_.+", |
178 |
| - "_?PySet_.+", |
179 | 200 | "range_.+",
|
180 | 201 | "set_.+",
|
181 | 202 | "setiter_.+",
|
| 203 | + "weakref_.+", |
182 | 204 | ],
|
183 | 205 | "exceptions": [
|
184 | 206 | "_?PyErr_.*",
|
|
217 | 239 | "tok_.+",
|
218 | 240 | ],
|
219 | 241 | "async": ["async_.+"],
|
| 242 | + "threading": [ |
| 243 | + "_?PyThreadState_.+", |
| 244 | + "_PyCriticalSection.+", |
| 245 | + "_PySeqLock_.+", |
| 246 | + "disable_deferred_refcounting", |
| 247 | + "PyThread.*", |
| 248 | + ], |
220 | 249 | }
|
221 | 250 |
|
222 | 251 | COLOR_ORDER = ["jit", "kernel", "libc", "library"] + list(CATEGORIES.keys())
|
@@ -249,7 +278,7 @@ def category_for_obj_sym(obj: str, sym: str) -> str:
|
249 | 278 | if obj == "python":
|
250 | 279 | for category, patterns in CATEGORIES.items():
|
251 | 280 | for pattern in patterns:
|
252 |
| - if re.match(f"^{pattern}$", sym.split()[0]): |
| 281 | + if re.match(f"^{pattern}$", sym.split()[0].split(".")[0]): |
253 | 282 | return category
|
254 | 283 |
|
255 | 284 | return "unknown"
|
|
0 commit comments