• Home
Name Date Size #Lines LOC

..--

common/include/07-Sep-2024-312184

figures/07-Sep-2024-

frameworks/core/07-Sep-2024-1,8961,482

interfaces/innerkits/07-Sep-2024-1,3111,031

profiles/07-Sep-2024-5134

qos_manager/07-Sep-2024-170117

test/07-Sep-2024-763504

BUILD.gnD07-Sep-2024809 2320

LICENSED07-Sep-20249.9 KiB179150

OAT.xmlD07-Sep-20245.5 KiB8433

README.mdD07-Sep-20245.5 KiB9160

README_zh.mdD07-Sep-20245 KiB11056

bundle.jsonD07-Sep-20243.4 KiB8584

frameaware.gniD07-Sep-2024590 1412

README.md

1# The Part of Frame Aware Sched
2
3-   [ Introduction](#section_introduction)
4-   [ Directory Structure](#section_catalogue)
5-   [Framework](#section_framework)
6    -   [The component of Frame Information Collection ](#section_collection)
7    -   [The component of Frame Aware Policy](#section_policy)
8-   [ Usage Guidelines](#section_usage)
9-   [ Repositories Involved](#section_projects)
10
11##  Introduction<a name="section_introduction"></a>
12
13The part of Frame Aware Sched belongs to subsystem named *Resource Schedule Subsystem*.
14
15In order to ensure the cpu scheduling supply, it updates the process scheduling groups and adjust the kernel schedule parameters to influence the kernel scheduling behavior according to the information of the application frame drawing and the application life cycle status.
16
17##  Directory Structure<a name="section_catalogue"></a>
18
19```
20//foundation/resourceschedule/frame_aware_sched
21├── common                                  # common tool class of the component
22│   └── include
23│       ├── frame_info_const.h              # frame drawing process information
24│       ├── frame_aware_constants.h         # general parameter configuration
25│       ├── frame_aware_log_domain.h        # encapsulates hilog for log printing
26│       └── single_instance.h               # class template encapslating singleton mode
2728├── interfaces
29│   └── innerkits                           # directory of internal interfaces
3031├── frameworks
32│   └── core
33│       ├── frame_aware_collector           # frame information collector in apps
34│       └── frame_aware_policy              # components of the frame_aware_sched mechanism
3536├── profiles                                # component configuration file
37└── test                                    # directory for storing self-test cases.
38```
39## Framework<a name="section_framework"></a>
40
41According to the thread it belongs to during execution, the *Farme Aware Sched* is devided into two parts, which are *Frame Aware Collector* and *Frame Aware Policy*. The framework is shown in the following picture.
42
43- *Frame Aware Collector*: which is the core strategy of drawing frames, including frame event processing module, slide scene strategy module, and model processing module.
44
45  Module-frame event processing : responsible for coordinating and dispatching the message information of the frame drawing sub-process of the JS-UI subsystem and the Graphic subsystem.
46
47  Module-slide scene strategy: responsible for the sliding scene recognize and provide the scenario-based fine scheduling by the interface of the model processing module.
48
49  Module-model processing module: responsible for providing the adjustment and scheduling algorithm of each sub-process.
50
51- *Frame Aware Policy*: which is consists of four part: event processing module, application management module, and RTG (Related-Thread-Group) management module and scheduling parameter control module.
52
53  Module-Application state event processing: which is responsible for registering and receiving messages from the global resource management and control subsystem, such as application state switch, window focus state change, etc, and distributing messages to the application management and control module and RTG grouping module.
54
55  Module-Application management: responsible for the unified management of the application messages of the event processing module.
56
57  Module-RTG Managerment: the kernel interface set, sets the RTG accoding to the application state to realize thread scheduling management.
58
59  Module-Scheduling Parameter Control:responsible for reading the default scheduling prameter configuration.
60
61![](figures/zh-cn_image_fwk.png)
62
63### The component of Frame Information Collection<a name="section_collection"></a>
64
65The *frame information collection* is mainly responsible for adjusting the parameters of kernel scheduling and scaling the thread load. When the user slides on the application, it recognizes the key threads (such as draw frame thread and render thread) ,  perceives the sub-process of the application frame drawing, and adjust the kernel scheduling parameters according to the task timeout status to perform real-time resources.
66
67- According to the screen refresh rate, it analyze the current frame rate information.  The resource supply of key threads is increased according to the time to end of the drawing frame.
68- Adjust resource supply according to the duration of each sub-process during graphics rendering process.
69- Adjust resource supply for frame sub-process  task with high frame loss rate.
70
71### The component of Frame Aware Policy<a name="section_Policy"></a>
72
73As the basis for the realization of application frame perception, the *frame aware policy* is mainly reposible for controlling thread groups and thread priorities, realizing the unified management of application threads and ensuring the performance of the entire system.
74
75###  Usage Guidelines<a name="section_usage"></a>
76
77System developers can add or remove this part by configuring the product definition JSON file under **/productdefine/common/products** to enable or disable this part:
78
79` "resourceschedule:frame_aware_sched":{} `
80
81##  Repositories Involved<a name="section_projects"></a>
82
83- [resource_schedule_service](https://gitee.com/openharmony/resourceschedule_resource_schedule_service)
84- [ace_ace_engine]( https://gitee.com/openharmony/ace_ace_engine)
85- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
86- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard )
87- **frame_aware_sched**
88
89
90
91

README_zh.md

1# 智能感知调度部件
2
3
4
5## 简介<a name="section_introduction"></a>
6
7智能感知调度部件位于全局资源调度管控子系统中,通过帧感知调度机制,更新进程调度分组。通过获取应用的生命周期状态、应用绘帧等信息,调节内核调度参数,从而控制内核调度行为,保障系统进程调度供给。
8
9
10
11## 目录<a name="section_catalogue"></a>
12
13```
14//foundation/resourceschedule/frame_aware_sched
15├── common                                  # 部件通用工具类
16│   └── include
17│       ├── frame_info_const.h              # 绘帧过程信息
18│       ├── frame_aware_constants.h         # 通用参数配置
19│       ├── frame_aware_log_domain.h        # 封装hilog,用于日志打印
20│       └── single_instance.h               # 封装了单例模式的类模板
2122├── interfaces
23│   └── innerkits                           # 对内接口目录
2425├── frameworks
26│   └── core
27│       ├── frame_aware_collector           # 应用绘帧信息收集组件
28│       └── frame_aware_policy              # 帧感知调度机制组件
2930├── profiles                                # 组件配置文件
31└── test                                    # 自测试用例目录
32```
33
34
35## 框架<a name="section_frameworks"></a>
36
37智能感知调度部件根据执行时所属线程进行划分,可包含两大组件,即运行在App进程的绘帧信息收集组件和运行在系统服务进程的帧感知调度机制组件,每个组件分为若干模块。
38
39- **绘帧信息收集组件**:主要分为帧事件处理模块、滑动场景策略模块以及模型处理模块,三者构成绘帧核心策略。其中:
40
41  绘帧事件处理模块,主要负责统筹JS-UI子系统及Graphic子系统的绘帧子过程的消息信息并分发。
42
43  模型处理模块,主要负责提供各个子过程的调节调度算法。
44
45  滑动场景策略模块,主要负责针对滑动场景,使用模型处理模块的算法接口提供应用主线程绘帧策略,进行场景化精细调度。
46
47- **帧感知调度机制组件**:主要分为事件处理模块、应用管控模块、调度参数管控模块和RTG(Related-Thread-Group)分组管理模块,四者构成应用线程调度机制。其中:
48
49  事件处理模块,主要负责注册接收来自全局资源管控子系统的消息,诸如应用前后台切换、窗口焦点变化等,并分发消息给应用管控模块和RTG分组模块。
50
51  应用管控模块,主要负责统一管理事件处理模块的应用消息。
52
53  RTG分组管理模块,即调用内核接口设置,根据应用状态设置RTG分组实现线程调度管理。
54
55  调度参数管控模块,主要负责读取默认调度参数配置。
56
57两个组件中的事件处理模块,均统筹了智能感知调度部件所要对外相应的事件,而调度特性内核接口模块则负责将管控调度命令以帧的频率下发,两个组件相互合作,共同保障系统线程的性能供给。
58
59![](figures/zh-cn_image_fwk.png)
60
61
62
63### 绘帧信息收集<a name="section_strategy"></a>
64
65应用绘帧感知主要负责调节内核调度的参数,进行线程负载的缩放。当用户在APP界面滑动时,识别出应用的关键线程(诸如绘帧主线程、渲染线程),感知应用绘帧子过程的执行情况,根据是否超时来判断是否调整内核调度参数,进行实时的资源供给,进行优先调度。
66
67- 根据屏幕刷新率,判断当前帧率信息,根据越接近绘帧结束时刻,越加大关键线程的资源供给。
68
69
70- 根据界面绘帧图形渲染过程中的各个子阶段的时长,调节资源供给。
71
72
73- 对可能发生丢帧卡顿的高概率事件,增加资源供给。
74
75
76
77
78### 帧感知调度机制<a name="section_mechanism"></a>
79
80应用线程调度机制,作为应用绘帧感知实现的基础,主要负责管控线程组及线程优先级,实现应用线程的统一管理,保证整个系统性能。
81
82**核心思想**:分组,即根据不同线程组提供不同的供给能力。把用户敏感度线程添加进同一个线程组,在应用启动、前后台切换等多个应用变化场景,提供资源优先供给。
83
84
85
86## 使用说明<a name="section_instructions"></a>
87
88系统开发者可以通过配置productdefine/common/products下的产品定义json文件,增加或移除本部件,来启用或停用本部件:
89
90```
91"resourceschedule:frame_aware_sched":{}
92```
93
94
95
96## 相关仓<a name="section_related_repositories"></a>
97
98- [resource_schedule_service](https://gitee.com/openharmony/resourceschedule_resource_schedule_service)
99- [ace_ace_engine]( https://gitee.com/openharmony/ace_ace_engine)
100- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
101- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard )
102- **frame_aware_sched**
103
104
105
106
107
108
109
110