From b6c3c82decb155565e0d64c9f1c99dd6231bd7e1 Mon Sep 17 00:00:00 2001 From: fly_1997 Date: Mon, 16 Jun 2025 10:22:23 +0800 Subject: [PATCH] =?UTF-8?q?update=20docs/zh/oeAware/oeAware=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=8C=87=E5=8D=97.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\346\210\267\346\214\207\345\215\227.md" | 730 +++++++++++------- 1 file changed, 472 insertions(+), 258 deletions(-) diff --git "a/docs/zh/docs/oeAware/oeAware\347\224\250\346\210\267\346\214\207\345\215\227.md" "b/docs/zh/docs/oeAware/oeAware\347\224\250\346\210\267\346\214\207\345\215\227.md" index 74daafefc..cde8a0a53 100644 --- "a/docs/zh/docs/oeAware/oeAware\347\224\250\346\210\267\346\214\207\345\215\227.md" +++ "b/docs/zh/docs/oeAware/oeAware\347\224\250\346\210\267\346\214\207\345\215\227.md" @@ -14,7 +14,7 @@ yum install oeAware-manager ## 使用方法 -首先启动oeaware服务,然后通过oeawarectl命令进行使用。 +首先启动oeaware服务,然后通过`oeawarectl`命令进行使用。 ### 服务启动 @@ -24,21 +24,21 @@ yum install oeAware-manager systemctl start oeaware ``` -配置文件 +### 配置文件 -配置文件路径:/etc/oeAware/config.yaml +配置文件路径:/etc/oeAware/config.yaml ```yaml log_path: /var/log/oeAware #日志存储路径 -log_level: 1 #日志等级 1:DUBUG 2:INFO 3:WARN 4:ERROR +log_level: 1 #日志等级 1:DEBUG 2:NFO 3:WARN 4:ERROR enable_list: #默认使能插件 - - name: libtest.so #只配置插件,使能本插件的所有实例 - - name: libtest1.so #配置插件实例,使能配置的插件实例 - instances: - - instance1 - - instance2 - ... - ... + - name: libtest.so #只配置插件,使能本插件的所有实例 + - name: libtest1.so #配置插件实例,使能配置的插件实例 + instances: + - instance1 + - instance2 + ... + ... plugin_list: #可支持下载的包 - name: test #名称需要唯一,如果重复取第一个配置 description: hello world @@ -58,25 +58,12 @@ systemctl restart oeaware **实例定义**:服务中的调度单位是实例,一个插件中包括多个实例。例如,一个采集插件包括多个采集项,每个采集项是一个实例。 -**实例之间依赖关系** - -每个实例运行前,需要满足其依赖关系。 - -![img](./figures/依赖关系.png) - -- 采集实例不依赖任何其他实例。 - -- 感知实例依赖采集实例和其他感知实例。 - -- 调优实例依赖采集实例、感知实例和其他调优实例。 - ### 插件加载 服务会默认加载插件存储路径下的插件。 插件路径:/usr/lib64/oeAware-plugin/ - 另外也可以通过手动加载的方式加载插件。 ```shell @@ -119,49 +106,88 @@ oeawarectl --query <插件名> #查询指定插件 示例 ```shell -[root@localhost ~]# oeawarectl -q Show plugins and instances status. ------------------------------------------------------------ -libthread_collector.so - thread_collector(available, close) libpmu.so - pmu_cycles_sampling(available, close) - pmu_cycles_counting(available, close) - pmu_uncore_counting(available, close) - pmu_spe_sampling(available, close) -libthread_tune.so - thread_tune(available, close) + pmu_counting_collector(available, close, count: 0) + pmu_sampling_collector(available, close, count: 0) + pmu_spe_collector(available, close, count: 0) + pmu_uncore_collector(available, close, count: 0) +libsystem_collector.so + thread_collector(available, close, count: 0) + kernel_config(available, close, count: 0) + command_collector(available, close, count: 0) + env_info_collector(available, close, count: 0) + net_interface_info(available, close, count: 0) +libdocker_collector.so + docker_collector(available, close, count: 0) +libub_tune.so + unixbench_tune(available, close, count: 0) +libsystem_tune.so + stealtask_tune(available, close, count: 0) + dynamic_smt_tune(available, close, count: 0) + smc_tune(available, close, count: 0) + xcall_tune(available, close, count: 0) + transparent_hugepage_tune(available, close, count: 0) + seep_tune(available, close, count: 0) + preload_tune(available, close, count: 0) + binary_tune(available, close, count: 0) + numa_sched_tune(available, close, count: 0) + realtime_tune(available, close, count: 0) + net_hard_irq_tune(available, close, count: 0) + multi_net_path_tune(available, close, count: 0) +libdocker_tune.so + docker_cpu_burst(available, close, count: 0) + docker_burst(available, close, count: 0) libthread_scenario.so - thread_scenario(available, close) + thread_scenario(available, close, count: 0) +libanalysis_oeaware.so + hugepage_analysis(available, close, count: 0) + dynamic_smt_analysis(available, close, count: 0) + smc_d_analysis(available, close, count: 0) + xcall_analysis(available, close, count: 0) + net_hirq_analysis(available, close, count: 0) + numa_analysis(available, close, count: 0) + docker_coordination_burst_analysis(available, close, count: 0) + microarch_tidnocmp_analysis(available, close, count: 0) ------------------------------------------------------------ format: [plugin] - [instance]([dependency status], [running status]) + [instance]([dependency status], [running status], [enable cnt]) dependency status: available means satisfying dependency, otherwise unavailable. running status: running means that instance is running, otherwise close. +enable cnt: number of instances enabled. ``` 失败返回错误说明。 -#### 查询插件依赖 +#### 查询调优实例信息 ```shell -oeawarectl -Q #查询已加载实例的依赖关系图 -oeawarectl --query-dep= <插件实例> #查询指定实例依赖关系图 +oeawarectl --info ``` -在当前目录下生成dep.png,显示依赖关系。 +显示调优实例描述信息及运行状态。 -示例 +#### 查询运行实例订阅关系 -依赖满足下的关系图。 -![img](./figures/dep.png) +```shell +oeawarectl -Q #查询所有运行实例的订阅关系图 +oeawarectl --query-dep= <插件实例> #查询运行实例订阅关系图 +``` -缺少依赖的关系图。 +在当前目录下生成dep.png,显示订阅关系。 -![img](./figures/dep-failed.png) +实例未运行,不会显示订阅关系。 -失败返回错误说明。 +示例 + +```sh +oeawarectl -e thread_scenario +oeawarectl -Q +``` + +![img](./figures/dep.png) ### 插件实例使能 @@ -171,22 +197,40 @@ oeawarectl --query-dep= <插件实例> #查询指定实例依赖关系图 oeawarectl -e | --enable <插件实例> ``` -使能某个插件实例,会将其依赖的实例一起使能。 +使能某个插件实例,会将其订阅的topic实例一起使能。 失败返回错误说明。 +通过以下命令查询调优实例 + +```sh +oeawarectl --info +``` + +其他插件主要用来提供数据和分析,可通过sdk获取插件数据。 + +带参数实例使能 + +```sh +oeawarectl -e xcall_tune # -c [path] 可选参数-c,使用path下的配置文件 +oeawarectl -e dynamic_smt_tune # -threshold [number] 可选参数-threshold,设置cpu利用率阈值 +oeawarectl -e multi_net_path_tune -ifname [name] # 必选参数-ifname,网卡亲和的接口名;可选参数-appname,生效进程;可选参数-matchip,是否强制匹配ip,默认true,自动匹配ip;可选参数-mode,支持模式0和模式1。依赖特定网卡(支持ntuple) +oeawarectl -e docker_burst # -docker_id [id1,id2...] 设置dockerid;-ratio 设置超分比例,默认20% +``` + #### 关闭插件实例 ```shell oeawarectl -d | --disable <插件实例> ``` -关闭某个插件实例,会将其依赖的实例(无其他实例依赖)一起关闭。 + +关闭某个插件实例,会将其订阅的topic实例一起关闭。 失败返回错误说明。 ### 插件下载安装 -通过--list命令查询支持下载的rpm包和已安装的插件。 +通过`--list`命令查询支持下载的rpm包和已安装的插件。 ```shell oeawarectl --list @@ -205,301 +249,471 @@ Installed Plugins: #已安装的插件 ... ``` -通过--install命令下载安装rpm包。 +通过`--install`命令下载安装rpm包。 ```shell -oeawarectl -i | --install #指定--list下查询得到的包名称(Supported Packages下的包) +oeawarectl -i | --install #指定--list下查询得到的包名称(Supported Packages下的包) ``` 失败返回错误说明。 -### 帮助 -通过--help查看帮助。 -```shell -usage: oeawarectl [options]... - options - -l|--load [plugin] load plugin. - -r|--remove [plugin] remove plugin from system. - -e|--enable [instance] enable the plugin instance. - -d|--disable [instance] disable the plugin instance. - -q query all plugins information. - --query [plugin] query the plugin information. - -Q query all instances dependencies. - --query-dep [instance] query the instance dependency. - --list the list of supported plugins. - -i|--install [plugin] install plugin from the list. - --help show this help message. -``` - -## 插件开发 - -### 插件公共数据结构 - -```c -struct DataBuf { - int len; - void *data; -}; -``` - -struct DataBuf 即数据的buf。 - -- data:具体的数据,data是一个数组,data的类型可以由插件的开发者自行定义。 -- len:data的大小。 - -```c -struct DataRingBuf { - const char *instance_name; - int index; - uint64_t count; - struct DataBuf *buf; - int buf_len; -}; -``` - -struct DataRingBuf 即插件和插件之间传递数据的结构,里面主要是一个循环的buf。 - -- instance_name :传入的数据的实例名称。例如当数据传递到感知插件时,用来区分是哪个采集插件的哪个采集项。 -- index: 表示当前写入数据的位置。例如某一次数据采集后,index++。 +### 分析模式 -- count:实例的执行次数,一直累加。 - -- buf: 数据的buf。例如某些采集项要采样多次后才会被感知插件使用,所以用buf数组保存。 - -- buf_len:数据buf的大小。buf_len在数据buf初始化申请后是固定值。 - -```C -struct Param { - const struct DataRingBuf **ring_bufs; - int len; -}; -``` -- ring_bufs:实例需要的数据,来自其他实例。 -- len:ring_bufs数组的长度。 -### 实例接口 - -```C -struct Interface { - const char* (*get_version)(); - /* The instance name is a unique identifier in the system. */ - const char* (*get_name)(); - const char* (*get_description)(); - /* Specifies the instance dependencies, which is used as the input information - * for instance execution. - */ - const char* (*get_dep)(); - /* Instance scheduling priority. In a uniform time period, a instance with a - * lower priority is scheduled first. - */ - int (*get_priority)(); - int (*get_type)(); - /* Instance execution period. */ - int (*get_period)(); - bool (*enable)(); - void (*disable)(); - const struct DataRingBuf* (*get_ring_buf)(); - void (*run)(const struct Param*); -}; -``` +```sh +oeawarectl analysis -h +usage: oeawarectl analysis [options]... + options + -t|--time set analysis duration in seconds(default 30s), range from 1 to 100. + -r|--realtime show real time report. + -v|--verbose show verbose information. + -h|--help show this help message. + --l1-miss-threshold set l1 tlbmiss threshold. + --l2-miss-threshold set l2 tlbmiss threshold. + --out-path set the path of the analysis report. + --dynamic-smt-threshold set dynamic smt cpu threshold. + --pid set the pid to be analyzed. + --numa-thread-threshold set numa sched thread creation threshold. + --smc-change-rate set smc connections change rate threshold. + --smc-localnet-flow set smc local net flow threshold. + --host-cpu-usage-threshold set host cpu usage threshold. + --docker-cpu-usage-threshold set docker cpu usage threshold. -```c -int get_instance(Interface **interface); ``` -每个插件都有一个get_instance函数,用来向框架输入实例。 - -获取版本号 - -1. 接口定义 - - ```c - const char* (*get_version)(); - ``` +--l1-miss-threshold:l1-tlb—miss阈值,超过阈值,推荐使用大页。 -2. 接口说明 +--l2-miss-threshold:l2-tlb—miss阈值,超过阈值,推荐使用大页。 -3. 参数说明 +--out-path:分析报告输出路径。 -4. 返回值说明 +--dynamic-smt-threshold:smt cpu利用率阈值,cpu利用率小于此阈值推荐使用smt。 - 返回具体的版本号,预留。 +--numa-thread-threshold:线程创建数阈值,每秒的线程创建数高于此值时,推荐numa调优。 -获取实例名称 +--smc-change-rate:tcp连接状态变化率阈值。变化率低于阈值时,推荐smc-d。 -1. 接口定义 +--smc-localnet-flow:本地网络流量阈值。流量高于阈值时,推荐smc-d。 - ```c - const char* (*get_name)(); - ``` +--host-cpu-usage-threshold:host cpu利用率阈值。host cpu利用率低于阈值时,推荐docker burst。 -2. 接口说明 +--docker-cpu-usage-threshold:docker cpu利用率阈值。docker容器cpu高于阈值时,推荐docker burst。 - 获取实例名称,客户端`-q`命令查询时会显示实例名称,同时`--enable`命令能够使能该实例。 +通过配置文件或者命令行参数设置相关阈值参数。 -3. 参数说明 +配置文件/etc/oeAware/analysis_config.yaml -4. 返回值说明 - - 返回具体的实例名称,必须保证实例名称唯一。 - -获取描述信息 - -1. 接口定义 +```yaml +#default analysis config +timeout: 5 # Client wait timeout +dynamic_smt: + threshold: 40.0 # Value range:[0,100]. + +hugepage: + l1_miss_threshold: 5.0 # Value range:[0,100]. + l2_miss_threshold: 10.0 # Value range:[0,100]. + +numa_analysis: + thread_threshold: 200 # thread count threshold to use numa native schedule. Value must be a non-negative integer. + +smc_d_analysis: + change_rate: 0.1 # Value must be a non-negative number. + local_net_flow: 100 # MB/S + +docker_coordination_burst: + host_cpu_usage_threshold: 45 # Value range:[0,100]. + docker_cpu_usage_threshold: 95 # Value range:[0,100]. + +microarch_tidnocmp: + service_list: + - mysqld # Supported service. The default value is mysqld. + cpu_part: + - 0xd02 +xcall_analysis: + threshold: 5 # Kernel cpu usage, value range:[0,100]. + num: 5 # top num syscall , value must be a non-negative integer. - ```c - const char* (*get_description)(); - ``` +``` -2. 接口说明 +示例 -3. 参数说明 +执行以下命令,输出系统分析报告。 -4. 返回值说明 +```sh +oeawarectl analysis -t 10 +``` - 返回具体的描述信息,预留。 +报告分为三部分: -获取类型 +- Data Analysis:根据系统运行状态,给出系统性能数据分析。 +- Analysis Conclusion:给出系统分析结论。 +- Analysis Suggestion:给出具体调优方法。 -1. 接口定义 +说明: - ```c - int (*get_type)(); - ``` +- uncore_ops_num_per_second:每秒访存操作数,超过2000000次属于高访存。 +- remote_access_ratio:远端访存占比,超过5%,远端访存占比高。 -2. 接口说明 +### 帮助 -3. 参数说明 +通过`--help`查看帮助。 -4. 返回值说明 +```shell +usage: oeawarectl [options]... + options + analysis run analysis mode. + -l|--load [plugin] load plugin. + -r|--remove [plugin] remove plugin from system. + -e|--enable [instance] enable the plugin instance. + -d|--disable [instance] disable the plugin instance. + -q query all plugins information. + --query [plugin] query the plugin information. + -Q query all instances dependencies. + --query-dep [instance] query the instance dependency. + --list the list of supported plugins. + --info the list of InfoCmd plugins. + -i|--install [plugin] install plugin from the list. + --help show this help message. +``` - 返回具体的类型信息,预留。 +## 插件开发说明 -获取优先级 +### 基础数据结构 -1. 接口定义 +```c++ +typedef struct { + char *instanceName; // 实例名称 + char *topicName; // 主题名称 + char *params; // 参数 +} CTopic; - ```C - int (*get_priority)(); - ``` - -2. 接口说明 +typedef struct { + CTopic topic; + unsigned long long len; // data数组的长度 + void **data; // 存储的数据 +} DataList; - 获取实例优先级。在同一执行周期内,值越小优先级越高。 +const int OK = 0; +const int FAILED = -1; -3. 参数说明 +typedef struct { + int code; // 成功返回OK,失败返回FAILED + char *payload; // 附带信息 +} Result; -4. 返回值说明 +``` - 优先级的值。 +### 实例基类 + +```c++ +namespace oeaware { +// Instance type. +const int TUNE = 0b10000; +const int SCENARIO = 0b01000; +const int RUN_ONCE = 0b00010; +class Interface { +public: + virtual Result OpenTopic(const Topic &topic) = 0; + virtual void CloseTopic(const Topic &topic) = 0; + virtual void UpdateData(const DataList &dataList) = 0; + virtual Result Enable(const std::string ¶m = "") = 0; + virtual void Disable() = 0; + virtual void Run() = 0; +protected: + std::string name; + std::string version; + std::string description; + std::vector supportTopics; + int priority; + int type; + int period; +} +} +``` -获取采样周期 +实例开发继承实例基类,实现6个虚函数,并对类的7个属性赋值。 + +实例采用订阅发布模式,通过Subscribe获取数据,通过Publish接口发布数据。 + +### 属性说明 + +| 属性 | 类型 | 说明 | +| --- | --- | --- | +| name | string | 实例名称 | +| version | string | 实例版本(预留) | +| description | string | 实例描述 | +| supportTopics | vector\ | 支持的topic | +| priority | int | 实例执行的优先级 (调优 > 感知 > 采集)| +| type | int | 实例类型,通过比特位标识,第二位表示单次执行实例,第三位表示采集实例,第四位表示感知实例,第5位表示调优实例| +| period | int | 实例执行周期,单位ms,period为10的倍数 | + +### 接口说明 + +| 函数名 | 参数 | 返回值 | 说明 | +| --- | --- | --- | --- | +|Result OpenTopic(const Topic &topic) | topic:打开的主题 | | 打开对应的topic | +| void CloseTopic(const Topic &topic) | topic:关闭的主题| |关闭对应的topic | +| void UpdateData(const DataList &dataList) | dataList:订阅的数据 | | 当订阅topic时,被订阅的topic每周期会通过UpdateData更新数据 | +| Result Enable(const std::string ¶m = "") | param:预留 | | 使能本实例 | +| void Disable() | | | 关闭本实例 | +| void Run() | | | 每周期会执行run函数 | + +### 实例示例 + +```C++ +#include +#include + +class Test : public oeaware::Interface { +public: + Test() { + name = "TestA"; + version = "1.0"; + description = "this is a test plugin"; + supportTopics; + priority = 0; + type = 0; + period = 20; + } + oeaware::Result OpenTopic(const oeaware::Topic &topic) override { + return oeaware::Result(OK); + } + void CloseTopic(const oeaware::Topic &topic) override { + + } + void UpdateData(const DataList &dataList) override { + for (int i = 0; i < dataList.len; ++i) { + ThreadInfo *info = static_cast(dataList.data[i]); + INFO(logger, "pid: " << info->pid << ", name: " << info->name); + } + } + oeaware::Result Enable(const std::string ¶m = "") override { + Subscribe(oeaware::Topic{"thread_collector", "thread_collector", ""}); + return oeaware::Result(OK); + } + void Disable() override { + + } + void Run() override { + DataList dataList; + oeaware::SetDataListTopic(&dataList, "test", "test", ""); + dataList.len = 1; + dataList.data = new void* [1]; + dataList.data[0] = &pubData; + Publish(dataList); + } +private: + int pubData = 1; +}; -1. 接口定义 +extern "C" void GetInstance(std::vector> &interfaces) +{ + interfaces.emplace_back(std::make_shared()); +} +``` - ```c - int (*get_period)(); - ``` +## 内部插件 -2. 接口说明 +### libpmu.so - 获取执行周期,不同的实例可以使用不同的执行周期。 +| 实例名称 | 架构 | 说明 | topic | +| --- | --- | --- | --- | +| pmu_counting_collector | aarch64 | 采集count相关事件 |cycles,net:netif_rx,L1-dcache-load-misses,L1-dcache-loads,L1-icache-load-misses,L1-icache-loads,branch-load-misses,branch-loads,dTLB-load-misses,dTLB-loads,iTLB-load-misses,iTLB-loads,cache-references,cache-misses,l2d_tlb_refill,l2d_cache_refill,l1d_tlb_refill,l1d_cache_refill,inst_retired,instructions | +| pmu_sampling_collector | aarch64 | 采集sample相关事件 | cycles, skb:skb_copy_datagram_iovec,net:napi_gro_receive_entry | +| pmu_spe_collector | aarch64 | 采集spe事件 | spe | +| pmu_uncore_collector | aarch64 | 采集uncore事件 | uncore | -3. 参数说明 +#### 限制条件 -4. 返回值说明 +采集spe事件需要依赖硬件能力,此插件运行依赖 BIOS 的 SPE,运行前需要将 SPE 打开。 - 返回具体的执行周期,单位是ms。 +运行perf list | grep arm_spe查看是否已经开启SPE,如果开启,则有如下显示: -获取依赖 +```sh +arm_spe_0// [Kernel PMU event] +``` -1. 接口定义 +如果没有开启,则按下述步骤开启。 - ```c - const char* (*get_dep)(); - ``` +检查BIOS配置项 MISC Config --> SPE 的状态, 如果状态为 Disable,则需要更改为 Enable。如果找不到这个选项,可能是BIOS版本过低。 -2. 接口说明 +进入系统 vim /boot/efi/EFI/openEuler/grub.cfg,定位到内核版本对应的开机启动项,在末尾增加“kpti=off”。例如: -3. 参数说明 +```sh +linux /vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 root=/dev/mapper/openeuler-root ro rd.lvm.lv=openeuler/root rd.lvm.lv=openeuler/swap video=VGA-1:640x480-32@60me rhgb quiet smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 crashkernel=1024M,high video=efifb:off video=VGA-1:640x480-32@60me kpti=off +``` -4. 返回值说明 +按“ESC”,输入“:wq”,按“Enter”保存并退出。执行reboot命令重启服务器。 - 返回依赖的实例名称。若有多个依赖实例,则用`-`连接。比如实例C依赖实例”A“和实例”B“,则返回”A-B“(实例名称不允许含有“-”字符)。 +### libsystem_collector.so -使能实例 +系统信息采集插件。 +| 实例名称 | 架构 | 说明 | topic | +| --- | --- | --- | --- | +| thread_collector | aarch64/x86 | 采集系统中的线程信息 | thread_collector | +| kernel_config | aarch64/x86| 采集内核相关参数,包括sysctl所有参数、lscpu、meminfo等 | get_kernel_config,get_cmd,set_kernel_config | +| command_collector | aarch64/x86 | 采集sysstat相关数据 | mpstat,iostat,vmstat,sar,pidstat | +| net_interface_info | aarch64/x86 | 采集网络信息 | base,driver,local_net_affinity,net_thread_que_data | +| env_info_collector | aarch64/x86 | 采集系统信息 | static,realtime,cpu_util | -1. 接口定义 +### libdocker_collector.so - ```c - bool (*enable)(); - ``` +docker信息采集插件。 +| 实例名称 | 架构 | 说明 | topic | +| --- | --- | --- | --- | +| docker_collector | aarch64/x86 | 采集docker相关信息 | docker_collector | -2. 接口说明 +### libthread_scenario.so - 使能实例。实例执行前的初始化。 +线程感知插件。 +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| thread_scenario | aarch64/x86 | 通过配置文件获取对应线程信息 | thread_collector::thread_collector | -3. 参数说明 +#### 配置文件 -4. 返回值说明 +thread_scenario.conf - 使能成功返回true,失败时返回false。 +```sh +redis +fstime +fsbuffer +fsdisk +``` -关闭实例 +### libanalysis_oeaware.so + +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| hugepage_analysis | aarch64 | 分析是否推荐大页 | pmu_counting_collector::l1d_tlb,pmu_counting_collector::l1d_tlb_refill,pmu_counting_collector::l1i_tlb,pmu_counting_collector::l1i_tlb_refill,pmu_counting_collector::l2d_tlb,pmu_counting_collector::l2d_tlb_refill,pmu_counting_collector::l2i_tlb,pmu_counting_collector::l2i_tlb_refill | +| dynamic_smt_analysis | aarch64 | 分析是否推荐smt | env_info_collector::cpu_util | +| smc_d_analysis | aarch64 | 分析是否推荐smc-d | | +| xcall_analysis | aarch64 | 分析是否推荐xcall | env_info_collector::cpu_util,thread_collector::thread_collector | +| net_hirq_analysis | aarch64 | 分析是否推荐网卡中断调优 | pmu_sampling_collector::net:napi_gro_receive_entry | +| numa_analysis | aarch64 | 分析是否推荐numa调优 | pmu_counting_collector::sched:sched_process_fork,pmu_counting_collector::sched:sched_process_exit,pmu_uncore_collector::uncore | +| docker_coordination_burst_analysis | aarch64 | 分析是否推荐docker burst | env_info_collector::cpu_util, pmu_sampling_collector::cycles,docker_collector::docker_collector | +| microarch_tidnocmp_analysis | aarch64 | 分析是否推荐微架构调优 | thread_collector::thread_collector | + +### libsystem_tune.so + +系统调优插件。 +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| stealtask_tune | aarch64 | 高负载场景下,通过轻量级搜索算法,实现多核间快速负载均衡,最大化cpu资源利用率 | 无 | +| smc_tune | aarch64 | 使能smc加速,对使用tcp协议的连接无感加速 | 无 | +| xcall_tune | aarch64 | 通过减少系统调用底噪,提升系统性能 | thread_collector::thread_collector | +| seep_tune | aarch64 | 使能智能功耗模式,降低系统能耗 | 无 | +| transparent_hugepage_tune | aarch64/x86 | 开启透明大页,降低tlbmiss | 无 | +| preload_tune | aarch64 | 无感加载动态库 | 无 | +| dynamic_smt_tune | aarch64 | 使能超线程 | 无 | +| binary_tune | aarch64 | 容器内进程调度优化 | env_info_collector::static,env_info_collector::realtime,thread_collector::thread_collector,docker_collector::docker_collector | +| numa_sched_tune | arrch64 | NUMA原生调度,优化线程调度 | 无 | +| net_hard_irq_tune | aarch64 | 网卡中断调优,优化网络程序性能 | env_info_collector::static,env_info_collector::cpu_util,net_interface_info::base::operstate_up,net_interface_info::driver::operstate_up,pmu_sampling_collector::net:napi_gro_receive_entry,pmu_sampling_collector::skb:skb_copy_datagram_iovec,pmu_sampling_collector::cycles, env_info_collector::net_thread_que_data::thread_recv_que_cnt | +| multi_net_path_tune | aarch64 | 网卡多路径调优,优化网络程序性能 | 无 | + +#### 配置文件 + +xcall.yaml + +``` yaml +redis: # 线程名称 + - xcall_1: 1 #xcall_1表示xcall优化方式,目前只有xcall_1; 1表示需要优化系统调用号 + - xcall_2: 22 #目前只支持epoll_pwait +... +``` -1. 接口定义 +preload.yaml - ```c - void (*disable)(); - ``` +路径:/etc/oeAware/preload.yaml -2. 接口说明 +```yaml +- appname: "" + so: "" +``` - 关闭实例。实例关闭时,进行资源释放等操作。 +通过执行oeawarectl -e preload_tune命令, 根据配置文件给对应进程加载so。 -3. 参数说明 +#### 限制条件 -4. 返回值说明 +xcall_tune依赖内核特性,需要开启FAST_SYSCALL编译内核,并且在cmdline里增加xcall字段。 -获取数据buf +### libub_tune.so -1. 接口定义 +unixbench调优插件。 +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| unixbench_tune | aarch64/x86 | 通过减少远端内存访问,优化ub性能 | thread_collector::thread_collector | - ```c - const DataRingBuf* (*get_ring_buf)(); - ``` +### libdocker_tune.so -2. 接口说明 +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| docker_cpu_burst | aarch64 | 在出现突发负载时,CPUBurst可以为容器临时提供额外的CPU资源,缓解CPU限制带来的性能瓶颈 | pmu_counting_collector::cycles,docker_collector::docker_collector | - 获取数据buf管理指针(内存由插件自行申请),由其他实例调用。 +## 外部插件 -3. 参数说明 +外部插件需要通过以下命令安装,例如安装numafast相关插件。 -4. 返回值说明 +```sh +oeawarectl -i numafast +``` - 返回struct DataRingBuf管理指针。 +### libscenario_numa.so -实例执行 +| 实例名称 | 架构 | 说明 | 订阅 | topic | +| --- | --- | --- | --- | --- | +| scenario_numa | aarch64 | 感知当前环境跨NUMA访存比例,用于实例或sdk订阅(无法单独使能) | pmu_uncore_collector::uncore | system_score | -1. 接口定义 +### libtune_numa.so - ```c - void (*run)(const Param*); - ``` +| 实例名称 | 架构 | 说明 | 订阅 | +| --- | --- | --- | --- | +| tune_numa_mem_access | aarch64 | 周期性迁移线程和内存,减少跨NUMA内存访问 | scenario_numa::system_score, pmu_spe_collector::spe, pmu_counting_collector::cycles | -2. 接口说明 +## SDK使用说明 - 根据执行周期,定期执行。 +```C +typedef int(*Callback)(const DataList *); +int OeInit(); // 初始化资源,与server建立链接 +int OeSubscribe(const CTopic *topic, Callback callback); // 订阅topic,异步执行callback +int OeUnsubscribe(const CTopic *topic); // 取消订阅topic +int OePublish(const DataList *dataList); // 发布数据到server +void OeClose(); // 释放资源 +``` -3. 参数说明 +**示例** - 实例执行时需要的数据。 +```C +#include "oe_client.h" +#include "command_data.h" +int f(const DataList *dataList) +{ + int i = 0; + for (; i < dataList->len; i++) { + CommandData *data = (CommandData*)dataList->data[i]; + for (int j = 0; j < data->attrLen; ++j) { + printf("%s ", data->itemAttr[j]); + } + printf("\n"); + } + return 0; +} +int main() { + OeInit(); + CTopic topic = { + "command_collector", + "sar", + "-q 1", + }; + if (OeSubscribe(&topic, f) < 0) { + printf("failed\n"); + } else { + printf("success\n"); + } + sleep(10); + OeClose(); +} +``` -4. 返回值说明 -## 可支持插件列表 -- libpmu.so:采集插件,采集pmu相关数据。 -- libthread_collector.so:采集插件,采集系统中的线程信息。 -- libthread_scenario.so:感知插件,感知某个线程的信息。 -- libthread_tune.so:调优插件,对unixbench进行性能调优。 ## 约束限制 ### 功能约束 @@ -508,7 +722,7 @@ oeAware默认集成了arm的微架构采集libkperf模块,该模块同一时 ### 操作约束 -当前oeAware仅支持root权限用户进行操作。 +当前oeAware仅支持root组用户进行操作,sdk支持root组和oeaware组用户使用。 ## 注意事项 -- Gitee