Skip to content

Fix accumulation of time duration in subsequent events - #3

Merged
egull merged 8 commits into
Green-Phys:mainfrom
gauravharsha:main
Nov 6, 2025
Merged

Fix accumulation of time duration in subsequent events#3
egull merged 8 commits into
Green-Phys:mainfrom
gauravharsha:main

Conversation

@gauravharsha

Copy link
Copy Markdown
Contributor

In the current default behavior of timing module, repeated calls of start and stop for same event accumulates the duration of the event. While, in general, this is good within a SCF iteration, transfer of the accumulated duration across multiple iterations is problematic.

This PR fixes this issue by adding a boolean keyword accumulate in the declaration of event.
Tests are also added for the new functionality.

@gauravharsha
gauravharsha requested review from Copilot and egull November 6, 2025 05:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new features to the timing utility: (1) an accumulate mode that controls whether event durations are accumulated across multiple start/end cycles or replaced, and (2) a reset() method to clear child event durations.

Key changes:

  • Added accumulate parameter to start() method with default value false
  • Added reset() method to zero out child event durations
  • Added comprehensive tests for both features

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/green/utils/timing.h Added accumulate field to event_t struct, modified start() to accept accumulate parameter, updated end() to conditionally accumulate or replace duration, added reset() method with documentation
test/utils_test.cpp Added "Test Accumulate" section testing both accumulate=true and accumulate=false modes, added "Test Reset" section verifying child events are zeroed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/green/utils/timing.h
Comment thread src/green/utils/timing.h Outdated
Comment thread test/utils_test.cpp Outdated
@gauravharsha
gauravharsha requested a review from Copilot November 6, 2025 05:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/green/utils/timing.h
Comment thread src/green/utils/timing.h
Comment thread test/utils_test.cpp Outdated
Comment thread src/green/utils/timing.h Outdated
@egull

egull commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Looks good to me. Let's merge.

@egull
egull merged commit ddb7cdc into Green-Phys:main Nov 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants