joule-profiler-core 1.0.1

Core library for joule-profiler, handling orchestration and energy measurements
Documentation
use crate::source::MetricSourceError;
use crate::source::types::SourceEvent;
use thiserror::Error;
use tokio::{sync::mpsc::error::SendError, task::JoinError};

/// Errors that can occur during orchestration.
#[derive(Debug, Error)]
pub enum OrchestratorError {
    /// Returned when the snapshot buffer contains fewer entries than required to create results.
    #[error("Not enough snapshots to retrieve.")]
    NotEnoughSnapshots,

    /// Returned when there's no metric sources configured to profile the program with.
    #[error("No metric sources configured.")]
    NoSourceConfigured,

    /// Happens when an error occur while joining sources.
    #[error("Join error")]
    JoinError(
        #[from]
        #[source]
        JoinError,
    ),

    /// Returned when an error occur when sending an event to the sources channel.
    #[error("Send error")]
    SendError(
        #[from]
        #[source]
        SendError<SourceEvent>,
    ),

    /// Returned when an error occured while sending the initialization event.
    #[error("Cannot initialize {0} source.")]
    InitializationError(String),

    /// An error thrown by a metric source.
    #[error(transparent)]
    MetricSourceError(#[from] MetricSourceError),
}