Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #99 Push/pop Timer name prefixes #146

Merged
merged 4 commits into from
Nov 15, 2023
Merged

Fix #99 Push/pop Timer name prefixes #146

merged 4 commits into from
Nov 15, 2023

Conversation

vasdommes
Copy link
Collaborator

Summary:

  • Rewrote ScopedTimer to ensure that nested timers will have correct prefixes, see changes in Timers.hxx. Also added asserts to ensure that nested timer always stops before parent.
  • Added some new timers, e.g. "sdpb.solve.run.iter_XXX" for each solver iteration.
  • Renamed some timers, e.g. for sdp2input.
  • Fixed Timer::elapsed_milliseconds(): show correct time even if timer is still running.

ScopedTimer now temporarily adds its name to Timers::prefix.
Example:

void f()
{
  Timers timers(false);
  Scoped_Timer root_timer(timers, "root"); // "root"
  Scoped_Timer x_timer(timers, "x"); // "root.x"
  x_timer.stop();
  Scoped_Timer y_timer(timers, "y"); // "root.y"
  {
    Scoped_Timer yy_timer(timers, "yy"); // "root.y.yy"
  }
  Scoped_Timer z_timer(timers, "z"); // "root.y.z"
}

The only change to SDPB behaviour is timer names printed to profiling.* in debug mode. Beside that, this PR is mainly about improving code quality.

Also require that Timer::stop() is called only once.
+ some refactoring
This will help with further refactoring, when we'll add more timers before solver start.
Also fix some timer names, e.g. for sdp2input

ScopedTimer now temporarily adds its name to Timers::prefix.
Example:

void f()
{
  Timers timers(false);
  Scoped_Timer root_timer(timers, "root"); // "root"
  Scoped_Timer foo_timer(timers, "foo"); // "root.foo"
  foo_timer.stop();
  Scoped_Timer bar_timer(timers, "bar"); // "root.bar"
}
@vasdommes vasdommes added this to the 2.6.0 milestone Nov 14, 2023
@vasdommes vasdommes merged commit 0a3b37a into master Nov 15, 2023
2 checks passed
@vasdommes vasdommes deleted the timer-prefix branch November 15, 2023 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant