Wrk

Struct Wrk 

Source
pub struct Wrk { /* private fields */ }
Expand description

Wrapper around Wrk enabling to run benchmarks, record historical data and plot graphs.

Implementations§

Source§

impl Wrk

Source

pub fn url(&self) -> &String

Url of the service to benchmark against. Use the full URL of the request. IE: http://localhost:1234/some/uri.

Source

pub fn timeout(&self) -> &u8

Wrk timeout in seconds

Source

pub fn benchmarks(&self) -> &Benchmarks

Set of benchmarks for the current instance.

Source

pub fn benchmarks_history(&self) -> &Benchmarks

Historical benchmarks data, indexed by dates.

Source

pub fn history_dir(&self) -> &PathBuf

Directory on disk where to store and read the historical benchmark data.

Source

pub fn user_script(&self) -> &Option<PathBuf>

User defined LUA script to run through wrk. **NOTE: This script MUST not override the wrk function done() as it already overriden by this crate to allow wrk to spit out a parsable JSON output.

Source

pub fn headers(&self) -> &Headers

Header to add to the wrk request.

Source

pub fn method(&self) -> &String

Method for the wrk request.

Source

pub fn body(&self) -> &String

Body for the wrk request.

Source

pub fn max_error_percentage(&self) -> &u8

Max percentage of errors vs total request to conside a benchmark healthy.

Source

pub fn benchmark_date(&self) -> &Option<DateTime<Utc>>

Current benchmark date and time.

Source§

impl Wrk

Source

pub fn set_url(&mut self, val: String) -> &mut Self

Url of the service to benchmark against. Use the full URL of the request. IE: http://localhost:1234/some/uri.

Source

pub fn set_timeout(&mut self, val: u8) -> &mut Self

Wrk timeout in seconds

Source

pub fn set_benchmarks(&mut self, val: Benchmarks) -> &mut Self

Set of benchmarks for the current instance.

Source

pub fn set_benchmarks_history(&mut self, val: Benchmarks) -> &mut Self

Historical benchmarks data, indexed by dates.

Source

pub fn set_history_dir(&mut self, val: PathBuf) -> &mut Self

Directory on disk where to store and read the historical benchmark data.

Source

pub fn set_user_script(&mut self, val: Option<PathBuf>) -> &mut Self

User defined LUA script to run through wrk. **NOTE: This script MUST not override the wrk function done() as it already overriden by this crate to allow wrk to spit out a parsable JSON output.

Source

pub fn set_headers(&mut self, val: Headers) -> &mut Self

Header to add to the wrk request.

Source

pub fn set_method(&mut self, val: String) -> &mut Self

Method for the wrk request.

Source

pub fn set_body(&mut self, val: String) -> &mut Self

Body for the wrk request.

Source

pub fn set_max_error_percentage(&mut self, val: u8) -> &mut Self

Max percentage of errors vs total request to conside a benchmark healthy.

Source

pub fn set_benchmark_date(&mut self, val: Option<DateTime<Utc>>) -> &mut Self

Current benchmark date and time.

Source§

impl Wrk

Source

pub fn url_mut(&mut self) -> &mut String

Url of the service to benchmark against. Use the full URL of the request. IE: http://localhost:1234/some/uri.

Source

pub fn timeout_mut(&mut self) -> &mut u8

Wrk timeout in seconds

Source

pub fn benchmarks_mut(&mut self) -> &mut Benchmarks

Set of benchmarks for the current instance.

Source

pub fn benchmarks_history_mut(&mut self) -> &mut Benchmarks

Historical benchmarks data, indexed by dates.

Source

pub fn history_dir_mut(&mut self) -> &mut PathBuf

Directory on disk where to store and read the historical benchmark data.

Source

pub fn user_script_mut(&mut self) -> &mut Option<PathBuf>

User defined LUA script to run through wrk. **NOTE: This script MUST not override the wrk function done() as it already overriden by this crate to allow wrk to spit out a parsable JSON output.

Source

pub fn headers_mut(&mut self) -> &mut Headers

Header to add to the wrk request.

Source

pub fn method_mut(&mut self) -> &mut String

Method for the wrk request.

Source

pub fn body_mut(&mut self) -> &mut String

Body for the wrk request.

Source

pub fn max_error_percentage_mut(&mut self) -> &mut u8

Max percentage of errors vs total request to conside a benchmark healthy.

Source

pub fn benchmark_date_mut(&mut self) -> &mut Option<DateTime<Utc>>

Current benchmark date and time.

Source§

impl Wrk

Source

pub fn bench(&mut self, benchmarks: &Vec<Benchmark>) -> Result<(), WrkError>

Source

pub fn bench_exponential( &mut self, duration: Option<Duration>, ) -> Result<(), WrkError>

Source

pub fn all_benchmarks(&self) -> Benchmarks

Source

pub fn deviation( &mut self, period: HistoryPeriod, ) -> Result<Deviation, WrkError>

Source

pub fn plot( &self, title: &str, output: &Path, benchmarks: &Benchmarks, ) -> Result<(), WrkError>

Trait Implementations§

Source§

impl Clone for Wrk

Source§

fn clone(&self) -> Wrk

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Wrk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Wrk

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Wrk

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Wrk

§

impl RefUnwindSafe for Wrk

§

impl Send for Wrk

§

impl Sync for Wrk

§

impl Unpin for Wrk

§

impl UnwindSafe for Wrk

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,