1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FFRT_FRAME_INTERVAL
17 #define FFRT_FRAME_INTERVAL
18 
19 #include "sched/interval.h"
20 #include "sched/workgroup_internal.h"
21 
22 namespace ffrt {
23 enum class IntervalState {
24     DEADLINE_BEGIN,
25     DEADLINE_END
26 };
27 
28 class FrameInterval : public Interval {
29 public:
30     FrameInterval(uint64_t deadline, const QoS& qos);
31     ~FrameInterval() override;
32 
Qos()33     const QoS& Qos() const override
34     {
35         return qos;
36     }
37 
38     int Begin() override;
39 
40     void End() override;
41 
42     void Join() override;
43 
Leave()44     void Leave() override
45     {
46     }
47 
Update(uint64_t deadlineUs)48     void Update(uint64_t deadlineUs) override
49     {
50     }
51 
CheckPoint()52     void CheckPoint() override
53     {
54     }
55 
56 private:
57     struct WorkGroup* wg = nullptr;
58     bool isBegun = false;
59     QoS qos;
60 
61     void OnQoSIntervals(IntervalState state);
62 };
63 } // namespace ffrt
64 
65 #endif
66