assisi / playground

Extensions to the Enki simulator for the ASSISI|bf project.
Other
2 stars 3 forks source link

Method to monitor current simulation rate #56

Open rmm-fcul opened 9 years ago

rmm-fcul commented 9 years ago

With large numbers of bees and/or CASUs, I experience a slowdown of simulation time. However, this is at present unquantified.

Can we implement a simple method that provides the user with what the current simulation speed is?

Some potential implementation routes (not prescriptive, if an alternative is easier):

  1. displaying #secs elapsed, alongside the #simulated secs elapsed already displayed.
  2. a python API call to access the simulator time
  3. a periodic callback that operates once a minute, and displays a warning (on the console is enough) if we have more than 5% skew in the last minute.

(for (3), the minute and 5% should be parameters of course)

rmm-fcul commented 9 years ago

Note: monitoring the CPU and/or memory usage do not provide a direct indication of when slowdown is occurring, so the bluntest tools aren't sufficient to provide a warning.
I think direct access to the simulation clock, vs. system real-time clock will indicate when slowdown occurs, as well as allowing it to be quantified.

plsm commented 9 years ago

I have implemented a check on real time versus simulated time. Every n seconds of simulated time, I divide the elapsed real time by n. If the resulting value is bigger than t, the assisi playground prints a message to standard error. There is also an python call to obtain the simulated time (since playground launch). Check the monitor branch.

dmiklic commented 9 years ago

@rmm-fcul Can you confirm that Pedro's fix satisfies your requirements? If yes, we can close this.

rmm-fcul commented 9 years ago

The solution (3) is fine, although a bit clearer documentation in the --help would be useful. (i.e. state the units). Solution (2) is great - I missed it until today so haven't tested with any other timing code but it corresponds fine to what is displayed on the enki main window.

For (2), I actually don't see how to do more formal tests than a visual comparison. Please advise if this is not sufficient

rmm-fcul commented 9 years ago

One minor tweak I made in (3) is in extensions/ExtendedWorld.cpp, line 111 from std::cerr << "elapsed: " << elapsed.wall to std::cerr << "elapsed: " << elapsed.wall << " (" << absoluteTime << "s elapsed)"

since the variable elapsed.wall is not a readable number (11 digits -- don't know what it corresponds to directly either).

rmm-fcul commented 9 years ago

@plsm could we incorporate some improved output messages that are more readable, and then we can close this issue?

plsm commented 9 years ago

I will check the units in type boost::timer::cpu_times in order to improve output messages.