[Jobs API]: Create study on Jobs API.
Ablation study to evaluate impact of Jobs API.
This CL splits job specific behavior in several features:
- worker wake up strategy (with additional serial strategy)
- yield
- fair scheduling
- priority update
Additional study specific to Jobs:
wakeup after getwork: This has the potential benefit of reducing lock
contention when workers wakeup.
Bug: 1139440
Change-Id: I5397977352650ee30557dc8972f32df34798b398
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481522
Commit-Queue: Etienne Pierre-Doray <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#820953}
diff --git a/base/task/task_features.h b/base/task/task_features.h
index 975bef4..335ad816 100644
--- a/base/task/task_features.h
+++ b/base/task/task_features.h
@@ -23,6 +23,34 @@
// instead of waiting for a threshold in the foreground thread group.
extern const BASE_EXPORT Feature kMayBlockWithoutDelay;
+// Under this feature, ThreadPool::ShouldYield() always returns false
+extern const BASE_EXPORT Feature kDisableJobYield;
+// Under this feature, JobTaskSource doesn't use worker count in its sort key
+// such that worker threads are not distributed among running jobs equally.
+extern const BASE_EXPORT Feature kDisableFairJobScheduling;
+// Under this feature, priority update on Jobs is disabled.
+extern const BASE_EXPORT Feature kDisableJobUpdatePriority;
+// Under this feature, another WorkerThread is signaled only after the current
+// thread was assigned work.
+extern const BASE_EXPORT Feature kWakeUpAfterGetWork;
+
+// Strategy affecting how WorkerThreads are signaled to pick up pending work.
+enum class WakeUpStrategy {
+ // A single thread scheduling new work signals all required WorkerThreads.
+ kCentralizedWakeUps,
+ // Each thread signals at most a single thread, either when scheduling new
+ // work or picking up pending work.
+ kSerializedWakeUps,
+ // Each thread signals at most 2 threads, either when scheduling new
+ // work or picking up pending work.
+ kExponentialWakeUps,
+};
+
+// Under this feature, a given WakeUpStrategy param is used.
+extern const BASE_EXPORT Feature kWakeUpStrategyFeature;
+extern const BASE_EXPORT base::FeatureParam<WakeUpStrategy>
+ kWakeUpStrategyParam;
+
#if defined(OS_WIN) || defined(OS_APPLE)
#define HAS_NATIVE_THREAD_POOL() 1
#else