k4bench.analysis.plots.event¶
k4bench.analysis.plots.event ¶
Per-event timing and memory plots.
Both public functions delegate to the shared _plot_event_metric implementation,
which differs only in which DataFrame column and axis labels are used.
BinCountOptions ¶
Bases: NamedTuple
Automatic and allowed dashboard bin counts for one data selection.
event_bin_options ¶
event_bin_options(source: dict[str, DataFrame] | str | Path | list[str | Path], *, column: str, labels: list[str] | None = None, exclude_events: list[int] | None = None, outlier_threshold: float = 3.5) -> BinCountOptions
Return automatic and sensible editable bin counts for an event metric.
The maximum is derived from the current pooled in-range sample: more bins than observations normally add no statistical resolution. If NumPy's automatic rule itself chooses more, that exact automatic count remains selectable. The renderer ceiling remains the absolute upper bound.
Source code in k4bench/analysis/plots/event.py
auto_bin_count ¶
auto_bin_count(source: dict[str, DataFrame] | str | Path | list[str | Path], *, column: str, labels: list[str] | None = None, exclude_events: list[int] | None = None, outlier_threshold: float = 3.5) -> int
Return the bin count plot_event_* would choose with bins="auto".
Runs the same preparation the plotting functions do — the same event exclusions, the same outlier clipping, the same pooled range — so callers that want to offer an editable bin count can seed it with the number the figure would otherwise have used, instead of an arbitrary default that would silently rebin the plot on first render.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
dict[str, pd.DataFrame], str/Path, or list of str/Path
|
As for :func: |
required |
column
|
str
|
The value column to bin, e.g. |
required |
labels
|
list[str] or None
|
Restrict to these run labels. |
None
|
exclude_events
|
list[int] or None
|
Event numbers to exclude. Defaults to |
None
|
outlier_threshold
|
float
|
MAD-based modified Z-score threshold for range clipping. |
3.5
|
Source code in k4bench/analysis/plots/event.py
plot_event_timing ¶
plot_event_timing(source: dict[str, DataFrame] | str | Path | list[str | Path], *, labels: list[str] | None = None, baseline_label: str | None = None, show: str = 'both', bins: BinSpec = 'auto', bin_width: float | None = None, bin_origin: float | None = None, show_errors: bool = False, show_mean_lines: bool = True, alpha: float = 0.7, figsize: tuple[float, float] | None = None, outlier_threshold: float = 3.5, exclude_events: list[int] | None = None, palette: list[str] | None = None) -> Figure
Plot per-event timing distributions for one or more runs.
Single run: histogram with μ ± SEM and σ ± SE(σ) shown as an annotation.
Multiple runs: overlaid histograms and, with show="both", bin-by-bin
and per-event ratio panels for every non-baseline run against the reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
dict[str, pd.DataFrame], str/Path, or list of str/Path
|
Pre-loaded dict from :func: |
required |
labels
|
list[str] or None
|
Restrict to these run labels. |
None
|
baseline_label
|
str or None
|
Reference run for the ratio panel (multi-run only). |
None
|
show
|
('both', 'distribution', 'sequence')
|
Which panels to display. |
"both"
|
bins
|
int, str, or sequence of float
|
Bin count, a :func: |
'auto'
|
bin_width
|
float or None
|
Fixed bin width in data units. Mutually exclusive with |
None
|
bin_origin
|
float or None
|
Origin of the fixed-width grid. Used only with |
None
|
show_errors
|
bool
|
Draw Poisson |
False
|
show_mean_lines
|
bool
|
Draw the dashed per-run mean line on the distribution panel. |
True
|
alpha
|
float
|
Opacity of the filled bars (default: 0.7). The step outline drawn over
each histogram stays fully opaque, so lowering this fades overlapping
fills without losing any distribution; |
0.7
|
figsize
|
(width, height) or None
|
Figure size in inches (converted to pixels at 96 dpi). |
None
|
outlier_threshold
|
float
|
MAD-based modified Z-score threshold for x-range clipping. |
3.5
|
exclude_events
|
list[int] or None
|
Event numbers to exclude. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in k4bench/analysis/plots/event.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
plot_event_memory ¶
plot_event_memory(source: dict[str, DataFrame] | str | Path | list[str | Path], *, labels: list[str] | None = None, baseline_label: str | None = None, show: str = 'both', bins: BinSpec = 'auto', bin_width: float | None = None, bin_origin: float | None = None, show_errors: bool = False, show_mean_lines: bool = True, alpha: float = 0.7, figsize: tuple[float, float] | None = None, outlier_threshold: float = 3.5, exclude_events: list[int] | None = None, palette: list[str] | None = None) -> Figure
Plot per-event memory (RSS) distributions for one or more runs.
Distribution panel shows a histogram of peak RSS per event. Sequence panel shows peak RSS vs event number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
dict[str, pd.DataFrame], str/Path, or list of str/Path
|
Pre-loaded dict from :func: |
required |
labels
|
list[str] or None
|
Restrict to these run labels. |
None
|
baseline_label
|
str or None
|
Reference run for the ratio panel (multi-run only). |
None
|
show
|
('both', 'distribution', 'sequence')
|
Which panels to display. |
"both"
|
bins
|
int, str, or sequence of float
|
Bin count, a :func: |
'auto'
|
bin_width
|
float or None
|
Fixed bin width in data units. Mutually exclusive with |
None
|
bin_origin
|
float or None
|
Origin of the fixed-width grid. Used only with |
None
|
show_errors
|
bool
|
Draw Poisson |
False
|
show_mean_lines
|
bool
|
Draw the dashed per-run mean line on the distribution panel. |
True
|
alpha
|
float
|
Opacity of the filled bars (default: 0.7). The step outline drawn over
each histogram stays fully opaque, so lowering this fades overlapping
fills without losing any distribution; |
0.7
|
figsize
|
(width, height) or None
|
Figure size in inches (converted to pixels at 96 dpi). |
None
|
outlier_threshold
|
float
|
MAD-based modified Z-score threshold for x-range clipping. |
3.5
|
exclude_events
|
list[int] or None
|
Event numbers to exclude. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Source code in k4bench/analysis/plots/event.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |