Skip to content

Commit

Permalink
#246: Change type of GooseMetrics::tasks_per_second to usize.
Browse files Browse the repository at this point in the history
  • Loading branch information
slashrsm committed Dec 7, 2021
1 parent 7b1493f commit b157f45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ pub struct GooseMetrics {
pub tasks: GooseTaskMetrics,
/// Number of tasks at the end of each second of the test. Each element of the vector
/// represents one second.
pub tasks_per_second: Vec<u32>,
pub tasks_per_second: Vec<usize>,
/// Tracks and counts each time an error is detected during the load test.
///
/// Can be disabled with either the `--no-error-summary` or `--no-metrics` run-time options,
Expand Down Expand Up @@ -2228,7 +2228,7 @@ impl GooseMetrics {
///
/// This is called from [`GooseAttack::receive_metrics()`] and the data
/// collected is used to display users and tasks graphs on the HTML report.
pub(crate) fn record_users_tasks_per_second(&mut self, tasks: u32) {
pub(crate) fn record_users_tasks_per_second(&mut self, tasks: usize) {
if let Some(starting) = self.starting {
let second = (Utc::now().timestamp() - starting.timestamp()) as usize;

Expand Down Expand Up @@ -2394,7 +2394,7 @@ impl GooseAttack {
for set in self.task_sets.iter() {
tasks += set.tasks.len();
}
self.metrics.record_users_tasks_per_second(tasks as u32);
self.metrics.record_users_tasks_per_second(tasks);
}

// Load messages from user threads until the receiver queue is empty.
Expand Down
4 changes: 2 additions & 2 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ pub fn graph_users_per_second_template(
)
}

pub fn graph_tasks_per_second_template(
tasks: &[(String, u32)],
pub fn graph_tasks_per_second_template<T: Serialize>(
tasks: &[(String, T)],
starting: Option<DateTime<Local>>,
started: Option<DateTime<Local>>,
stopping: Option<DateTime<Local>>,
Expand Down

0 comments on commit b157f45

Please sign in to comment.