Struct arti_bench::Benchmark
source · [−]pub(crate) struct Benchmark<R> where
R: Runtime, {
pub(crate) runtime: R,
pub(crate) connect_addr: SocketAddr,
pub(crate) samples: usize,
pub(crate) streams_per_circ: usize,
pub(crate) circs_per_sample: usize,
pub(crate) upload_payload: Arc<[u8]>,
pub(crate) download_payload: Arc<[u8]>,
pub(crate) results: HashMap<BenchmarkType, BenchmarkResults>,
}
Expand description
A helper struct for running benchmarks
Fields
runtime: R
connect_addr: SocketAddr
samples: usize
streams_per_circ: usize
circs_per_sample: usize
upload_payload: Arc<[u8]>
download_payload: Arc<[u8]>
results: HashMap<BenchmarkType, BenchmarkResults>
All benchmark results conducted, indexed by benchmark type.
Implementations
sourceimpl<R: Runtime> Benchmark<R>
impl<R: Runtime> Benchmark<R>
sourcepub(crate) fn run<F, G, S, E>(
&mut self,
ty: BenchmarkType,
stream_generator: F
) -> Result<()> where
F: FnMut(usize) -> G,
G: Future<Output = Result<S, E>>,
S: AsyncRead + AsyncWrite + Unpin,
E: Error + Send + Sync + 'static,
pub(crate) fn run<F, G, S, E>(
&mut self,
ty: BenchmarkType,
stream_generator: F
) -> Result<()> where
F: FnMut(usize) -> G,
G: Future<Output = Result<S, E>>,
S: AsyncRead + AsyncWrite + Unpin,
E: Error + Send + Sync + 'static,
Run a type of benchmark (ty
), performing self.samples
benchmark
runs, using self.circs_per_sample
concurrent circuits, and
self.streams_per_circ
concurrent streams on each circuit.
Uses stream_generator
, function that returns futures that themselves
generate streams, in order to obtain the required number of streams to
run the test over. The function takes an index of the current run.
sourcepub(crate) fn without_arti(&mut self) -> Result<()>
pub(crate) fn without_arti(&mut self) -> Result<()>
Benchmark without Arti on loopback.
sourcepub(crate) fn with_proxy(&mut self, addr: &str) -> Result<()>
pub(crate) fn with_proxy(&mut self, addr: &str) -> Result<()>
Benchmark through a SOCKS5 proxy at address addr
.
sourcepub(crate) fn with_arti(&mut self, tcc: TorClientConfig) -> Result<()>
pub(crate) fn with_arti(&mut self, tcc: TorClientConfig) -> Result<()>
Benchmark through Arti, using the provided TorClientConfig
.
Auto Trait Implementations
impl<R> RefUnwindSafe for Benchmark<R> where
R: RefUnwindSafe,
impl<R> Send for Benchmark<R>
impl<R> Sync for Benchmark<R>
impl<R> Unpin for Benchmark<R> where
R: Unpin,
impl<R> UnwindSafe for Benchmark<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more