k4bench.analysis.plots.phases¶
k4bench.analysis.plots.phases ¶
How long a k4run job's phases take, and which components their time goes
to: in one run (:func:plot_phase_component_pie, :func:plot_event_composition for the
event loop event by event) and across nightly tags (:func:plot_phase_history).
A history draws each nightly tag's latest run by default; given all_runs,
it draws every run, a tag re-run on later nights once per night it ran
(:func:history_rows).
top_components ¶
The top_n components of seconds that took longest, longest first:
the slices :func:plot_phase_component_pie names.
Source code in k4bench/analysis/plots/phases.py
plot_phase_component_pie ¶
plot_phase_component_pie(seconds: Series, *, top_n: int = 5, colors: Mapping[str, str] | None = None, title: str | None = None, duration: float | None = None, unit: str = 's') -> Figure
A donut of one phase's time by component: the :func:top_components
and the rest as one "Other (k)" slice, the total in the middle.
seconds is component → self seconds in the phase
(:meth:~k4bench.analysis.components.ComponentTiming.phase_component_seconds).
duration is the phase's elapsed seconds
(:meth:~k4bench.analysis.components.ComponentTiming.phase_seconds):
the part of it no component was charged for is one more slice,
:data:UNATTRIBUTED, and the middle is the phase's duration. Without
it, the middle is the components' summed time; when that exceeds
duration (components run in parallel), too, marked as component time.
colors maps a component to its colour, so a component that several
donuts show keeps one; the others take the palette in order. Parts of
another quantity than time give its unit.
Source code in k4bench/analysis/plots/phases.py
plot_event_composition ¶
plot_event_composition(times: DataFrame, components: list[str], *, colors: Mapping[str, str] | None = None, sort: bool = False, warm_up: int | None = 0) -> Figure
The event loop event by event: a column per event stacking each of components' self time in it, the rest as "Other".
times is the job's execute["wall_s"] (events × components, NaN
where a component did not run). colors maps a component to its colour,
as :func:plot_phase_component_pie takes it. sort orders the events by
their time, longest first, instead of by event number. The warm_up
event is drawn paler. A component's bars carry its name as their
customdata; "Other"'s carry none.
Source code in k4bench/analysis/plots/phases.py
latest_run_per_tag ¶
The rows of each nightly tag's (x_date's) latest run: a tag is
re-run nightly until the next one, and a column mixing its runs would
show none of them.
Source code in k4bench/analysis/plots/phases.py
history_rows ¶
The rows a history draws: each nightly tag's latest run's
(:func:latest_run_per_tag), or, all_runs, every run's, a tag's
repeats each on its own.
Source code in k4bench/analysis/plots/phases.py
run_label ¶
One run as an all-runs history names it: the night it was measured and the release it measured, which together tell any two of a series apart.
Source code in k4bench/analysis/plots/phases.py
phase_component_series ¶
phase_component_series(rows: DataFrame, top_n: int, durations: DataFrame | None = None, *, value: str = 'seconds', always: Sequence[str] = (), apart: Mapping[str, str] | None = None, all_runs: bool = False) -> DataFrame
One phase's time per nightly tag as series to draw: the top_n
components that took longest over the window (ranked by their median),
the rest summed as "Other (k)", and, given the phase's durations, the
part of it no component was charged for as :data:UNATTRIBUTED, in
that order.
rows are one config's and one phase's
:func:~k4bench.analysis.trend.build_phase_trend rows: its components,
or, for a phase timed only as a whole, its total with component set
to the phase's name. durations are its rows of the phase's total
(component NaN). Each tag's latest run only
(:func:latest_run_per_tag), of rows' and durations' runs: a run
no component was charged in is all :data:UNATTRIBUTED. One row per
run and series, the series
named in label, with its seconds and its share_pct of the
run's series together (the phase's duration when durations are given
and the components ran one at a time), the run's run_id,
run_date, x_date and k4h_release kept.
value is the column of rows the series sum, seconds by default,
and is the series' column of it; a series none of whose components has
one in a run is NaN there. The components of always each have a
series whatever their rank, ahead of the top_n, in their order. Those
of apart are not ranked: each is a series of its own after "Other",
under the name it maps to. all_runs keeps every run of rows and
durations, not each tag's latest only (:func:history_rows).
Source code in k4bench/analysis/plots/phases.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
plot_phase_history ¶
plot_phase_history(series: DataFrame, *, palette: list[str] = _PALETTE, relative: bool = False, value: str = 'seconds', unit: str = 's', y_title: str = 'Time (s)', whole: str = 'phase', all_runs: bool = False) -> Figure | None
One phase's time per nightly tag, a column per tag stacking
:func:phase_component_series' series in their order, "Other" grey and
:data:UNATTRIBUTED paler: a column's height is the series' total,
written above it, the phase's duration when the series carry its
unattributed part. relative draws each series as its share of the
column. A tag run more than once shows its latest run
(:func:latest_run_per_tag). None when there is nothing to draw.
Series of another quantity than time (their :func:phase_component_series
value) give its column as value, its unit, the y_title of the
axis and what a column is the whole of.
all_runs draws a column per run instead, every run of a tag, in the
order they were measured: each named by the night it ran, the hover
adding its release (:func:run_label). Two runs are never one column,
whatever night or tag they share.
Source code in k4bench/analysis/plots/phases.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |