Skip to main content

Run Class

Live pipeline handle: push inputs in, pull outputs out. More...

Declaration

class simaai::neat::Run { ... }

Included Headers

#include <Run.h>

Friends Index

classMeasureScope
classSession

Public Constructors Index

Run ()=default

Construct an empty Run; assign from Session::build() before use. More...

Run (const Run &)=delete

Non-copyable. More...

Run (Run &&) noexcept

Move-constructible. More...

Private Constructors Index

Run (std::shared_ptr< State > state)

Public Destructor Index

~Run ()

Cleanly tears down the pipeline. More...

Public Operators Index

Run &operator= (const Run &)=delete

Non-copyable. More...

Run &operator= (Run &&) noexcept

Move-assignable. More...

operator bool () const noexcept

Returns true if the Run is alive (constructed by Session::build, not yet stopped). More...

Public Member Functions Index

boolcan_push () const

Returns true if the input side accepts pushes (not closed). More...

boolcan_pull () const

Returns true if the output side may produce more samples (pipeline not at EOS). More...

boolrunning () const

Returns true if the pipeline is in PLAYING state. More...

boolpush (const std::vector< cv::Mat > &inputs)

Push cv::Mat inputs into the pipeline. More...

booltry_push (const std::vector< cv::Mat > &inputs)

Non-blocking variant of push; returns false immediately if the queue is full. More...

boolpush (const TensorList &inputs)

Push Tensor inputs (one per ingress port). More...

booltry_push (const TensorList &inputs)

Non-blocking variant. More...

boolpush (const SampleList &msgs)

Push full Sample inputs (carrying per-buffer metadata). More...

booltry_push (const SampleList &msgs)

Non-blocking variant. More...

boolpush_holder (const std::shared_ptr< void > &holder)

Internal: pushes a GstBuffer held by a tensor ref to preserve plugin metadata. More...

booltry_push_holder (const std::shared_ptr< void > &holder)

Non-blocking variant of push_holder. More...

voidclose_input ()

Send EOS into the pipeline. More...

PullStatuspull (int timeout_ms, Sample &out, PullError *err=nullptr)

Pull the next output sample with a structured status return. More...

std::optional< Sample >pull (int timeout_ms=-1)

Convenience pull returning an optional Sample (empty on timeout/closed/error). More...

TensorListpull_tensors (int timeout_ms=-1)

Pull and unpack the next sample as a TensorList. More...

SampleListpull_samples (int timeout_ms=-1)

Pull the next sample as a SampleList (preserves per-sample metadata). More...

TensorListrun (const std::vector< cv::Mat > &inputs, int timeout_ms=-1)

One-shot synchronous push+pull from cv::Mat inputs. More...

TensorListrun (const TensorList &inputs, int timeout_ms=-1)

One-shot synchronous push+pull from Tensor inputs. More...

SampleListrun (const SampleList &inputs, int timeout_ms=-1)

One-shot synchronous push+pull from Sample inputs. More...

MeasureScopestart_measurement (const MeasureOptions &opt={})

Start observing a caller-owned push/pull interval without consuming outputs. More...

intwarmup (const std::vector< cv::Mat > &inputs, int warm=-1, int timeout_ms=-1)

Run warm warm-up inferences before measurement begins. More...

RunStatsstats () const

Returns end-to-end push/pull/latency stats. More...

InputStreamStatsinput_stats () const

Returns input-side telemetry (push counts, drops, timing). More...

RunDiagSnapshotdiag_snapshot () const

Returns the full diagnostic snapshot (per-stage, per-element, per-pad). More...

PowerSummarypower_summary () const

Returns the optional SOM power telemetry summary for this Run. More...

RunMeasurementSummarymeasurement_summary () const

Returns latency, throughput, input stats, and optional power telemetry in one call. More...

RuntimeMetricsmetrics (const RuntimeMetricsOptions &opt={}) const

Returns the preferred unified runtime metrics surface. More...

std::stringmetrics_report (const RuntimeMetricsOptions &opt={}, RuntimeMetricsFormat format=RuntimeMetricsFormat::Text) const

Render unified runtime metrics in the requested format. More...

std::stringmetrics_report (RuntimeMetricsFormat format) const

Convenience overload for selecting the output format with default options. More...

std::stringreport (const RunReportOptions &opt={}) const

Returns a human-readable formatted report combining stats and diagnostics. More...

std::stringlast_error () const

Returns the most recent runtime error string (empty if no error occurred). More...

std::stringdiagnostics_summary () const

Returns a short diagnostics summary suitable for logging or error reports. More...

voidstop ()

Stop the pipeline immediately (transitions to NULL). After stop, the Run is no longer running. More...

voidclose ()

Alias for stop(). Releases resources. More...

Private Member Functions Index

voidrequire_async_mode (const char *where) const
voidrequire_async_pull_mode (const char *where) const
voidenqueue_run_images (const std::vector< cv::Mat > &inputs)
voidenqueue_run_tensors (const TensorList &inputs)
voidenqueue_run_samples (const SampleList &inputs)
TensorListpull_tensors_strict (int timeout_ms)
SampleListpull_samples_strict (int timeout_ms)
boolpush_impl (const cv::Mat &input, bool block)
boolpush_impl (const simaai::neat::Tensor &input, bool block)
boolpush_holder_impl (const std::shared_ptr< void > &holder, bool block)
boolpush_message_impl (const Sample &msg, bool block)
boolpush_sample_impl (const Sample &msg, bool block)

Private Member Attributes Index

std::shared_ptr< State >state_
boolowns_ref_ = false

Private Static Functions Index

static Runcreate (InputStream stream, const RunOptions &opt, const struct InputStreamOptions &stream_opt, RunMode mode=RunMode::Async, const std::optional< InputOptions > &tensor_input_opt_for_cv=std::nullopt, pipeline_internal::InputRouteProcessorPtr input_route_processor=nullptr)

Description

Live pipeline handle: push inputs in, pull outputs out.

A Run is what Session::build() returns. It owns the live GStreamer pipeline plus its internal worker threads (typically 5–15 per Run, including streaming threads, dispatcher pool threads, and a bus watcher). Application code drives the Run by push()-ing inputs and pull()-ing outputs (or run() for one-shot synchronous use).

 auto run = sess.build(input);
 run.push(another_input);
 auto sample = run.pull(/ * timeout_ms = * / 100);

Thread safety: push() from one thread and pull() from another is safe. Multiple threads push-ing the same Run concurrently is NOT safe — serialize push from one thread or use external synchronization.

Runs are non-copyable but movable. Destroying a Run shuts down its pipeline cleanly (sends EOS, drains, transitions to NULL).

See Also

Session::build for how a Run is constructed

See Also

RunOptions for runtime configuration

See Also

"Runs and the parallelism story" (§0.13 of the design deep dive)

Definition at line 512 of file Run.h.

Friends

MeasureScope

friend class MeasureScope

Definition at line 615 of file Run.h.

615 friend class MeasureScope;

Session

friend class Session

Definition at line 637 of file Run.h.

637 friend class Session;

Public Constructors

Run()

simaai::neat::Run::Run ()
default

Construct an empty Run; assign from Session::build() before use.

Definition at line 515 of file Run.h.

Run()

simaai::neat::Run::Run (const Run &)
delete

Non-copyable.

Definition at line 516 of file Run.h.

Run()

simaai::neat::Run::Run (Run &&)
noexcept

Move-constructible.

Definition at line 519 of file Run.h.

Private Constructors

Run()

simaai::neat::Run::Run (std::shared_ptr< State > state)
explicit

Definition at line 620 of file Run.h.

Public Destructor

~Run()

simaai::neat::Run::~Run ()

Cleanly tears down the pipeline.

Definition at line 521 of file Run.h.

Public Operators

operator bool()

simaai::neat::Run::operator bool ()
explicit noexcept

Returns true if the Run is alive (constructed by Session::build, not yet stopped).

Definition at line 524 of file Run.h.

operator=()

Run & simaai::neat::Run::operator= (const Run &)
delete

Non-copyable.

Definition at line 517 of file Run.h.

operator=()

Run & simaai::neat::Run::operator= (Run &&)
noexcept

Move-assignable.

Definition at line 520 of file Run.h.

Public Member Functions

can_pull()

bool simaai::neat::Run::can_pull ()

Returns true if the output side may produce more samples (pipeline not at EOS).

Definition at line 528 of file Run.h.

can_push()

bool simaai::neat::Run::can_push ()

Returns true if the input side accepts pushes (not closed).

Definition at line 526 of file Run.h.

close()

void simaai::neat::Run::close ()

Alias for stop(). Releases resources.

Definition at line 612 of file Run.h.

close_input()

void simaai::neat::Run::close_input ()

Send EOS into the pipeline.

Drain remaining outputs by continuing to pull until PullStatus::Closed.

Definition at line 553 of file Run.h.

diag_snapshot()

RunDiagSnapshot simaai::neat::Run::diag_snapshot ()

Returns the full diagnostic snapshot (per-stage, per-element, per-pad).

Definition at line 590 of file Run.h.

diagnostics_summary()

std::string simaai::neat::Run::diagnostics_summary ()

Returns a short diagnostics summary suitable for logging or error reports.

Definition at line 607 of file Run.h.

input_stats()

InputStreamStats simaai::neat::Run::input_stats ()

Returns input-side telemetry (push counts, drops, timing).

Definition at line 588 of file Run.h.

last_error()

std::string simaai::neat::Run::last_error ()

Returns the most recent runtime error string (empty if no error occurred).

Definition at line 605 of file Run.h.

measurement_summary()

RunMeasurementSummary simaai::neat::Run::measurement_summary ()

Returns latency, throughput, input stats, and optional power telemetry in one call.

Definition at line 594 of file Run.h.

metrics()

RuntimeMetrics simaai::neat::Run::metrics (const RuntimeMetricsOptions & opt={})

Returns the preferred unified runtime metrics surface.

Definition at line 596 of file Run.h.

metrics_report()

std::string simaai::neat::Run::metrics_report (const RuntimeMetricsOptions & opt={}, RuntimeMetricsFormat format=RuntimeMetricsFormat::Text)

Render unified runtime metrics in the requested format.

Definition at line 598 of file Run.h.

metrics_report()

std::string simaai::neat::Run::metrics_report (RuntimeMetricsFormat format)

Convenience overload for selecting the output format with default options.

Definition at line 601 of file Run.h.

power_summary()

PowerSummary simaai::neat::Run::power_summary ()

Returns the optional SOM power telemetry summary for this Run.

Definition at line 592 of file Run.h.

pull()

PullStatus simaai::neat::Run::pull (int timeout_ms, Sample & out, PullError * err=nullptr)

Pull the next output sample with a structured status return.

Parameters
timeout_ms

Wait up to this many ms; -1 waits forever; 0 is non-blocking.

out

Filled with the next sample on Ok.

err

Optional out-parameter populated on Error with a structured PullError.

Returns

Ok, Timeout, Closed, or Error.

Definition at line 561 of file Run.h.

pull()

std::optional< Sample > simaai::neat::Run::pull (int timeout_ms=-1)

Convenience pull returning an optional Sample (empty on timeout/closed/error).

Definition at line 563 of file Run.h.

pull_samples()

SampleList simaai::neat::Run::pull_samples (int timeout_ms=-1)

Pull the next sample as a SampleList (preserves per-sample metadata).

Definition at line 567 of file Run.h.

pull_tensors()

TensorList simaai::neat::Run::pull_tensors (int timeout_ms=-1)

Pull and unpack the next sample as a TensorList.

Definition at line 565 of file Run.h.

push()

bool simaai::neat::Run::push (const std::vector< cv::Mat > & inputs)

Push cv::Mat inputs into the pipeline.

Multi-input models accept one Mat per ingress.

Returns

true on success; behavior on full queue is governed by RunOptions::overflow_policy.

Definition at line 536 of file Run.h.

push()

bool simaai::neat::Run::push (const TensorList & inputs)

Push Tensor inputs (one per ingress port).

Definition at line 540 of file Run.h.

push()

bool simaai::neat::Run::push (const SampleList & msgs)

Push full Sample inputs (carrying per-buffer metadata).

Definition at line 544 of file Run.h.

push_holder()

bool simaai::neat::Run::push_holder (const std::shared_ptr< void > & holder)

Internal: pushes a GstBuffer held by a tensor ref to preserve plugin metadata.

Definition at line 548 of file Run.h.

report()

std::string simaai::neat::Run::report (const RunReportOptions & opt={})

Returns a human-readable formatted report combining stats and diagnostics.

Definition at line 603 of file Run.h.

run()

TensorList simaai::neat::Run::run (const std::vector< cv::Mat > & inputs, int timeout_ms=-1)

One-shot synchronous push+pull from cv::Mat inputs.

Definition at line 569 of file Run.h.

run()

TensorList simaai::neat::Run::run (const TensorList & inputs, int timeout_ms=-1)

One-shot synchronous push+pull from Tensor inputs.

Definition at line 571 of file Run.h.

run()

SampleList simaai::neat::Run::run (const SampleList & inputs, int timeout_ms=-1)

One-shot synchronous push+pull from Sample inputs.

Definition at line 573 of file Run.h.

running()

bool simaai::neat::Run::running ()

Returns true if the pipeline is in PLAYING state.

Definition at line 530 of file Run.h.

start_measurement()

MeasureScope simaai::neat::Run::start_measurement (const MeasureOptions & opt={})

Start observing a caller-owned push/pull interval without consuming outputs.

Definition at line 576 of file Run.h.

stats()

RunStats simaai::neat::Run::stats ()

Returns end-to-end push/pull/latency stats.

Definition at line 586 of file Run.h.

stop()

void simaai::neat::Run::stop ()

Stop the pipeline immediately (transitions to NULL). After stop, the Run is no longer running.

Definition at line 610 of file Run.h.

try_push()

bool simaai::neat::Run::try_push (const std::vector< cv::Mat > & inputs)

Non-blocking variant of push; returns false immediately if the queue is full.

Definition at line 538 of file Run.h.

try_push()

bool simaai::neat::Run::try_push (const TensorList & inputs)

Non-blocking variant.

Definition at line 542 of file Run.h.

try_push()

bool simaai::neat::Run::try_push (const SampleList & msgs)

Non-blocking variant.

Definition at line 546 of file Run.h.

try_push_holder()

bool simaai::neat::Run::try_push_holder (const std::shared_ptr< void > & holder)

Non-blocking variant of push_holder.

Definition at line 550 of file Run.h.

warmup()

int simaai::neat::Run::warmup (const std::vector< cv::Mat > & inputs, int warm=-1, int timeout_ms=-1)

Run warm warm-up inferences before measurement begins.

Useful for stable performance numbers — first inferences pay one-time setup costs (kernel load, JIT, cache fill). Pass warm = -1 for a sensible default.

Definition at line 583 of file Run.h.

Private Member Functions

enqueue_run_images()

void simaai::neat::Run::enqueue_run_images (const std::vector< cv::Mat > & inputs)

Definition at line 623 of file Run.h.

enqueue_run_samples()

void simaai::neat::Run::enqueue_run_samples (const SampleList & inputs)

Definition at line 625 of file Run.h.

enqueue_run_tensors()

void simaai::neat::Run::enqueue_run_tensors (const TensorList & inputs)

Definition at line 624 of file Run.h.

pull_samples_strict()

SampleList simaai::neat::Run::pull_samples_strict (int timeout_ms)

Definition at line 627 of file Run.h.

pull_tensors_strict()

TensorList simaai::neat::Run::pull_tensors_strict (int timeout_ms)

Definition at line 626 of file Run.h.

push_holder_impl()

bool simaai::neat::Run::push_holder_impl (const std::shared_ptr< void > & holder, bool block)

Definition at line 630 of file Run.h.

push_impl()

bool simaai::neat::Run::push_impl (const cv::Mat & input, bool block)

Definition at line 628 of file Run.h.

push_impl()

bool simaai::neat::Run::push_impl (const simaai::neat::Tensor & input, bool block)

Definition at line 629 of file Run.h.

push_message_impl()

bool simaai::neat::Run::push_message_impl (const Sample & msg, bool block)

Definition at line 631 of file Run.h.

push_sample_impl()

bool simaai::neat::Run::push_sample_impl (const Sample & msg, bool block)

Definition at line 632 of file Run.h.

require_async_mode()

void simaai::neat::Run::require_async_mode (const char * where)

Definition at line 621 of file Run.h.

require_async_pull_mode()

void simaai::neat::Run::require_async_pull_mode (const char * where)

Definition at line 622 of file Run.h.

Private Member Attributes

owns_ref_

bool simaai::neat::Run::owns_ref_ = false

Definition at line 618 of file Run.h.

618 bool owns_ref_ = false;

state_

std::shared_ptr<State> simaai::neat::Run::state_

Definition at line 617 of file Run.h.

617 std::shared_ptr<State> state_;

Private Static Functions

create()

Run simaai::neat::Run::create (InputStream stream, const RunOptions & opt, const struct InputStreamOptions & stream_opt, RunMode mode=RunMode::Async, const std::optional< InputOptions > & tensor_input_opt_for_cv=std::nullopt, pipeline_internal::InputRouteProcessorPtr input_route_processor=nullptr)
static

Definition at line 633 of file Run.h.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.