pub struct IntervalLogWriter<'a, 'b, W: 'a + Write, S: 'b + Serializer> { /* private fields */ }
Expand description

Writes interval histograms in an interval log.

This isn’t created directly; start with an IntervalLogWriterBuilder. Once you’ve written the headers and ended up with an IntervalLogWriter, typical usage would be to write a histogram at regular intervals (e.g. once a second).

use hdrhistogram::serialization;
use hdrhistogram::serialization::interval_log;

let mut buf = Vec::new();
let mut serializer = serialization::V2Serializer::new();

// create a writer via a builder
let mut writer = interval_log::IntervalLogWriterBuilder::new()
    .begin_log_with(&mut buf, &mut serializer)
    .unwrap();

writer.write_comment("Comment 2").unwrap();

// .. write some intervals

Implementations§

source§

impl<'a, 'b, W: 'a + Write, S: 'b + Serializer> IntervalLogWriter<'a, 'b, W, S>

source

pub fn write_comment(&mut self, s: &str) -> Result<()>

Write a comment line.

Comments containing ‘\n’ will be transformed into multiple lines of comments.

source

pub fn write_histogram<T: Counter>( &mut self, h: &Histogram<T>, start_timestamp: Duration, duration: Duration, tag: Option<Tag<'_>> ) -> Result<(), IntervalLogWriterError<S::SerializeError>>

Write an interval histogram.

start_timestamp is the time since the epoch in seconds that measurements started being recorded in this interval. If you’re using a StartTime or BaseTime offset, you should instead use a delta since that time. See the discussion about timestamps in the module-level documentation.

duration is the duration of the interval in seconds.

tag is an optional tag for this histogram.

Auto Trait Implementations§

§

impl<'a, 'b, W, S> RefUnwindSafe for IntervalLogWriter<'a, 'b, W, S>where S: RefUnwindSafe, W: RefUnwindSafe,

§

impl<'a, 'b, W, S> Send for IntervalLogWriter<'a, 'b, W, S>where S: Send, W: Send,

§

impl<'a, 'b, W, S> Sync for IntervalLogWriter<'a, 'b, W, S>where S: Sync, W: Sync,

§

impl<'a, 'b, W, S> Unpin for IntervalLogWriter<'a, 'b, W, S>

§

impl<'a, 'b, W, S> !UnwindSafe for IntervalLogWriter<'a, 'b, W, S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.