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

Multi-threaded stats #872

Open
randy408 opened this issue Nov 30, 2022 · 1 comment
Open

Multi-threaded stats #872

randy408 opened this issue Nov 30, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@randy408
Copy link
Contributor

Describe the problem you are trying to solve.
The stats addon and explorer is not MT aware, the values stop making sense with multiple threads.

Describe the solution you'd like
Add support for per-thread stats, thread-specific stats (could indicate how well work is distributed, etc), and proper sums for time spent in systems (wall clock vs cpu time). And then support for it in explorer, of course.

@randy408 randy408 added the enhancement New feature or request label Nov 30, 2022
@ZeroErrors
Copy link
Contributor

To add a little more detail to this issue.

Currently the system_time_total is calculated only on the main thread:

if (measure_time) {
ecs_time_measure(&st);
}
const int32_t i = flecs_run_pipeline_ops(world, stage, stage_index, stage_count, delta_time, true);
if (measure_time) {
/* Don't include merge time in system time */
world->info.system_time_total += (ecs_ftime_t)ecs_time_measure(&st);
}

This means that the stats only knows about the amount of time the operation took to execute the main thread portion of the work, however, systems may have unbalanced work. Meaning a worker thread could have more to do than the main thread. If this happens it will cause the time interval on the main thread will not be equivalent to the amount of time the system actually took to execute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants