Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
pangea_detail::Resources Class Reference

Public Member Functions

 Resources (uint64_t reserve_mb, int cpu_percent, fs::path pause={}, bool desktop=false)
 Establish mapping limits for onboard or desktop execution.
bool desktop () const
 Check which execution policy was selected.
void tile_checkpoint ()
 Check whether tile processing may continue.
void parallel_tiles (size_t count, std::function< void(size_t)> task)
 Run a desktop batch under the coordinator's resource policy.
size_t photo_batch_capacity (uint64_t photo_budget_mib=128) const
 Estimate how many photos can be prepared in one desktop batch.
bool available ()
void checkpoint ()
Json report ()

Private Attributes

double last_cpu = seconds(CLOCK_PROCESS_CPUTIME_ID)
double last_wall = seconds(CLOCK_MONOTONIC)
const double started_cpu = last_cpu
const double started_wall = last_wall
uint64_t previous_total = 0
uint64_t previous_idle = 0
double idle_fraction = 0
double sampled_at = 0
uint64_t reserve
double duty
fs::path pause_file
bool desktop_mode = false
uint64_t address_limit = memory_limit
std::unique_ptr< DesktopPool > pool

Detailed Description

Apply idle-priority scheduling and cooperative memory/CPU/pause checks.

Definition at line 275 of file pangea.cpp.

Constructor & Destructor Documentation

◆ Resources()

pangea_detail::Resources::Resources ( uint64_t reserve_mb,
int cpu_percent,
fs::path pause = {},
bool desktop = false )
inline

Establish mapping limits for onboard or desktop execution.

Parameters
reserve_mbRequired available memory reserve in MiB.
cpu_percentOnboard CPU budget as a percentage of one core.
pauseOptional path whose existence pauses work.
desktopWhether to provision desktop workers.

Keep the onboard policy conservative; desktop concurrency is capped by both available memory and CPU affinity.

Definition at line 300 of file pangea.cpp.

Member Function Documentation

◆ available()

bool pangea_detail::Resources::available ( )
inline

Report whether system headroom currently meets the configured reserve and duty budget.

Definition at line 391 of file pangea.cpp.

◆ checkpoint()

void pangea_detail::Resources::checkpoint ( )
inline

Bound CPU duty by sleeping and stop work when memory, CPU or pause gates close.

Exceptions
std::runtime_erroron cancellation or unavailable required system telemetry. Sleep to enforce CPU duty and wait while system headroom or operator pause is closed.
std::runtime_erroron process cancellation or unavailable telemetry.

Definition at line 441 of file pangea.cpp.

◆ desktop()

bool pangea_detail::Resources::desktop ( ) const
inline

Check which execution policy was selected.

Returns
True for desktop execution.

Definition at line 357 of file pangea.cpp.

◆ parallel_tiles()

void pangea_detail::Resources::parallel_tiles ( size_t count,
std::function< void(size_t)> task )
inline

Run a desktop batch under the coordinator's resource policy.

Parameters
countNumber of indexed jobs.
taskThread-safe job callback.

Check headroom before dispatch and continue sampling while waiting.

Definition at line 369 of file pangea.cpp.

◆ photo_batch_capacity()

size_t pangea_detail::Resources::photo_batch_capacity ( uint64_t photo_budget_mib = 128) const
inline

Estimate how many photos can be prepared in one desktop batch.

Parameters
photo_budget_mibNonzero estimated peak memory per photo in MiB.
Returns
Batch size from one photo through the worker count.

Preserve reserve and worker overhead before dividing the remaining headroom. The minimum allows serial preparation, not a memory guarantee.

Precondition
Desktop worker pool is initialized.

Definition at line 380 of file pangea.cpp.

◆ report()

Json pangea_detail::Resources::report ( )
inline

Summarize active limits and measured process peak in the run report.

Definition at line 466 of file pangea.cpp.

◆ tile_checkpoint()

void pangea_detail::Resources::tile_checkpoint ( )
inline

Check whether tile processing may continue.

In desktop mode the coordinator samples resources; workers only observe batch cancellation. Serial execution runs the full checkpoint.

Definition at line 361 of file pangea.cpp.

Field Documentation

◆ address_limit

uint64_t pangea_detail::Resources::address_limit = memory_limit
private

Definition at line 290 of file pangea.cpp.

◆ desktop_mode

bool pangea_detail::Resources::desktop_mode = false
private

Definition at line 289 of file pangea.cpp.

◆ duty

double pangea_detail::Resources::duty
private

Maximum fraction of one CPU core used over each checkpoint interval.

Definition at line 285 of file pangea.cpp.

◆ idle_fraction

double pangea_detail::Resources::idle_fraction = 0
private

Definition at line 281 of file pangea.cpp.

◆ last_cpu

double pangea_detail::Resources::last_cpu = seconds(CLOCK_PROCESS_CPUTIME_ID)
private

Definition at line 276 of file pangea.cpp.

◆ last_wall

double pangea_detail::Resources::last_wall = seconds(CLOCK_MONOTONIC)
private

Definition at line 277 of file pangea.cpp.

◆ pause_file

fs::path pangea_detail::Resources::pause_file
private

Operator-controlled file whose existence suspends processing.

Definition at line 287 of file pangea.cpp.

◆ pool

std::unique_ptr<DesktopPool> pangea_detail::Resources::pool
private

Definition at line 291 of file pangea.cpp.

◆ previous_idle

uint64_t pangea_detail::Resources::previous_idle = 0
private

Definition at line 280 of file pangea.cpp.

◆ previous_total

uint64_t pangea_detail::Resources::previous_total = 0
private

Definition at line 280 of file pangea.cpp.

◆ reserve

uint64_t pangea_detail::Resources::reserve
private

RAM left for Linux, camera buffers and concurrent services.

Definition at line 283 of file pangea.cpp.

◆ sampled_at

double pangea_detail::Resources::sampled_at = 0
private

Definition at line 282 of file pangea.cpp.

◆ started_cpu

const double pangea_detail::Resources::started_cpu = last_cpu
private

Definition at line 278 of file pangea.cpp.

◆ started_wall

const double pangea_detail::Resources::started_wall = last_wall
private

Definition at line 279 of file pangea.cpp.


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