if (g_initializing_perfetto_on_background_thread) {Peter Birk PakkenbergIf the call to InitPerfetto has been posted to a background thread then I don't think anything guarantees that it will have reached the point of setting this variable to true before this function is called?
I think you would need to always signal the event and always wait on it, and only read `g_initializing_perfetto_on_background_thread` *after* successfully waiting for it if you want to know whether it was done on the background thread or not for the purposes of the metric.
Agreed, good catch.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi Nate, do you have capacity to review this while Torne is OOO?
if (g_initializing_perfetto_on_background_thread) {Peter Birk PakkenbergIf the call to InitPerfetto has been posted to a background thread then I don't think anything guarantees that it will have reached the point of setting this variable to true before this function is called?
I think you would need to always signal the event and always wait on it, and only read `g_initializing_perfetto_on_background_thread` *after* successfully waiting for it if you want to know whether it was done on the background thread or not for the purposes of the metric.
Agreed, good catch.
I've moved the update to the global flag to the main thread instead, to ensure that we only wait when we did initialize on a background thread. Otherwise we would have a situation where the current flow would wait indefinitely because InitTracing isn't called in the baseline implementation.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
Colin would you mind doing an OWNERS review of //services/tracing on this CL (2 files). I am adding timing histograms to the initialization process to help improve WebView startup times.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Add experiment for background tracing init
This experiment posts the initialization of the tracing service and
Perfetto to a background task runner as soon as the native library has
been initialized, and ensures that startup waits for the task to finish
before continuing.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |