Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal flamegraphs #317

Merged
merged 12 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ js_files := $(wildcard $(reporters_path)/assets/*.js)
generated_js_files := \
$(reporters_path)/templates/assets/flamegraph_common.js \
$(reporters_path)/templates/assets/flamegraph.js \
$(reporters_path)/templates/assets/temporal_flamegraph.js \
$(reporters_path)/templates/assets/table.js
css_files := 'src/**/*.css'
markdown_files := $(shell find . -name \*.md -not -path '*/\.*' -not -path './src/vendor/*')
Expand Down
63 changes: 63 additions & 0 deletions src/memray/_memray.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class AllocationRecord:
@property
def tid(self) -> int: ...
@property
def native_stack_id(self) -> int: ...
@property
def native_segment_generation(self) -> int: ...
@property
def thread_name(self) -> str: ...
def hybrid_stack_trace(
self,
Expand All @@ -61,6 +65,47 @@ class AllocationRecord:
def __lt__(self, other: Any) -> Any: ...
def __ne__(self, other: Any) -> Any: ...

class Interval:
def __init__(
self,
allocated_before_snapshot: int,
deallocated_before_snapshot: int | None,
n_allocations: int,
n_bytes: int,
) -> None: ...
def __eq__(self, other: Any) -> Any: ...
allocated_before_snapshot: int
deallocated_before_snapshot: int | None
n_allocations: int
n_bytes: int

class TemporalAllocationRecord:
@property
def allocator(self) -> int: ...
@property
def stack_id(self) -> int: ...
@property
def tid(self) -> int: ...
@property
def native_stack_id(self) -> int: ...
@property
def native_segment_generation(self) -> int: ...
@property
def thread_name(self) -> str: ...
def hybrid_stack_trace(
self,
max_stacks: Optional[int] = None,
) -> List[Union[PythonStackElement, NativeStackElement]]: ...
def native_stack_trace(
self, max_stacks: Optional[int] = None
) -> List[NativeStackElement]: ...
def stack_trace(
self, max_stacks: Optional[int] = None
) -> List[PythonStackElement]: ...
def __eq__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ...
intervals: List[Interval]

class AllocatorType(enum.IntEnum):
MALLOC: int
FREE: int
Expand Down Expand Up @@ -91,6 +136,10 @@ class FileReader:
self, file_name: Union[str, Path], *, report_progress: bool = False
) -> None: ...
def get_allocation_records(self) -> Iterable[AllocationRecord]: ...
def get_temporal_allocation_records(
self,
merge_threads: bool,
) -> Iterable[TemporalAllocationRecord]: ...
def get_high_watermark_allocation_records(
self,
merge_threads: bool = ...,
Expand Down Expand Up @@ -207,3 +256,17 @@ class HighWaterMarkAggregatorTestHarness:
) -> None: ...
def get_current_heap_size(self) -> int: ...
def get_allocations(self) -> list[dict[str, int]]: ...

class AllocationLifetimeAggregatorTestHarness:
def add_allocation(
self,
tid: int,
address: int,
size: int,
allocator: int,
native_frame_id: int,
frame_index: int,
native_segment_generation: int,
) -> None: ...
def capture_snapshot(self) -> None: ...
def get_allocations(self) -> list[TemporalAllocationRecord]: ...
Loading