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

[GUI] Improve advanced timer #468

Merged

Conversation

chrijopa
Copy link
Contributor

@chrijopa chrijopa commented Oct 12, 2017

This pull request allows the usage of the advanced timer

  1. In the standard way
    runSofa -c 1
  2. Only for the init functions:
    runSofa -c 0
  3. For the init function and for every second step:
    runSofa -c -2

Moreover, the usage of the advanced timer in batch mode works again:
runSofa -c -2 -g batch -n 10

Fixes #357


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

@sofabot
Copy link
Collaborator

sofabot commented Oct 12, 2017

Thank you for your pull request!
Someone will soon check it and start the builds.

@hugtalbot hugtalbot added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Oct 12, 2017
@hugtalbot hugtalbot requested a review from untereiner October 12, 2017 15:17
@@ -185,7 +185,7 @@ int main(int argc, char** argv)
bool noAutoloadPlugins = false;
int nbIterations = BatchGUI::DEFAULT_NUMBER_OF_ITERATIONS;
unsigned int nbMSSASamples = 1;
unsigned computationTimeSampling=0; ///< Frequency of display of the computation time statistics, in number of animation steps. 0 means never.
int computationTimeSampling=0; ///< Frequency of display of the computation time statistics, in number of animation steps. 0 means never.

Choose a reason for hiding this comment

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

where is the computationTimeSampling variable negative ?
I can't find it

@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Oct 18, 2017
@damienmarchal
Copy link
Contributor

Hello,

Thank for the PR. The added feature is nice and should be merged but the way it hack the command line by allowing "-2" is very confusing.

Why not doing:
The standard way
runSofa -c 1

Only for the init functions:
runSofa -b
(as -i is already taken maybe -b to begin is a good choice)

For the init function and for every second step:
runSofa -c 2 -b

It would clearly separate the concerns instead of encoding different behavior in the same variable.

@chrijopa
Copy link
Contributor Author

Thank you Damien for the important remark considering "-2", I was not aware of this problem. I will look into further details tomorrow.

@hugtalbot hugtalbot changed the title Improve advanced timer [GUI] Improve advanced timer Nov 2, 2017
sofa::helper::AdvancedTimer::setEnabled("Init", true);
sofa::helper::AdvancedTimer::setInterval("Init", 1);
sofa::helper::AdvancedTimer::setOutputType("Init", computationTimeOutputType);
sofa::helper::AdvancedTimer::begin("Init");
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a duplicated begin("Init") here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a bug in the advanced timer (variable initialization at -1 instead of 0), that I just removed. Should be fine but it is good if that is double checked.

@hugtalbot
Copy link
Contributor

@chrijopa could you take some time to progress on this ? this is open for a long time

@guparan
Copy link
Contributor

guparan commented Nov 15, 2017

[ci-build]

@guparan guparan added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Nov 15, 2017
std::cout << "Computing "<<nbIter<<" iterations." << std::endl;
sofa::helper::AdvancedTimer::begin("Animate");
sofa::helper::AdvancedTimer::end("Animate");
sofa::helper::AdvancedTimer::begin("Animate");
Copy link
Contributor

Choose a reason for hiding this comment

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

@chrijopa: Why begin then end immediately?

sofa::simulation::getSimulation()->animate(groot.get());
std::cout << sofa::helper::AdvancedTimer::end("Animate", groot.get()) << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use msg_info instead of std::cout

sofa::simulation::getSimulation()->init(groot.get());
if( computationTimeAtBegin )
{
std::cout << sofa::helper::AdvancedTimer::end("Init", groot.get()) << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use msg_info instead of std::cout

@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Nov 22, 2017
chrisjopau and others added 3 commits December 11, 2017 19:54
…putationTimeSampling

# Conflicts:
#	applications/projects/runSofa/Main.cpp
#	applications/sofa/gui/BatchGUI.cpp
@guparan
Copy link
Contributor

guparan commented Dec 12, 2017

[ci-build]

@guparan
Copy link
Contributor

guparan commented Dec 12, 2017

[ci-build]

@guparan guparan added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Dec 19, 2017
@hugtalbot
Copy link
Contributor

@ErwanDouaille could you check (very shortly) the API of argument parser in this PR please? we would like to integrate it in v17.12 release ;)

@ErwanDouaille ErwanDouaille self-requested a review January 3, 2018 09:19
@hugtalbot
Copy link
Contributor

[ci-build][with-scene-tests]

@sofa-framework sofa-framework deleted a comment from sofabot Jan 3, 2018
@sofa-framework sofa-framework deleted a comment from sofabot Jan 3, 2018
@ErwanDouaille
Copy link
Contributor

@hugtalbot I didn't test it but the argument parser stuff looks good to me. I would suggest to not define b/o characters because, AFAIK, advance timer is not often used so maybe there is better use of b/o character.

@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jan 10, 2018
@guparan guparan merged commit 573fc41 into sofa-framework:master Jan 14, 2018
@untereiner untereiner deleted the improve_computationTimeSampling branch January 14, 2018 18:50
@guparan guparan added this to the v17.12 milestone Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants