Skip to content

Commit 60ec179

Browse files
Merge pull request #33 from aws/marieup-queue-synthetic-frame
Add synthetic frame for `queue.get(block=True)`
2 parents 4b23c0f + 24201af commit 60ec179

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codeguru_profiler_agent/sampling_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
TIME_SLEEP_FRAME = Frame(name="<Sleep>")
1313
LXML_SCHEMA_FRAME = Frame(name="lxml.etree:XMLSchema:__init__")
14+
QUEUE_BLOCKING_GET_FRAME = Frame(name="<queue.get>")
1415

1516

1617
def get_stacks(threads_to_sample, excluded_threads, max_depth):
@@ -78,6 +79,8 @@ def _maybe_append_synthetic_frame(result, frame, line_no):
7879
line = linecache.getline(frame.f_code.co_filename, line_no).strip()
7980
if "sleep(" in line:
8081
result.append(TIME_SLEEP_FRAME)
82+
elif ".get(block=True" in line:
83+
result.append(QUEUE_BLOCKING_GET_FRAME)
8184
elif "etree.XMLSchema(" in line:
8285
result.append(LXML_SCHEMA_FRAME)
8386

0 commit comments

Comments
 (0)