xref: /aosp_15_r20/external/cronet/base/fuchsia/scheduler.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_FUCHSIA_SCHEDULER_H_
6 #define BASE_FUCHSIA_SCHEDULER_H_
7 
8 #include "base/strings/string_piece.h"
9 #include "base/time/time.h"
10 
11 namespace base {
12 
13 // Scheduling interval to use for realtime audio threads.
14 // TODO(crbug.com/1224707): Add scheduling period to Thread::Options and remove
15 // this constants.
16 constexpr TimeDelta kAudioSchedulingPeriod = Milliseconds(10);
17 
18 // Request 30% max CPU deadline utilization for an audio thread.
19 // TODO(crbug.com/1174811): A different value may need to be used for WebAudio
20 // threads (see media::FuchsiaAudioOutputDevice). A higher capacity may need to
21 // be allocated in that case.
22 constexpr float kAudioSchedulingCapacity = 0.3;
23 
24 // Scheduling interval to use for display threads.
25 // TODO(crbug.com/1224707): Add scheduling period to Thread::Options and remove
26 // this constants.
27 constexpr TimeDelta kDisplaySchedulingPeriod = Seconds(1) / 60;
28 
29 // Request 50% max CPU deadline utilization for a display thread.
30 // TODO(crbug.com/1181421): Currently DISPLAY priority is not enabled for any
31 // thread on Fuchsia. The value below will need to be fine-tuned when it's
32 // enabled.
33 const float kDisplaySchedulingCapacity = 0.5;
34 
35 }  // namespace base
36 
37 #endif  // BASE_FUCHSIA_SCHEDULER_H_
38