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

Improve TimeTasks #54

Open
alecjohnson opened this issue Oct 9, 2013 · 0 comments
Open

Improve TimeTasks #54

alecjohnson opened this issue Oct 9, 2013 · 0 comments

Comments

@alecjohnson
Copy link
Contributor

Issue #17 introduced the TimeTasks class to implement basic profiling.

A simpler and more general approach is possible based on macros and automatic destructors.

Create a set of time_task macros to be used as follows:

  void mymethod()
  {
    // record time from this point to the end of this scope.
    timeTasks_set_main_task(Task::PARTICLES);
    ...
    // block that does communication
    {
        // mode is reset to communication until end of scope
        timeTasks_set_communicating();
        ...
    }
  }

Improvements:

  • use of destructors: The implementation of the time_task macros constructs a non-anonymous class instance whose destructor is called when it goes out of scope. This eliminates the need to make separate calls to start() and end() methods.
  • defining subtasks is now supported.
alecjohnson added a commit to alecjohnson/iPic3D that referenced this issue Oct 10, 2013
alecjohnson added a commit to alecjohnson/iPic3D that referenced this issue Oct 15, 2013
alecjohnson added a commit to alecjohnson/iPic3D that referenced this issue Oct 28, 2013
  commit d51cb7 had no effect because changes were implemented
  in oldSumMoments().  This commit implements the same changes
  in sumMoments().
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

No branches or pull requests

1 participant