Skip to content

Commit

Permalink
Fix ovis_event thrstat calculation
Browse files Browse the repository at this point in the history
When `__thrstat_wait_start()` was called, the caller was going into
INACTIVE state from ACTIVE state. Hence, the duration from `wait_end` to
`now` was the active time and should be added to `proc_tot`.

Likewise, when `__thrstat_wait_end()` was called, the caller just woke
up. Hence, the duration from `wait_start` to `now` was an INACTIVE time
and should be added to `wait_tot`.
  • Loading branch information
narategithub authored and tom95858 committed Nov 22, 2024
1 parent 60f7a07 commit 317058e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/ovis_event/ovis_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ static void __thrstat_wait_start(ovis_event_thrstat_t stats)

clock_gettime(CLOCK_REALTIME, &now);
stats->wait_start = now;
stats->wait_tot += __timespec_diff_us(&stats->wait_end, &now);
stats->proc_tot += __timespec_diff_us(&stats->wait_end, &now);
stats->waiting = 1;
}

Expand All @@ -673,7 +673,7 @@ static void __thrstat_wait_end(ovis_event_thrstat_t stats)
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
stats->wait_end = now;
stats->proc_tot += __timespec_diff_us(&stats->wait_start, &now);
stats->wait_tot += __timespec_diff_us(&stats->wait_start, &now);
stats->waiting = 0;
}

Expand Down

0 comments on commit 317058e

Please sign in to comment.