Commit Graph
120 Commits
Author SHA1 Message Date
Noemi Erli fc342c9628 Backed out changeset 7718734e95b1 (bug 1846407) for causing bustages in nsWindow.cpp CLOSED TREE 2023-10-18 05:31:49 +03:00
Tooru Fujisawa bebceb1b21 Bug 1846407 - Use enum class for Task::Run return value. r=bas,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D185043
2023-10-18 01:54:43 +00:00
Cristian Tuns 457378e9e0 Backed out changeset a44ec30d604f (bug 1846407) for causing build bustages in ScriptLoader.cpp CLOSED TREE 2023-10-17 18:46:25 -04:00
Tooru Fujisawa 83e7121bc5 Bug 1846407 - Use enum class for Task::Run return value. r=bas,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D185043
2023-10-17 22:16:58 +00:00
Emilio Cobos Álvarez 416ace7d70 Bug 1858080 - Restore an include that's needed in some configurations. CLOSED TREE 2023-10-10 20:12:25 +03:00
Emilio Cobos Álvarez 7493849b28 Bug 1858080 - Cleaner TaskController shutdown. r=bas
Using a static std::unique_ptr introduces atexit destructors which can
cause the thread pool to exit in a non-clean state.

Use StaticAutoPtr to avoid this. Clean-up a bit while at it.

We could move the thread-joining into the TaskController destructor too,
that might be worth doing.

Differential Revision: https://phabricator.services.mozilla.com/D190552
2023-10-10 16:22:36 +00:00
Tooru Fujisawa 268184d652 Bug 1839102 - Use enum class for Task kind. r=bas
Differential Revision: https://phabricator.services.mozilla.com/D182980
2023-07-26 05:09:29 +00:00
Sandor Molnar 25031486a3 Backed out changeset b99cc4960043 (bug 1839102) for causing build bustages in idget/windows/nsWindow.cpp CLOSED TREE 2023-07-26 05:53:26 +03:00
Tooru Fujisawa 25becb8a76 Bug 1839102 - Use enum class for Task kind. r=bas
Differential Revision: https://phabricator.services.mozilla.com/D182980
2023-07-26 02:26:15 +00:00
Florian Quèze de6cef3975 Bug 1836191 - remove PerformanceCounter that was only used by ChromeUtils.requestPerformanceMetrics, r=smaug.
Differential Revision: https://phabricator.services.mozilla.com/D179697
2023-06-08 21:53:18 +00:00
Randell Jesup cc7d3c0765 Bug 1825117: Add Telemetry for Runnable execution times if they're long r=nika
Differential Revision: https://phabricator.services.mozilla.com/D173878
2023-04-13 19:22:45 +00:00
Randell Jesup a81eecaf48 Bug 1746479: xpcom TaskController cleanup r=bas
Differential Revision: https://phabricator.services.mozilla.com/D134061
2023-03-31 14:03:19 +00:00
Florian Quèze 9e4a8777b9 Bug 1817498 - Unlock the TaskController mGraphMutex mutex before calling into BackgroundHangThread APIs, r=bas.
Differential Revision: https://phabricator.services.mozilla.com/D171260
2023-03-07 12:37:03 +00:00
Nazım Can Altınova 5b013c2457 Bug 1807015 - Do not call Timestamp::Now when profiler is not running for event delay data r=nika,mstange
Differential Revision: https://phabricator.services.mozilla.com/D166950
2023-02-14 09:46:18 +00:00
Nazım Can Altınova c91a8714b7 Bug 1803751 - Make some marker fields searchable and bump the profile version r=julienw
Differential Revision: https://phabricator.services.mozilla.com/D163714
2022-12-13 14:19:07 +00:00
Iulian Moraru 94985653c4 Backed out changeset 27f8690ebc50 (bug 1803751) for causing xpcshell failures on test_feature_mainthreadio.js. CLOSED TREE 2022-12-12 17:43:23 +02:00
Nazım Can Altınova 76eaba45b7 Bug 1803751 - Make some marker fields searchable and bump the profile version r=julienw
Differential Revision: https://phabricator.services.mozilla.com/D163714
2022-12-12 13:11:56 +00:00
Florian Quèze 701d98ab91 Bug 1770087 - Show the task priority in task controller Runnable markers, r=bas,gerald.
Differential Revision: https://phabricator.services.mozilla.com/D146761
2022-06-15 15:00:40 +00:00
Bas Schouten 10a4d377e0 Bug 1767875: Avoid ever waking up more than one thread at a time. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D145962
2022-05-10 23:52:31 +00:00
Olli Pettay 49d4d2f5d1 Bug 1762090, don't block refreshdrivers for too long time on linux, r=mstange
Explicitly detect the case when main thread has been empty, and if so, don't give other tasks
extra time.

Differential Revision: https://phabricator.services.mozilla.com/D142740
2022-04-06 00:40:25 +00:00
Randell Jesup cd382aae30 Bug 1207753: Basic thread-safety annotations to quiet errors until real annotations land r=nika
Differential Revision: https://phabricator.services.mozilla.com/D141062
2022-03-17 18:39:15 +00:00
Olli Pettay 6053195932 Bug 1755006, reduce framerate if the main thread is busy handling also other tasks, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D140046
2022-03-14 23:28:33 +00:00
Cristian Tuns c9f9f7de1f Backed out changeset 0211ed711a1c (bug 1755006) for causing mochitest failures on browser_ext_pageAction_context.js,browser_panel_list_accessibility.js CLOSED TREE 2022-03-14 06:53:10 -04:00
Olli Pettay 0adad430a5 Bug 1755006, reduce framerate if the main thread is busy handling also other tasks, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D140046
2022-03-13 21:26:14 +00:00
Marian-Vasile Laza c71ed5e057 Backed out changeset d3f40b4651f5 (bug 1755006) for causing mochitest failures on test_pointerlock-api.html. CLOSED TREE 2022-03-10 17:54:53 -08:00
Olli Pettay 0005e7e8e8 Bug 1755006, reduce framerate if the main thread is busy handling also other tasks, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D140046
2022-03-10 23:04:55 +00:00
Jan de Mooij 3f34142ba6 Bug 1747719 - Use a larger stack size for TaskController threads for ASan builds. r=jonco,bas
ASan builds use more stack space so need a larger stack size. Note that this matches
what we already do for the JS overrecursion limit for the main thread.

This fixes overrecursion errors from the parser when parsing JS files off-thread
on YouTube.

Differential Revision: https://phabricator.services.mozilla.com/D135201
2022-01-18 09:38:53 +00:00
Florian Quèze 23e763f19d Bug 1738285 - move AUTO_PROFILE_FOLLOWING_RUNNABLE to its own header, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D129825
2021-10-28 20:35:06 +00:00
Bob Owen 0b72cdd84f Bug 1546154 p5: Remove CoInitializeEx call from TaskController. r=bas
Threads are implicitly members of the multi-threaded apartment and calls to
CoInitializeEx (and CoUninitializeEx) cause user32 to load.

Differential Revision: https://phabricator.services.mozilla.com/D124933
2021-09-20 10:09:02 +00:00
Marian-Vasile Laza 9099bcacd0 Backed out 7 changesets (bug 1546154) for causing build bustages on ContentProcess.cpp. CLOSED TREE
Backed out changeset 0bd777eee249 (bug 1546154)
Backed out changeset 611812ee62a2 (bug 1546154)
Backed out changeset cef0aa18a3ab (bug 1546154)
Backed out changeset cfda47fb0a46 (bug 1546154)
Backed out changeset f3e005f5fedc (bug 1546154)
Backed out changeset 7f50fca0c2cd (bug 1546154)
Backed out changeset bbb0b25450f5 (bug 1546154)
2021-09-15 14:12:55 +03:00
Bob Owen f0d0b90897 Bug 1546154 p5: Remove CoInitializeEx call from TaskController. r=bas
Threads are implicitly members of the multi-threaded apartment and calls to
CoInitializeEx (and CoUninitializeEx) cause user32 to load.

Differential Revision: https://phabricator.services.mozilla.com/D124933
2021-09-15 10:21:05 +00:00
Florian Quèze dfecdf3297 Bug 1728866 - Remove the word 'thread' from TaskController thread names, r=bas.
Differential Revision: https://phabricator.services.mozilla.com/D124389
2021-09-09 20:21:45 +00:00
Gerald Squelart d44f7319af Bug 1722261 - Use AUTO_PROFILER_REGISTER_THREAD where possible - r=canaltinova
With the new ThreadRegistration classes, it becomes more important to properly balance registrations with unregistrations. Though mismatches are safely handled when they happen, in particular missing unregistrations can lead to leaks that make tests fail.

This patch changes `PROFILER_REGISTER_THREAD` in TaskController.cpp to `AUTO_PROFILER_REGISTER_THREAD`, to ensure that TaskController threads get unregistered when they're finished.

In AsyncLogger.h, a pair of `PROFILER_REGISTER_THREAD` and `PROFILER_UNREGISTER_THREAD` is converted to a single `AUTO_PROFILER_REGISTER_THREAD`. This is equivalent, but the latter is safer, in case the code in-between later changes to include early breaks or returns.

Differential Revision: https://phabricator.services.mozilla.com/D123228
2021-08-24 04:47:12 +00:00
Jon Coppeard 58e411d98d Bug 1717204 - Increase the number of threads used by the XPCOM thread pool to match the number of cores r=bas
Currently the XPCOM thead pool creates one less thread than the number of
cores. The JS helper thread pool creates an equal number.

I tested increasing the number of threads to match the number of cores and
found it resolved this regression.

Differential Revision: https://phabricator.services.mozilla.com/D118327
2021-06-23 14:09:18 +00:00
Jon Coppeard db60fbe73c Bug 1716940 - Increase TaskController thread stack size r=bas
This increases the stack size used for task controller threads to the size
previously used for JS helper threads. Some parsing use cases can use a lot of
stack.

Differential Revision: https://phabricator.services.mozilla.com/D118184
2021-06-17 16:14:20 +00:00
Jon Coppeard 39f6787517 Bug 1716940 - Pass external thread stack size through to the JS engine r=sfink,bas
This adds plumbing to make the JS engine set the stack quota based on the
actual stack size for external thread pool threads (and internal thread pool
ones).

The quota is calculated as 90% of the size, which is currently hardcoded into
the constants.

Differential Revision: https://phabricator.services.mozilla.com/D118183
2021-06-17 16:14:19 +00:00
Jon Coppeard e72b0f5573 Bug 1713287 - Change the number of threads TaskController creates to match those required by the JS engine r=bas
Currently parallel Wasm compilation requires at least two threads for
architectural reasons. This patch updates the TaskController thread policy such
that there are always two threads available, even on single core systems.

Differential Revision: https://phabricator.services.mozilla.com/D117002
2021-06-09 09:23:20 +00:00
Jon Coppeard 8e511303bb Bug 1704923 - Pass the number of threads when setting up an external thread pool r=sfink,bas
The JS helper thread system needs to know how many threads are available, in
particular because parallel Wasm compilation needs at least two threads to
avoid deadlock. This adds a method to get the count from TaskController and
passes it through to the JS engine when setting up the thread pool.

Differential Revision: https://phabricator.services.mozilla.com/D116220
2021-06-03 10:24:13 +00:00
Sandor Molnar a6483a7c7a Backed out 4 changesets (bug 1704923) for causing multiple failures in js::wasm::CompilerEnvironment::computeParameters. CLOSED TREE
Backed out changeset 498f9f3927f9 (bug 1704923)
Backed out changeset 9eabc7fc9b81 (bug 1704923)
Backed out changeset fedb48e21c75 (bug 1704923)
Backed out changeset 59c3af3d6e7f (bug 1704923)
2021-06-03 12:02:43 +03:00
Jon Coppeard 1794df3261 Bug 1704923 - Pass the number of threads when setting up an external thread pool r=sfink,bas
The JS helper thread system needs to know how many threads are available, in
particular because parallel Wasm compilation needs at least two threads to
avoid deadlock. This adds a method to get the count from TaskController and
passes it through to the JS engine when setting up the thread pool.

Differential Revision: https://phabricator.services.mozilla.com/D116220
2021-06-03 07:31:31 +00:00
Olli Pettay 662d5c8c34 Bug 1713320, ensure idle tasks get run, r=bas
If IdleTaskManager is suspended and non-idle task _is_run_, nothing seems to guarantee idle tasks get run later.
Calling UpdateCachedIdleDeadline triggers child->parent->child ipc messages if needed and ends up enabling
IdleTaskManager.

Differential Revision: https://phabricator.services.mozilla.com/D116316
2021-05-31 13:32:36 +00:00
Bas Schouten 4b6b949f59 Bug 1640852: Grab IVirtualDesktopManager object off the main thread on the creation of the first nsWindow. r=mikedeboer,aklotz
Differential Revision: https://phabricator.services.mozilla.com/D113446
2021-04-28 12:28:56 +00:00
Paul Bone 58add6dd74 Bug 1705320 - Fix some spelling errors r=mccr8 DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D112155
2021-04-15 13:32:46 +00:00
Sean Feng 2b9405bd6c Bug 1697585 - Make input tasks can be more strictly aligned with Vsync r=smaug
This patch introduces a new way to way to schedule input tasks, such
that input tasks remain at `InputHigh` priority normally, however, when
there's a pending `Vsync` priority task in the task queue, we
increase the priority of input tasks from `InputHigh` to `InputHighest` to
rush processing the pending input tasks.

There are two restrictions to ensure we don't delay vsync too much:
  - There's a hard limit duration
  - We won't process the input tasks that are newly added after we've
    started to process the current number of input tasks

Differential Revision: https://phabricator.services.mozilla.com/D109499
2021-04-14 19:56:42 +00:00
Sean Feng b543ad6b51 Bug 1697585 - Add VsyncTaskManager r=bas,smaug
Introduce a new TaskManager called VsyncTaskManager for
EventQueuePriority::Vsync tasks.

Differential Revision: https://phabricator.services.mozilla.com/D109498
2021-04-14 19:56:42 +00:00
Brindusan Cristian 2e90a569b4 Backed out 5 changesets (bug 1697585) for causing build bustages on nsTimerImpl.h. CLOSED TREE
Backed out changeset e9e4a710e7d1 (bug 1697585)
Backed out changeset bc271f42bcb7 (bug 1697585)
Backed out changeset d8516aec6a5e (bug 1697585)
Backed out changeset 0b1bc6cb84af (bug 1697585)
Backed out changeset 074ebebaee27 (bug 1697585)
2021-04-06 17:45:02 +03:00
Sean Feng e828222dac Bug 1697585 - Make input tasks can be more strictly aligned with Vsync r=smaug
This patch introduces a new way to way to schedule input tasks, such
that input tasks remain at `InputHigh` priority normally, however, when
there's a pending `Vsync` priority task in the task queue, we
increase the priority of input tasks from `InputHigh` to `InputHighest` to
rush processing the pending input tasks.

There are two restrictions to ensure we don't delay vsync too much:
  - There's a hard limit duration
  - We won't process the input tasks that are newly added after we've
    started to process the current number of input tasks

Differential Revision: https://phabricator.services.mozilla.com/D109499
2021-04-06 13:10:51 +00:00
Sean Feng 47ae9f1d7a Bug 1697585 - Add VsyncTaskManager r=bas,smaug
Introduce a new TaskManager called VsyncTaskManager for
EventQueuePriority::Vsync tasks.

Differential Revision: https://phabricator.services.mozilla.com/D109498
2021-04-06 13:10:51 +00:00
Florian Quèze 7ca337c131 Bug 1699742 - Remove MOZ_GECKO_PROFILER ifdefs that are no longer needed, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D109078
2021-03-22 16:29:52 +00:00
Bas Schouten bcaf884106 Bug 1691517: Do not crash inside TaskController when the main thread is unavailable. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D105402
2021-02-18 03:53:29 +00:00