[][src]Struct goose::prelude::GooseStats

pub struct GooseStats {
    pub hash: u64,
    pub duration: usize,
    pub users: usize,
    pub requests: GooseRequestStats,
    pub display_percentile: bool,
    pub display_status_codes: bool,
}

Statistics collected during a Goose load test.

Example

use goose::prelude::*;

fn main() -> Result<(), GooseError> {
    let goose_stats: GooseStats = GooseAttack::initialize()?
        .register_taskset(taskset!("ExampleUsers")
            .register_task(task!(example_task))
        )
        .execute()?;

    // It is now possible to do something with the statistics collected by Goose.
    // For now, we'll just pretty-print the entire object.
    println!("{:#?}", goose_stats);

    Ok(())
}

async fn example_task(user: &GooseUser) -> GooseTaskResult {
    let _goose = user.get("/").await?;

    Ok(())
}

Fields

hash: u64

A hash of the load test, useful to verify if different statistics are from the same load test.

duration: usize

How many seconds the load test ran.

users: usize

Total number of users simulated during this load test.

requests: GooseRequestStats

Goose request statistics.

display_percentile: bool

Flag indicating whether or not to display percentile. Because we're deriving Default, this defaults to false.

display_status_codes: bool

Flag indicating whether or not to display status_codes. Because we're deriving Default, this defaults to false.

Implementations

impl GooseStats[src]

pub fn print(&self)[src]

Consumes and display all statistics from a completed load test.

Example

use goose::prelude::*;

fn main() -> Result<(), GooseError> {
    GooseAttack::initialize()?
        .register_taskset(taskset!("ExampleUsers")
            .register_task(task!(example_task))
        )
        .execute()?
        .print();

    Ok(())
}

async fn example_task(user: &GooseUser) -> GooseTaskResult {
    let _goose = user.get("/").await?;

    Ok(())
}

pub fn print_running(&self)[src]

Consumes and displays statistics from a running load test.

pub fn fmt_requests(&self, fmt: &mut Formatter) -> Result[src]

Optionally prepares a table of requests and fails.

pub fn fmt_response_times(&self, fmt: &mut Formatter) -> Result[src]

pub fn fmt_percentiles(&self, fmt: &mut Formatter) -> Result[src]

pub fn fmt_status_codes(&self, fmt: &mut Formatter) -> Result[src]

Trait Implementations

impl Clone for GooseStats[src]

impl Debug for GooseStats[src]

impl Default for GooseStats[src]

impl Display for GooseStats[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,