From e5e43104873e4a0d12c92772a06a8bed592c175f Mon Sep 17 00:00:00 2001 From: zhangzepeng Date: Sat, 19 Aug 2023 10:26:07 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=80=99Fix:=E4=BF=AE=E5=A4=8Dperf?= =?UTF-8?q?=E7=9A=84EventList=E9=80=89=E6=8B=A9=E6=97=B6=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E8=BF=98=E6=98=AFNONE=EF=BC=8C=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E9=80=89=E4=B8=8A=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzepeng --- ide/src/base-ui/select/LitSelectV.ts | 33 ++-- ide/src/trace/component/SpWelcomePage.ts | 11 -- ide/src/trace/component/trace/base/Utils.ts | 2 +- .../component/trace/timer-shaft/RangeRuler.ts | 6 +- trace_streamer/BUILD.gn | 15 +- trace_streamer/build/protoc.sh | 8 + trace_streamer/build/ts.gni | 3 - trace_streamer/doc/des_tables.md | 182 ++++++++++++++++-- trace_streamer/format-code.sh | 5 +- trace_streamer/gn/BUILD.gn | 31 ++- trace_streamer/gn/CONFIG.gn | 6 +- trace_streamer/gn/toolchain/BUILD.gn | 6 +- .../prebuilts/patch_hiperf/BUILD.gn | 2 +- .../prebuilts/patch_protobuf/protobufbuild.gn | 2 +- trace_streamer/sdk/demo_sdk/test/BUILD.gn | 2 +- trace_streamer/sdk/dubai_sdk/test/BUILD.gn | 2 +- trace_streamer/src/BUILD.gn | 17 +- trace_streamer/src/base/BUILD.gn | 1 + trace_streamer/src/base/index_map.h | 40 ++-- trace_streamer/src/base/sqlite_ext/BUILD.gn | 8 +- trace_streamer/src/base/ts_common.h | 2 - trace_streamer/src/filter/BUILD.gn | 5 +- trace_streamer/src/filter/binder_filter.cpp | 4 - trace_streamer/src/filter/binder_filter.h | 1 - trace_streamer/src/filter/cpu_filter.cpp | 56 ------ trace_streamer/src/filter/cpu_filter.h | 13 -- trace_streamer/src/include/BUILD.gn | 1 - .../src/include/dummy/musl/include/elf.h | 0 .../bytrace_parser/bytrace_event_parser.cpp | 9 - .../src/parser/ebpf_parser/BUILD.gn | 21 +- .../src/parser/hiperf_parser/BUILD.gn | 6 +- .../parser/htrace_pbreader_parser/BUILD.gn | 11 +- .../htrace_event_parser.cpp | 8 - .../htrace_js_cpu_profiler_parser.cpp | 4 +- .../htrace_js_memory_parser.cpp | 54 +++--- .../htrace_js_memory_parser.h | 1 - .../src/parser/print_event_parser.cpp | 6 +- trace_streamer/src/rpc/rpc_server.cpp | 3 - trace_streamer/src/table/base/table_base.cpp | 16 +- .../src/trace_data/trace_data_cache.cpp | 8 - .../src/trace_data/trace_data_cache.h | 3 - .../src/trace_data/trace_data_cache_base.cpp | 3 +- .../src/trace_data/trace_data_cache_base.h | 8 +- .../src/trace_data/trace_stdtype.cpp | 5 - trace_streamer/src/trace_data/trace_stdtype.h | 3 +- .../trace_streamer_selector.cpp | 4 - .../trace_streamer/trace_streamer_selector.h | 1 - trace_streamer/test/BUILD.gn | 2 +- 48 files changed, 323 insertions(+), 317 deletions(-) create mode 100644 trace_streamer/src/include/dummy/musl/include/elf.h diff --git a/ide/src/base-ui/select/LitSelectV.ts b/ide/src/base-ui/select/LitSelectV.ts index 76a89ce8f..dc032a073 100644 --- a/ide/src/base-ui/select/LitSelectV.ts +++ b/ide/src/base-ui/select/LitSelectV.ts @@ -303,23 +303,6 @@ export class LitSelectV extends BaseElement { } initOptions() { - this.selectVOptions!.addEventListener('click', (ev) => { - let items = this.selectVInputEl!.value.split(','); - this.customItem = []; - items.forEach((item: string) => { - if (item.trim() != '') { - let indexItem = this.itemValue.indexOf(item.trim()); - if (indexItem == -1) { - this.customItem.push(item.trim()); - } - } - }); - if (this.customItem.length > 0) { - this.selectVInputEl.value = this.customItem.concat(this.showItems); - } else { - this.selectVInputEl.value = this.showItems; - } - }); this.shadowRoot?.querySelectorAll('lit-select-option').forEach((a) => { a.setAttribute('check', ''); a.addEventListener('onSelected', (e: any) => { @@ -329,7 +312,6 @@ export class LitSelectV extends BaseElement { this.showItems.splice(number, 1); } a.removeAttribute('selected'); - return; } else { let index = this.itemValue.indexOf(a.textContent!); if (index > -1) { @@ -337,6 +319,21 @@ export class LitSelectV extends BaseElement { } a.setAttribute('selected', ''); } + let items = this.selectVInputEl!.value.split(','); + this.customItem = []; + items.forEach((item: string) => { + if (item.trim() != '') { + let indexItem = this.itemValue.indexOf(item.trim()); + if (indexItem == -1) { + this.customItem.push(item.trim()); + } + } + }); + if (this.customItem.length > 0) { + this.selectVInputEl.value = this.customItem.concat(this.showItems); + } else { + this.selectVInputEl.value = this.showItems; + } }); }); } diff --git a/ide/src/trace/component/SpWelcomePage.ts b/ide/src/trace/component/SpWelcomePage.ts index ec4ce087b..59d9e29a3 100644 --- a/ide/src/trace/component/SpWelcomePage.ts +++ b/ide/src/trace/component/SpWelcomePage.ts @@ -30,22 +30,11 @@ export class SpWelcomePage extends BaseElement { align-content: center; background: var(--dark-background5,#F6F6F6); } - .home-page{ - margin-top: -100px; - } .lit-icon{ - margin-top: 50px; - margin-left: 50px; content: var(--dark-img,url('img/pic.png')); }
-
-

黄区域名: https://smartperf.rnd.huawei.com/smartperf/

-

绿区域名: https://devecotesting.rnd.huawei.com/smartperf/

-

3ms社区: http://3ms.huawei.com/km/groups/3956611/home?|=zh-cn

-

welink讨论群: 群1: 593524364461277889 群2: 473395703(已满) 群3: 485625665(已满)

-
`; diff --git a/ide/src/trace/component/trace/base/Utils.ts b/ide/src/trace/component/trace/base/Utils.ts index 06e44d443..d4346f9f4 100644 --- a/ide/src/trace/component/trace/base/Utils.ts +++ b/ide/src/trace/component/trace/base/Utils.ts @@ -43,7 +43,7 @@ export class Utils { Utils.statusMap.set('R', 'Runnable'); Utils.statusMap.set('Running', 'Running'); Utils.statusMap.set('R+', 'Runnable (Preempted)'); - Utils.statusMap.set('R-B', 'Runnable (Binder)') + Utils.statusMap.set('R-B', 'Runnable (Binder)'); Utils.statusMap.set('I', 'Task Dead'); Utils.statusMap.set('T', 'Traced'); Utils.statusMap.set('t', 'Traced'); diff --git a/ide/src/trace/component/trace/timer-shaft/RangeRuler.ts b/ide/src/trace/component/trace/timer-shaft/RangeRuler.ts index 38f454b9f..48447d67e 100644 --- a/ide/src/trace/component/trace/timer-shaft/RangeRuler.ts +++ b/ide/src/trace/component/trace/timer-shaft/RangeRuler.ts @@ -955,10 +955,10 @@ export class RangeRuler extends Graph { count2++; } } - if (count2 >= 10) { - return; - } if (totalX <= FIT_TOTALX_MIN) { + if (count2 >= 10) { + return; + } this.pressFrameIdW = requestAnimationFrame(animW); this.fillX(); this.range.refresh = true; diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn index 2ef422c51..65879c3c0 100644 --- a/trace_streamer/BUILD.gn +++ b/trace_streamer/BUILD.gn @@ -39,10 +39,15 @@ group("trace_streamer") { if (!is_independent_compile) { group("trace_streamer_all") { - deps = [ - "src:trace_streamer(//build/toolchain/linux:clang_x64)", - "src:trace_streamer(//build/toolchain/mingw:mingw_x86_64)", - "src:trace_streamer(//build/toolchain/ohos:ohos_clang_arm64)", - ] + if (host_os == "mac") { + deps = [ "src:trace_streamer(//build/toolchain/mac:clang_arm64)" ] + # deps = [ "src:trace_streamer" ] + } else { + deps = [ + "src:trace_streamer(//build/toolchain/linux:clang_x64)", + "src:trace_streamer(//build/toolchain/ohos:ohos_clang_arm64)", + "src:trace_streamer(//build/toolchain/mingw:mingw_x86_64)", + ] + } } } diff --git a/trace_streamer/build/protoc.sh b/trace_streamer/build/protoc.sh index 63e8971cd..7191cbd4a 100755 --- a/trace_streamer/build/protoc.sh +++ b/trace_streamer/build/protoc.sh @@ -26,6 +26,7 @@ OHOS_X64_OUT=$PROJECT_TOP/$2/ LIBCXX_X64_OUT=$PROJECT_TOP/$1/ndk/libcxx/linux_x86_64 SUBSYS_X64_OUT=$PROJECT_TOP/$2/$TAIL_DIR +PROTOC_DIR=$PROJECT_TOP/$2/$TAIL_DIR PROTOC=$PROJECT_TOP/$2/$TAIL_DIR/protoc OPT_PLUGIN_PROTOREADER_PATH=$PROJECT_TOP/$2/$SUBSYS_DIR/protoreader_plugin OPT_PLUGIN_PROTOREADER="--plugin=protoc-gen-plugin=$PROJECT_TOP/$2/$SUBSYS_DIR/protoreader_plugin --plugin_out=wrapper_namespace=ProtoReader" @@ -35,6 +36,13 @@ PYTHON_SHELL=$THIS_DIR/make_standard_proto.py # shell path TMP=$2 PROTO_OUT_DIR="$PROJECT_TOP/${TMP%/*}/$3" # path of the new proto file +echo "PROTOC_DIR = $PROTOC_DIR" +if ls "$PROTOC_DIR"/*.dylib 1>/dev/null 2>&1; then + cp $PROTOC_DIR/*.dylib $PROJECT_TOP/$2/$SUBSYS_DIR/ +else + echo "*.dylib Not Found!" +fi + echo "1 = $1" echo "2 = $2" echo "3 = $3" diff --git a/trace_streamer/build/ts.gni b/trace_streamer/build/ts.gni index 81bd060f8..bf1aa4c22 100755 --- a/trace_streamer/build/ts.gni +++ b/trace_streamer/build/ts.gni @@ -23,12 +23,10 @@ if (is_independent_compile) { clang_x64_folder = "." enable_ts_utest = target == "test" TS_DIR = "//." - COMMON_LIBRARY = "//commonlibrary" } else { PERF_DIR = "//developtools" with_ebpf_help_table = false clang_x64_folder = "clang_x64" - is_macx = false is_test = false is_protoc = false is_spb = false @@ -39,7 +37,6 @@ if (is_independent_compile) { enable_ts_utest = false is_fuzz = false TS_DIR = "//developtools/smartperf_host/trace_streamer" - COMMON_LIBRARY = "//commonlibrary" } script_executable = "/usr/bin/env" diff --git a/trace_streamer/doc/des_tables.md b/trace_streamer/doc/des_tables.md index ae2564b05..79d9d4f11 100755 --- a/trace_streamer/doc/des_tables.md +++ b/trace_streamer/doc/des_tables.md @@ -15,21 +15,27 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 | ---- |---- | | animation | 记录动效的响应时延和完成时延| | app_name | 记录HiSysEvent事件的事件名与IDE部分事件的字段名为APPNAME中存放的相关信息的映射关系| +| app_startup | 记录了应用启动相关数据| | args | 记录方法参数集合| | bio_latency_sample | 记录IO操作相关方法调用,及调用栈数据| | callstack | 记录调用堆栈和异步调用信息,其中depth,stack_id和parent_stack_id仅在非异步调用中有效。当cookid不为空时,为异步调用,此时callid为进程唯一号,否则为线程唯一号| | clk_event_filter | 记录时钟相关的信息| | clock_event_filter | 此结构用来维护时钟事件,cpu与唯一的ID做关联| +| clock_snapshot | 时钟号和时间,时钟名的映射表| | cpu_measure_filter | cpu事件过滤器表| | cpu_usage | 记录CPU使用率事件| +| datasource_clockid | 数据源和时钟号的映射表| | data_dict | 记录常用的字符串,将字符串和索引关联,降低程序运行的内存占用,用作辅助数据| +| data_type | 记录数据类型和typeId的关联关系| | device_info | 记录设备分辨率和帧率| | device_state | 记录设备屏幕亮度,蓝牙,位置,wifi,音乐,媒体等信息| -| dynamic_frame | 记录动效帧的分辨率和结束时间等| -| data_type | 记录数据类型和typeId的关联关系| | diskio | 记录磁盘读写数据事件| +| dynamic_frame | 记录动效帧的分辨率和结束时间等| | ebpf_callstack | 记录了采样相关信息| -| file_system_samp | 记录了调用栈的相关信息| +| file_system_sample | 记录了调用栈的相关信息| +| frame_maps | 记录应用到RS的帧的映射关系| +| frame_slice | 记录RS(RenderService)和应用的帧渲染| +| gpu_slice | 记录RS的帧对应的gpu渲染时长| | hidump | 记录FPS(Frame Per Second)数据| | hisys_event_measure | 记录了HiSysEvent事件相关数据,目前HiSysEvent事件包括了异常事件,IDE事件,器件状态事件 | | instant | 记录Sched_waking, sched_wakeup事件, 用作ThreadState表的上下文使用 | @@ -46,11 +52,14 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 | js_heap_string | 记录了js内存数据中的字符串| | js_heap_trace_function_info | 记录了timeline模式下的调用栈的每个函数信息| | js_heap_trace_node | 记录了timeline模式下的调用栈信息| -| app_startup | 记录了应用启动相关数据| -| static_initalize | 记录了so初始化相关数据| | live_process | 记录了一些实时的进程中执行的一些数据| | log | 记录hilog打印日志数据| +| measure | 记录所有的计量值| | measure_filter | 记录一个递增的filterid队列,所有其他的filter类型在获取过程中,均从此数据列表中获取下一个可用的filter_id并做记录| +| memory_ashmem | 记录了进程所占用的ashmem相关信息| +| memory_dma | 记录了进程占用的DMA内存相关信息| +| memory_process_gpu | 记录进程占用GPU内存相关信息| +| memory_window_gpu | 记录窗口占用GPU内存相关信息| | meta | 记录执行解析操作相关的基本信息| | native_hook | 记录堆内存申请与释放相关的数据| | native_hook_frame | 记录堆内存申请与释放相关的调用栈| @@ -70,24 +79,24 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 | sched_slice | 此数据结构主要作为ThreadState的上下文使用,这张表是sched_switch事件的原始记录| | smaps | 记录进程的内存消耗的相关信息采样| | stat | 此结果用来统计数据解析中各类数据的数据条数,数据和合法性,数据的匹配程度(begin-end),数据的损失等,查看此结构对应的表,可对数据源有基本的了解| +| static_initalize | 记录了so初始化相关数据| | symbols | 记录系统调用名称和其函数指针的对应关系,trace中用addr来映射function_name来节省存储空间| | syscall | 记录用户空间函数与内核空间函数相互调用记录| | sys_event_filter | 记录所有的filter| | sys_mem_measure | 记录了所有的系统内存相关的测量信息| +| task_pool | 记录任务池相关数据,与callstack表相关联| | thread | 记录所有的线程信息| | thread_filter | 过滤线程| | thread_state | 记录线程状态信息| | trace_config | 记录trace数据源,proto的事件-plugin与其process_name| | trace_range | 记录ftrace数据与其他类型数据的时间交集,供前端展示数据时使用| -| clock_snapshot | 时钟号和时间,时钟名的映射表| -| datasource_clockid | 数据源和时钟号的映射表| -| task_pool | 记录任务池相关数据,与callstack表相关联| ## 表与事件来源 | 表名称 | 事件源 | 插件名 | 备注 | | ---- | ---- | ---- | ---- | -|animation | - |ftrace-plugin |记录动效的响应时延和完成时延 | +|animation | - |ftrace-plugin |记录动效的响应时延和完成时延 | |app_name | - |hisysevent-plugin |JSON数据源 | |args | - |ftrace-plugin |配合callstack使用 | +|bio_latency_sample | - | - |IO操作相关方法调用,及调用栈数据 | |callstack | - |ftrace-plugin |异步或非异步的调用 | |cpu_measure_filter | - |ftrace-plugin |cpu跟踪器,cpu频率等 | |cpu_usage | - |cpu-plugin |cpu使用率 | @@ -95,12 +104,13 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 |data_type | 通用的 | - |辅助表 | |device_info | - |ftrace-plugin |记录设备分辨率和帧率 | |device_state | 通用的 |hisysevent-plugin |记录设备屏幕亮度,蓝牙,位置等信息 | -|dynamic_frame | - |ftrace-plugin |记录动效帧的分辨率和结束时间等 | +|dynamic_frame | - |ftrace-plugin |动效帧的分辨率和结束时间等 | +|ebpf_callstack | - | - |磁盘读写相关的数据 | |file_system_callstack | - | - |ebpf文件系统 | |file_system_sample | - | - |ebpf文件系统 | -|frame_maps | - |ftrace-plugin |帧渲染数据,app到RS的映射 | -|frame_slice | - |ftrace-plugin |帧渲染数据 | -|gpu_slice | - |ftrace-plugin |gpu渲染时长 | +|frame_maps | - |ftrace-plugin |帧渲染数据,app到RS的映射 | +|frame_slice | - |ftrace-plugin |帧渲染数据 | +|gpu_slice | - |ftrace-plugin |gpu渲染时长 | |hidump | - |hidump-plugin |FPS数据 | |hisys_event_measure | - |hisysevent-plugin |JSON数据源 | |instant | - |ftrace-plugin |waking和wakeup事件 | @@ -117,18 +127,23 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 |js_heap_string | - |arkts-plugin | js内存数据 | |js_heap_trace_function_info | - |arkts-plugin | js内存数据 | |js_heap_trace_node | - |arkts-plugin | js内存数据 | -|app_startup | - |ftrace-plugin | 应用启动数据 | -|static_initalize | - |ftrace-plugin | so初始化数据 | +|app_startup | - |ftrace-plugin | 应用启动数据 | +|static_initalize | - |ftrace-plugin | so初始化数据 | |live_process | - |process-plugin |Monitor数据 | |network | - |network-plugin |Monitor数据 | |diskio | - |diskio-plugin |Monitor数据 | |log | - |hilog-plugin |系统日志 | |measure | 通用的 | - |系统中的计量值(数值型)| |measure_filter | 通用的 | - |计量值的查询辅助表 | +|memory_ashmem | - |memory-plugin |进程所占用ashmem相关信息 | +|memory_dma | - |memory-plugin |进程占用的DMA内存相关信息 | +|memory_process_gpu | - |memory-plugin |进程占用GPU内存相关信息 | +|memory_window_gpu | - |memory-plugin |窗口占用GPU内存相关信息 | |meta | 通用的 | - |记录解析现场数据(解析时间,数据类型,解析工具等)| |native_hook | - |nativehook/hookdaemon |malloc && mmap内存数据 | |native_hook_frame | - |nativehook/hookdaemon |native_hook调用栈数据 | |native_hook_statistic | - |nativehook/hookdaemon |malloc && mmap统计数据 | +|paged_memory_sample | - | - |网络数据传输相关的信息 | |perf_callchain | - |perf-plugin |perf数据(非插件模式) | |perf_files | - | - |perf数据(非插件模式) | |perf_report | - | - |perf数据(非插件模式) | @@ -151,8 +166,8 @@ TraceStreamer可以将trace数据源转化为易于理解和使用的数据库 |trace_config | 通用的 |hisysevent-plugin |记录trace数据源 | |trace_range | 通用的 | - |trace数据的时长 | |thread_filter | 通用的 |ftrace-plugin |线程计量跟踪表(比较少用)| -|clock_snapshot | 通用的 |通用的 |时钟号和时间,时钟名的映射表| -|datasource_clockid | 通用的 |通用的 |数据源和时钟号的映射表| +|clock_snapshot | 通用的 |通用的 |时钟号和时间,时钟名的映射表| +|datasource_clockid | 通用的 |通用的 |数据源和时钟号的映射表| |task_pool | - | - |任务池数据 | ## ___表格关系图___ @@ -472,7 +487,7 @@ js_heap_sample:记录timeline的时间轴信息 #### 表描述 记录了与磁盘读写相关的数据。 #### 主要字段描述 -- callchain_id:调用栈的唯一标识。与ebpf_callstack表中Callchain_id字段关联 +- callchain_id:调用栈的唯一标识 - depth:调用栈深度。取值为零时表示栈顶 - ip:调用栈ip - symbols_id:调用栈函数名称, 与data_dict中的id字段关联 @@ -1569,7 +1584,7 @@ js_heap_sample:记录timeline的时间轴信息 - src:该帧是被哪一帧(该表中对应的行数)触发的,有多个值时,用逗号分割 - dst:该帧对应的渲染帧是哪一行 - type: 0 说明该行数据是实际渲染帧, 1 说明该行数据是期望渲染帧 -- flag: 空时,为不完整的数据;0 表示实际渲染帧不卡帧, 1 表示实际渲染帧卡帧, 2 表示数据不需要绘制(没有frameNum信息) +- flag: 空时,为不完整的数据;0 表示实际渲染帧不卡帧, 1 表示实际渲染帧卡帧(expectEndTime < actualEndTime为异常), 2 表示数据不需要绘制(没有frameNum信息),3 表示rs进程与app进程起止异常(|expRsStartTime - expUiEndTime| < 1ms 正常,否则异常。这里使用期待帧的时间差做判断,给实际帧打标签) - depth:预留 - frame_no:预留 @@ -1750,4 +1765,131 @@ js_heap_sample:记录timeline的时间轴信息 #### 关键字段描述 - trace_source:事件源 - key:事件需要关注的信息名 -- value:事件需要关注的信息名对应的信息值 \ No newline at end of file +- value:事件需要关注的信息名对应的信息值 + +### memory_ashmem表 +#### 表结构 +| Columns Name | SQL TYPE | +|---- |---- | +|id |INT | +|ts |INT | +|ipid |INT | +|adj |INT | +|fd |INT | +|ashmem_name_id|INT | +|size |INT | +|pss |INT | +|ashmem_id |INT | +|time |INT | +|ref_count |INT | +|purged |INT | +|flag |INT | +#### 表描述 +该表记录trace数据源,proto的事件-plugin与其process_name(目前只有HisysEvent事件在用)。 +#### 关键字段描述 +- ts:时间戳 +- ipid:内部进程号 +- fd:共享内存文件描述符 +- ashmem_name_id:共享内存名 +- size:共享内存大小 +- pss:PSS内存大小 +- ashmem_id:共享内存ID +- ref_count:引用计数 +- flag:去重标记,0表示正常,1表示进程内部重复数据,2表示进程间重复数据 + +### memory_dma表 +#### 表结构 +| Columns Name | SQL TYPE | +|---- |---- | +|id |INT | +|ts |INT | +|ipid |INT | +|fd |INT | +|size |INT | +|ino |INT | +|exp_pid |INT | +|exp_task_comm_id|INT | +|buf_name_id |INT | +|exp_name_id |INT | +|flag |INT | +#### 表描述 +该表记录trace数据源,proto的事件-plugin与其process_name(目前只有HisysEvent事件在用)。 +#### 关键字段描述 +- ts:时间戳 +- ipid:内部进程号 +- fd:dma内存文件描述符 +- size:dma内存大小 +- exp_pid:申请者的进程号 +- buf_name_id:dma内存名 +- exp_name_id:申请者进程名 +- flag:去重标记,0表示正常,1表示进程内部重复数据,2表示进程间重复数据 + +### memory_process_gpu表 +#### 表结构 +| Columns Name | SQL TYPE | +|---- |---- | +|id |INT | +|ts |INT | +|gpu_name_id |INT | +|all_gpu_size |INT | +|addr |TEXT | +|ipid |INT | +|itid |INT | +|used_gpu_size |INT | +#### 表描述 +该表记录trace数据源,proto的事件-plugin与其process_name(目前只有HisysEvent事件在用)。 +#### 关键字段描述 +- ts:时间戳 +- gpu_name_id:gpu内存名称 +- all_gpu_size:进程占用gpu总大小 +- addr:gpu内存地址 +- ipid:内部进程号 +- itid:内部线程号 +- used_gpu_size:已使用的gpu大小 + +### memory_window_gpu表 +#### 表结构 +| Columns Name | SQL TYPE | +|---- |---- | +|id |INT | +|ts |INT | +|window_name_id|INT | +|window_id |INT | +|module_name_id|INT | +|category_name_id|INT | +|size |INT | +|count |INT | +|purgeable_size|INT | +#### 表描述 +该表记录trace数据源,proto的事件-plugin与其process_name(目前只有HisysEvent事件在用)。 +#### 关键字段描述 +- ts:时间戳 +- window_name_id:窗口名 +- window_id:窗口id +- module_name_id:模块名 +- category_name_id:目录名 +- size:内存大小 +- count:内存申请个数 + +### static_initalize表 +#### 表结构 +| Columns Name | SQL TYPE | +|---- |---- | +|id |INT | +|ipid |INT | +|tid |INT | +|call_id |INT | +|start_time |INT | +|end_time |INT | +|so_name |TEXT | +|depth |INT | +#### 表描述 +该表记录了so初始化相关数据。 +#### 关键字段描述 +- ipid:内部进程号 +- tid:内部线程号 +- call_id:调用者的ID,对应线程表里面的itid +- start_time:阶段开始时间 +- end_time:阶段结束时间 +- so_name:so文件名称 +- depth:泳道图的深度 \ No newline at end of file diff --git a/trace_streamer/format-code.sh b/trace_streamer/format-code.sh index 67e49d2b3..8e86f549c 100755 --- a/trace_streamer/format-code.sh +++ b/trace_streamer/format-code.sh @@ -25,8 +25,11 @@ esac PRJ_ROOT_DIR=$(readlink -f -- "$(dirname $0)/") cd ${PRJ_ROOT_DIR} FORMAT_DIR_LIST=( - "${PRJ_ROOT_DIR}/src" + "${PRJ_ROOT_DIR}/build" + "${PRJ_ROOT_DIR}/gn" + "${PRJ_ROOT_DIR}/prebuilts" "${PRJ_ROOT_DIR}/sdk" + "${PRJ_ROOT_DIR}/src" "${PRJ_ROOT_DIR}/test" ) echo "formatting code ..." diff --git a/trace_streamer/gn/BUILD.gn b/trace_streamer/gn/BUILD.gn index e1cd19079..66a39d74a 100755 --- a/trace_streamer/gn/BUILD.gn +++ b/trace_streamer/gn/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. import("../build/ts.gni") print("target_os", target_os) -print("target_name", target) group("default_deps") { public_configs = [ ":default_config" ] public_deps = [] @@ -73,7 +72,7 @@ config("default") { if (target_os == "windows") { cflags += [ "-D target_cpu_x86_64" ] libs += [ "z" ] - } else if (is_linux || is_macx) { + } else if (is_linux || is_mac) { cflags += [ "-Wa,--noexecstack", "-fcolor-diagnostics", @@ -101,7 +100,7 @@ config("default") { # with_libunwind = true } - if (!use_wasm && !is_win && !is_macx && !is_test && !is_mingw) { + if (!use_wasm && !is_win && !is_mac && !is_test && !is_mingw) { cflags += [ "-D HAVE_LIBUNWIND" ] } @@ -122,7 +121,7 @@ config("default") { } cflags += [ "-D BINDER_ASYNC" ] libs += [ "pthread" ] - if (!is_macx) { + if (!is_mac) { libs += [ "rt" ] } if (!is_win) { @@ -149,7 +148,7 @@ config("default") { config("symbols") { cflags = [ "-O0" ] - if (is_linux || is_macx) { + if (is_linux || is_mac) { cflags += [ "-funwind-tables" ] } } @@ -162,7 +161,7 @@ config("release") { cflags += [ "-O3" ] ldflags = [ "-fstack-protector" ] - if (!is_macx) { + if (!is_mac) { ldflags += [ "-Wl,-O1" ] if (!is_win) { ldflags += [ @@ -172,7 +171,7 @@ config("release") { } } - if (!is_win && !is_macx) { + if (!is_win && !is_mac) { ldflags += [ "-fPIC", "-fpie", @@ -192,10 +191,10 @@ config("executable") { print("use_wasm", use_wasm) ldflags = [] - if (is_linux || (is_macx && !use_wasm)) { + if (is_linux || (is_mac && !use_wasm)) { ldflags += [] } - if (!is_macx && !use_wasm && !is_win) { + if (!is_mac && !use_wasm && !is_win) { ldflags += [ "-Wl,--disable-new-dtags", "-Wl,-z,noexecstack", @@ -205,16 +204,16 @@ config("executable") { "-Wl,-z,relro", ] } - if (!is_macx && !use_wasm) { + if (!is_mac && !use_wasm) { ldflags += [ "-fpie" ] } - if (!is_macx && !use_wasm && !is_win) { + if (!is_mac && !use_wasm && !is_win) { ldflags += [ "-pie" ] } - if (!is_macx) { + if (!is_mac) { ldflags += [ "-Wl,--gc-sections" ] } - if (is_macx) { + if (is_mac) { ldflags += [ "-fdata-sections", "-ffunction-sections", @@ -223,9 +222,9 @@ config("executable") { ldflags += [ "-Wl,-U,__sanitizer_options_link_helper" ] } } - if (!is_debug && !is_macx) { + if (!is_debug && !is_mac) { ldflags += [ "-s" ] - } else if (!is_debug && is_macx) { + } else if (!is_debug && is_mac) { ldflags += [ "-dead_strip" ] } } @@ -252,7 +251,7 @@ config("ts_config") { libs = [ "wsock32" ] libs += [ "ws2_32" ] } - if (!use_wasm && !is_win && !is_macx && !is_test && !is_mingw) { + if (!use_wasm && !is_win && !is_mac && !is_test && !is_mingw) { cflags += [ "-D HAVE_LIBUNWIND" ] } if (enable_ts_utest && !use_wasm) { diff --git a/trace_streamer/gn/CONFIG.gn b/trace_streamer/gn/CONFIG.gn index 6d5e5ad94..d0dae36a9 100755 --- a/trace_streamer/gn/CONFIG.gn +++ b/trace_streamer/gn/CONFIG.gn @@ -12,7 +12,7 @@ # limitations under the License. is_win = false is_linux = false -is_macx = false +is_mac = false is_protoc = false with_ebpf_help_table = false is_mingw = false @@ -32,14 +32,14 @@ declare_args() { is_sdkdemo_test = false testonly = false is_fuzz = false - is_macx = false + is_mac = false is_spb = false target = "trace_streamer" } if (target_os == "linux") { is_linux = true } else if (target_os == "macx") { - is_macx = true + is_mac = true } else if (target_os == "windows") { is_win = true is_mingw = true diff --git a/trace_streamer/gn/toolchain/BUILD.gn b/trace_streamer/gn/toolchain/BUILD.gn index 37f5bc3d0..657d518c2 100755 --- a/trace_streamer/gn/toolchain/BUILD.gn +++ b/trace_streamer/gn/toolchain/BUILD.gn @@ -38,7 +38,7 @@ declare_args() { toolchain("wasm") { # emsdk_dir and em_config are defined in wasm.gni. print("use gcc_like_chain wasm") - if (!is_macx) { + if (!is_mac) { ar = "$emsdk_dir/emscripten/emar --em-config $em_config" } cc = "$emsdk_dir/emscripten/emcc --em-config $em_config" @@ -91,7 +91,7 @@ toolchain("wasm") { tool("alink") { rspfile = "{{output}}.rsp" # must be defined rspfile_content = "{{inputs}}" - if (is_macx) { + if (is_mac) { command = "rm -f {{output}} && libtool -static {{arflags}} -o {{output}} -filelist $rspfile" } else { command = "rm -rf {{output}} && $ar rcsD {{output}} @$rspfile" @@ -162,7 +162,7 @@ toolchain("gcc_like") { } tool("alink") { rspfile = "{{output}}.rsp" # this must be defined - if (is_macx) { + if (is_mac) { rspfile_content = "{{inputs_newline}}" command = "rm -f {{output}} && libtool -static {{arflags}} -filelist $rspfile -o {{output}}" } else { diff --git a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn index 410881f05..c3733775f 100644 --- a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn +++ b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn @@ -89,7 +89,7 @@ group("hiperf_platform_common") { deps = [ ":elf", ":hiperf_src", - "${THIRD_PARTY}/protobuf:protobuf_lite_static", "${THIRD_PARTY}/protobuf:protobuf_static", + "${THIRD_PARTY}/protobuf:protobuf_lite_static", ] } diff --git a/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn b/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn index c8af4592c..31fdfda99 100755 --- a/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn +++ b/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn @@ -193,7 +193,7 @@ if (use_wasm) { ] ldflags = [ "-fstack-protector" ] - if (!is_macx) { + if (!is_mac) { ldflags += [ "-fuse-ld=gold", "-Wl,--gc-sections", diff --git a/trace_streamer/sdk/demo_sdk/test/BUILD.gn b/trace_streamer/sdk/demo_sdk/test/BUILD.gn index 67d4c941b..7cdd848db 100755 --- a/trace_streamer/sdk/demo_sdk/test/BUILD.gn +++ b/trace_streamer/sdk/demo_sdk/test/BUILD.gn @@ -72,7 +72,7 @@ if (target == "sdkdemotest") { "-fno-use-cxa-atexit", "-DIS_UT", ] - if (is_macx) { + if (is_mac) { lib_dirs = [ "/usr/local/opt/llvm/lib" ] } libs = [ "LLVMCore" ] diff --git a/trace_streamer/sdk/dubai_sdk/test/BUILD.gn b/trace_streamer/sdk/dubai_sdk/test/BUILD.gn index 2454379f5..0bce70d68 100755 --- a/trace_streamer/sdk/dubai_sdk/test/BUILD.gn +++ b/trace_streamer/sdk/dubai_sdk/test/BUILD.gn @@ -73,7 +73,7 @@ if (target == "sdkdemotest") { "-fno-use-cxa-atexit", "-DUT_MAC", ] - if (is_macx) { + if (is_mac) { lib_dirs = [ "/usr/local/opt/llvm/lib" ] } libs = [ "LLVMCore" ] diff --git a/trace_streamer/src/BUILD.gn b/trace_streamer/src/BUILD.gn index 8005da813..c993b450c 100644 --- a/trace_streamer/src/BUILD.gn +++ b/trace_streamer/src/BUILD.gn @@ -50,7 +50,7 @@ ohos_source_set("ts_sqlite") { "-DSQLITE_OMIT_LOAD_EXTENSION", ] - if (is_mingw) { + if (is_mingw || is_mac) { include_dirs += [ "${THIRD_PARTY}/libbpf/include/uapi" ] } } @@ -81,12 +81,13 @@ trace_streamer_include = [ "${PERF_DIR}/hiperf/include/nonlinux", "${PERF_DIR}/hiperf/include/nonlinux/linux", "${THIRD_PARTY}/perf_include/musl", - "${THIRD_PARTY}/musl", "${THIRD_PARTY}/libunwind/include", "${THIRD_PARTY}/libunwind/src", "${THIRD_PARTY}/perf_include/libbpf", "${THIRD_PARTY}/googletest/googletest/include", - "${COMMON_LIBRARY}/c_utils/base/include", + "//commonlibrary/c_utils/base/include", + "//prebuilts/clang/ohos/darwin-arm64/llvm/include/c++/v1", + "include/dummy/musl", ] ohos_source_set("trace_streamer_source") { @@ -94,14 +95,11 @@ ohos_source_set("trace_streamer_source") { part_name = "${OHOS_PROFILER_PART_NAME}" sources = [ "cfg/trace_streamer_config.cpp", - "cfg/trace_streamer_config.h", "rpc/http_server.cpp", "rpc/http_socket.cpp", "rpc/rpc_server.cpp", "trace_streamer/trace_streamer_filters.cpp", - "trace_streamer/trace_streamer_filters.h", "trace_streamer/trace_streamer_selector.cpp", - "trace_streamer/trace_streamer_selector.h", "version.cpp", ] if (!is_test && !is_fuzz) { @@ -126,8 +124,13 @@ ohos_source_set("trace_streamer_source") { if (!is_independent_compile) { configs = [ "${TS_DIR}/gn:ts_config" ] } + if (is_mingw || is_mac) { + include_dirs += [ + "${THIRD_PARTY}/libbpf/include/uapi", + "${THIRD_PARTY}/elfutils/libelf", + ] + } if (is_mingw) { - include_dirs += [ "${THIRD_PARTY}/libbpf/include/uapi" ] cflags = [ "-includeMingW64Fix.h" ] } diff --git a/trace_streamer/src/base/BUILD.gn b/trace_streamer/src/base/BUILD.gn index 8981ee3bc..c71e84ad3 100644 --- a/trace_streamer/src/base/BUILD.gn +++ b/trace_streamer/src/base/BUILD.gn @@ -19,6 +19,7 @@ ohos_source_set("base") { public_deps = [ "sqlite_ext:sqliteext" ] include_dirs = [ "../include", + "${THIRD_PARTY}/sqlite/include", "//third_party/bounds_checking_function/include", ] sources = [ diff --git a/trace_streamer/src/base/index_map.h b/trace_streamer/src/base/index_map.h index 9a82356a9..6562a0c17 100644 --- a/trace_streamer/src/base/index_map.h +++ b/trace_streamer/src/base/index_map.h @@ -78,44 +78,36 @@ public: rowIndexBak_.clear(); switch (op) { case SQLITE_INDEX_CONSTRAINT_EQ: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] != value; }, - [&](TableRowId id) -> bool { return dataQueue[id] == value; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] != value; }, + [&](TableRowId id) -> bool { return dataQueue[id] == value; }); break; case SQLITE_INDEX_CONSTRAINT_NE: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] == value; }, - [&](TableRowId id) -> bool { return dataQueue[id] != value; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] == value; }, + [&](TableRowId id) -> bool { return dataQueue[id] != value; }); break; case SQLITE_INDEX_CONSTRAINT_ISNULL: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] != invalidValue; }, - [&](TableRowId id) -> bool { return dataQueue[id] == invalidValue; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] != invalidValue; }, + [&](TableRowId id) -> bool { return dataQueue[id] == invalidValue; }); break; case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] == invalidValue; }, - [&](TableRowId id) -> bool { return dataQueue[id] != invalidValue; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] == invalidValue; }, + [&](TableRowId id) -> bool { return dataQueue[id] != invalidValue; }); break; case SQLITE_INDEX_CONSTRAINT_GT: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] <= value; }, - [&](TableRowId id) -> bool { return dataQueue[id] > value; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] <= value; }, + [&](TableRowId id) -> bool { return dataQueue[id] > value; }); break; case SQLITE_INDEX_CONSTRAINT_GE: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] < value; }, - [&](TableRowId id) -> bool { return dataQueue[id] >= invalidValue; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] < value; }, + [&](TableRowId id) -> bool { return dataQueue[id] >= invalidValue; }); break; case SQLITE_INDEX_CONSTRAINT_LE: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] > value; }, - [&](TableRowId id) -> bool { return dataQueue[id] < invalidValue; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] > value; }, + [&](TableRowId id) -> bool { return dataQueue[id] < invalidValue; }); break; case SQLITE_INDEX_CONSTRAINT_LT: - ProcessData( - dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] >= value; }, - [&](TableRowId id) -> bool { return dataQueue[id] < invalidValue; }); + ProcessData(dataQueue, remove, [&](TableRowId id) -> bool { return dataQueue[id] >= value; }, + [&](TableRowId id) -> bool { return dataQueue[id] < invalidValue; }); break; default: break; diff --git a/trace_streamer/src/base/sqlite_ext/BUILD.gn b/trace_streamer/src/base/sqlite_ext/BUILD.gn index fc81a20b9..9cdf7cea7 100644 --- a/trace_streamer/src/base/sqlite_ext/BUILD.gn +++ b/trace_streamer/src/base/sqlite_ext/BUILD.gn @@ -13,18 +13,14 @@ import("//build/ohos.gni") import("../../../build/ts.gni") -config("sqlite_config") { +ohos_source_set("sqliteext") { + sources = [ "sqlite_ext_funcs.cpp" ] include_dirs = [ "${THIRD_PARTY}/sqlite/include", "${THIRD_PARTY}/bounds_checking_function/include", "..", ] - cflags = [ "-Wno-attributes" ] if (!is_independent_compile) { configs = [ "${TS_DIR}/gn:ts_config" ] } } -source_set("sqliteext") { - sources = [ "sqlite_ext_funcs.cpp" ] - public_configs = [ ":sqlite_config" ] -} diff --git a/trace_streamer/src/base/ts_common.h b/trace_streamer/src/base/ts_common.h index def2368cb..908c8fbe9 100644 --- a/trace_streamer/src/base/ts_common.h +++ b/trace_streamer/src/base/ts_common.h @@ -103,8 +103,6 @@ enum EndState { TASK_PARKED = 512, // (R+) Process groups in the foreground TASK_FOREGROUND = 2048, - // Hisi spec state - TASK_RUNNABLE_BINDER = 2049, TASK_MAX = 4096, TASK_INVALID = 9999 }; diff --git a/trace_streamer/src/filter/BUILD.gn b/trace_streamer/src/filter/BUILD.gn index bb1df100a..638e72666 100644 --- a/trace_streamer/src/filter/BUILD.gn +++ b/trace_streamer/src/filter/BUILD.gn @@ -81,6 +81,9 @@ ohos_source_set("filter") { "${THIRD_PARTY}/json/single_include/nlohmann", "../proto_reader/include", ".", - "${THIRD_PARTY}/musl", ] + + if (is_mingw || is_mac) { + include_dirs += [ "${THIRD_PARTY}/elfutils/libelf" ] + } } diff --git a/trace_streamer/src/filter/binder_filter.cpp b/trace_streamer/src/filter/binder_filter.cpp index 50188f2d9..6a961fd4e 100644 --- a/trace_streamer/src/filter/binder_filter.cpp +++ b/trace_streamer/src/filter/binder_filter.cpp @@ -190,10 +190,6 @@ void BinderFilter::TractionUnlock(int64_t ts, uint32_t pid, const std::string& t lastEventTs_.erase(pid); lastEventTs_[pid] = ts; } -bool BinderFilter::IsAsync(int32_t flags) const -{ - return (flags & noReturnMsgFlag_) == noReturnMsgFlag_; -} void BinderFilter::Clear() { lastEventTs_.clear(); diff --git a/trace_streamer/src/filter/binder_filter.h b/trace_streamer/src/filter/binder_filter.h index 457dee0b9..d50d391df 100644 --- a/trace_streamer/src/filter/binder_filter.h +++ b/trace_streamer/src/filter/binder_filter.h @@ -45,7 +45,6 @@ public: void TractionLock(int64_t ts, uint32_t pid, const std::string& tag); void TractionLocked(int64_t ts, uint32_t pid, const std::string& tag); void TractionUnlock(int64_t ts, uint32_t pid, const std::string& tag); - bool IsAsync(int32_t flags) const; void Clear(); private: diff --git a/trace_streamer/src/filter/cpu_filter.cpp b/trace_streamer/src/filter/cpu_filter.cpp index 6be217a23..dfb354dda 100644 --- a/trace_streamer/src/filter/cpu_filter.cpp +++ b/trace_streamer/src/filter/cpu_filter.cpp @@ -31,12 +31,10 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, uint64_t nextPior, DataIndex nextInfo) { - BinderTransactionInfo btInfo = {prevPid, nextPid, INVALID_UINT64, INVALID_UINT64}; auto index = traceDataCache_->GetSchedSliceData()->AppendSchedSlice(ts, 0, cpu, nextPid, 0, nextPior); auto prevTidOnCpu = cpuToRowSched_.find(cpu); if (prevTidOnCpu != cpuToRowSched_.end()) { traceDataCache_->GetSchedSliceData()->Update(prevTidOnCpu->second.row, ts, prevState); - btInfo.schedSliceRow = prevTidOnCpu->second.row; cpuToRowSched_.at(cpu).row = index; } else { cpuToRowSched_.insert(std::make_pair(cpu, RowPos{nextPid, index})); @@ -85,7 +83,6 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, } auto threadStateRow = traceDataCache_->GetThreadStateData()->AppendThreadState(ts, INVALID_TIME, INVALID_CPU, prevPid, prevState); - btInfo.threadStateRow = threadStateRow; if (prevState == TASK_UNINTERRUPTIBLE || prevState == TASK_DK) { if (!pidToThreadSliceRow.count(prevPid)) { pidToThreadSliceRow.emplace(std::make_pair(prevPid, threadStateRow)); @@ -95,16 +92,6 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, } (void)RemberInternalTidInStateTable(prevPid, threadStateRow, prevState); } - if (traceDataCache_->BinderRunnableTraceEnabled() && iTidToTransaction_.find(prevPid) != iTidToTransaction_.end()) { - uint64_t transactionId = iTidToTransaction_.at(prevPid); - auto iter = transactionIdToInfo_.find(transactionId); - if (prevState != TASK_FOREGROUND || iter == transactionIdToInfo_.end() || iter->second.iTidFrom != prevPid || - btInfo.schedSliceRow == INVALID_UINT64 || btInfo.threadStateRow == INVALID_UINT64) { - TransactionClear(prevState, transactionId); - return; - } - transactionIdToInfo_[transactionId] = btInfo; - } } bool CpuFilter::InsertBlockedReasonEvent(uint64_t ts, @@ -209,8 +196,6 @@ void CpuFilter::Clear() cpuToRowSched_.clear(); lastWakeUpMsg_.clear(); internalTidToRowThreadState_.clear(); - iTidToTransaction_.clear(); - transactionIdToInfo_.clear(); } void CpuFilter::InsertWakeupEvent(uint64_t ts, uint32_t internalTid, bool isWaking) { @@ -271,46 +256,5 @@ void CpuFilter::CheckWakeupEvent(uint32_t internalTid) } return; } - -void CpuFilter::InsertRunnableBinderEvent(uint32_t transactionId, uint32_t iTid) -{ - if (iTidToTransaction_.find(iTid) != iTidToTransaction_.end()) { - iTidToTransaction_.erase(iTid); - } - iTidToTransaction_.emplace(iTid, transactionId); - if (transactionIdToInfo_.find(transactionId) != transactionIdToInfo_.end()) { - transactionIdToInfo_.erase(transactionId); - } - transactionIdToInfo_.emplace(transactionId, - BinderTransactionInfo{iTid, INVALID_UINT32, INVALID_UINT64, INVALID_UINT64}); -} - -void CpuFilter::InsertRunnableBinderRecvEvent(uint32_t transactionId, uint32_t iTid) -{ - auto iter = transactionIdToInfo_.find(transactionId); - if (iter == transactionIdToInfo_.end()) { - return; - } - if (iter->second.iTidTo == iTid && iter->second.schedSliceRow != INVALID_UINT64 && - iter->second.threadStateRow != INVALID_UINT64) { - traceDataCache_->GetSchedSliceData()->UpdateEndState(iter->second.schedSliceRow, TASK_RUNNABLE_BINDER); - traceDataCache_->GetThreadStateData()->UpdateState(iter->second.threadStateRow, TASK_RUNNABLE_BINDER); - } - TransactionClear(INVALID_UINT32, transactionId); -} - -void CpuFilter::TransactionClear(uint32_t iTidFrom, uint32_t transactionId) -{ - if (iTidToTransaction_.find(iTidFrom) != iTidToTransaction_.end()) { - iTidToTransaction_.erase(iTidFrom); - } - auto iter = transactionIdToInfo_.find(transactionId); - if (iter != transactionIdToInfo_.end()) { - if (iTidToTransaction_.find(iter->second.iTidFrom) != iTidToTransaction_.end()) { - iTidToTransaction_.erase(iter->second.iTidFrom); - } - transactionIdToInfo_.erase(transactionId); - } -} } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/filter/cpu_filter.h b/trace_streamer/src/filter/cpu_filter.h index 701bfe1b0..0c46d93c6 100644 --- a/trace_streamer/src/filter/cpu_filter.h +++ b/trace_streamer/src/filter/cpu_filter.h @@ -21,7 +21,6 @@ #include #include #include -#include #include "filter_base.h" #include "trace_data_cache.h" @@ -56,8 +55,6 @@ public: void InsertWakeupEvent(uint64_t ts, uint32_t internalTid, bool isWaking = false); bool InsertProcessExitEvent(uint64_t ts, uint64_t cpu, uint32_t pid); bool InsertProcessFreeEvent(uint64_t ts, uint32_t pid); - void InsertRunnableBinderEvent(uint32_t transactionId, uint32_t iTid); - void InsertRunnableBinderRecvEvent(uint32_t transactionId, uint32_t iTid); void Finish() const; void Clear(); @@ -67,7 +64,6 @@ private: uint64_t RowOfInternalTidInStateTable(uint32_t uid) const; void ClearInternalTidInStateTable(uint32_t uid); uint64_t StateOfInternalTidInStateTable(uint32_t uid) const; - void TransactionClear(uint32_t iTidFrom, uint32_t transactionId); std::map cpuToRowThreadState_ = {}; typedef struct { uint32_t iTid; @@ -87,15 +83,6 @@ private: const DataIndex caller_ = traceDataCache_->GetDataIndex("caller"); const DataIndex delay_ = traceDataCache_->GetDataIndex("delay"); std::map toRunnableTid_ = {}; - - struct BinderTransactionInfo { - uint32_t iTidFrom; - uint32_t iTidTo; - uint64_t schedSliceRow; - uint64_t threadStateRow; - }; - std::unordered_map iTidToTransaction_; - std::unordered_map transactionIdToInfo_; }; } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/include/BUILD.gn b/trace_streamer/src/include/BUILD.gn index f8cfa79d1..e0981553f 100755 --- a/trace_streamer/src/include/BUILD.gn +++ b/trace_streamer/src/include/BUILD.gn @@ -25,7 +25,6 @@ ohos_source_set("ibase") { include_dirs = [] public_deps = [] deps = [] - sources += [ "/usr/x86_64-w64-mingw32/include/windows.h" ] if (!is_independent_compile) { configs = [ "${TS_DIR}/gn:ts_config" ] } diff --git a/trace_streamer/src/include/dummy/musl/include/elf.h b/trace_streamer/src/include/dummy/musl/include/elf.h new file mode 100644 index 000000000..e69de29bb diff --git a/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp b/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp index 1ed61fff3..90067a300 100644 --- a/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp +++ b/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp @@ -611,11 +611,6 @@ bool BytraceEventParser::BinderTransaction(const ArgsMap& args, const BytraceLin streamFilters_->binderFilter_->SendTraction(line.ts, line.pid, transactionId.value(), destNode.value(), destProc.value(), destThread.value(), isReply.value(), flags.value(), codeStr.value()); - if (traceDataCache_->BinderRunnableTraceEnabled() && transactionId.has_value() && flags.has_value() && - !streamFilters_->binderFilter_->IsAsync(flags.value())) { - streamFilters_->cpuFilter_->InsertRunnableBinderEvent(transactionId.value(), - streamFilters_->processFilter_->GetInternalTid(line.pid)); - } return true; } bool BytraceEventParser::BinderTransactionReceived(const ArgsMap& args, const BytraceLine& line) const @@ -628,10 +623,6 @@ bool BytraceEventParser::BinderTransactionReceived(const ArgsMap& args, const By streamFilters_->statFilter_->IncreaseStat(TRACE_EVENT_BINDER_TRANSACTION_RECEIVED, STAT_EVENT_RECEIVED); auto transactionId = base::StrToInt(args.at("transaction")); streamFilters_->binderFilter_->ReceiveTraction(line.ts, line.pid, transactionId.value()); - if (traceDataCache_->BinderRunnableTraceEnabled() && transactionId.has_value()) { - streamFilters_->cpuFilter_->InsertRunnableBinderRecvEvent( - transactionId.value(), streamFilters_->processFilter_->GetInternalTid(line.pid)); - } TS_LOGD("ts:%lu, pid:%u, transactionId:%lu", line.ts, line.pid, transactionId.value()); return true; } diff --git a/trace_streamer/src/parser/ebpf_parser/BUILD.gn b/trace_streamer/src/parser/ebpf_parser/BUILD.gn index 35dd529d1..866cfe677 100644 --- a/trace_streamer/src/parser/ebpf_parser/BUILD.gn +++ b/trace_streamer/src/parser/ebpf_parser/BUILD.gn @@ -41,28 +41,17 @@ ohos_source_set("ebpf_parser_src") { "${THIRD_PARTY}/sqlite/include", "${THIRD_PARTY}/bounds_checking_function/include", ] + if (is_mingw || is_mac) { + include_dirs += [ "${THIRD_PARTY}/elfutils/libelf" ] + } + public_deps = [ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/memory_data:memory_data_reader" ] - if (is_win || is_macx || is_mingw) { + if (is_win || is_mac || is_mingw) { include_dirs += [ "${THIRD_PARTY}/perf_include/linux", "${THIRD_PARTY}/perf_include/musl", ] } - - if (enable_ts_utest && !use_wasm) { - cflags = [ - "-fprofile-arcs", - "-ftest-coverage", - ] - ldflags = [ - "-fprofile-arcs", - "-ftest-coverage", - "--coverage", - ] - if (is_test) { - cflags += [ "-D IS_UT" ] - } - } } group("ebpf_parser") { diff --git a/trace_streamer/src/parser/hiperf_parser/BUILD.gn b/trace_streamer/src/parser/hiperf_parser/BUILD.gn index bb93335f2..1c4c74e88 100644 --- a/trace_streamer/src/parser/hiperf_parser/BUILD.gn +++ b/trace_streamer/src/parser/hiperf_parser/BUILD.gn @@ -38,12 +38,14 @@ ohos_source_set("hiperf_parser_src") { "${THIRD_PARTY}/protobuf/src", "${THIRD_PARTY}/perf_include", "${THIRD_PARTY}/perf_include/libbpf", - "${COMMON_LIBRARY}/c_utils/base/include", + "//commonlibrary/c_utils/base/include", "${THIRD_PARTY}/googletest/googletest/include", ] include_dirs += [ "${THIRD_PARTY}/libunwind/include" ] - if (is_mingw) { + if (is_mingw || is_mac) { include_dirs += [ "${THIRD_PARTY}/libbpf/include/uapi" ] + } + if (is_mingw) { cflags = [ "-includeMingW64Fix.h" ] } } diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn b/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn index 41df54673..2710dd4c8 100755 --- a/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn +++ b/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn @@ -59,7 +59,6 @@ ohos_source_set("htrace_pbreader_parser_src") { "${PERF_DIR}/hiperf/include", "${PERF_DIR}/hiperf/include/nonlinux/linux", "${PERF_DIR}/hiperf/include/nonlinux", - "${THIRD_PARTY}/musl", "${THIRD_PARTY}/googletest/googletest/include", "${THIRD_PARTY}/perf_include/musl", "${THIRD_PARTY}/perf_include/libbpf", @@ -68,7 +67,15 @@ ohos_source_set("htrace_pbreader_parser_src") { "${THIRD_PARTY}/perf_include/linux", "../hiperf_parser", "../hiperf_parser/include", + "//commonlibrary/c_utils/base/include", + "../../include/dummy/musl", ] + if (is_mingw || is_mac) { + include_dirs += [ + "${THIRD_PARTY}/elfutils/libelf", + "${THIRD_PARTY}/libbpf/include/uapi", + ] + } if (!is_independent_compile) { configs = [ "${TS_DIR}/gn:ts_config" ] @@ -100,7 +107,7 @@ group("htrace_pbreader_parser") { "${THIRD_PARTY}/protobuf:protobuf_static", ] - if (!use_wasm && !is_win && !is_mingw && !is_macx && !is_test) { + if (!use_wasm && !is_win && !is_mingw && !is_mac && !is_test) { if (!is_independent_compile) { if (target_cpu == "arm64") { deps += [ "//third_party/libunwind:unwind_source_arm64_opt" ] diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp index ee4bbdbf7..e17571464 100644 --- a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp +++ b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp @@ -339,10 +339,6 @@ bool HtraceEventParser::BinderTractionEvent(const ProtoReader::DataArea& event) destTid, transactionId, isReply, flags, msg.code()); streamFilters_->binderFilter_->SendTraction(eventTimeStamp_, eventTid_, transactionId, destNode, destTgid, destTid, isReply, flags, msg.code()); - if (traceDataCache_->BinderRunnableTraceEnabled() && !streamFilters_->binderFilter_->IsAsync(flags)) { - streamFilters_->cpuFilter_->InsertRunnableBinderEvent( - transactionId, streamFilters_->processFilter_->GetInternalTid(eventTid_)); - } return true; } bool HtraceEventParser::BinderTractionReceivedEvent(const ProtoReader::DataArea& event) const @@ -351,10 +347,6 @@ bool HtraceEventParser::BinderTractionReceivedEvent(const ProtoReader::DataArea& ProtoReader::BinderTransactionReceivedFormat_Reader msg(event.Data(), event.Size()); int32_t transactionId = msg.debug_id(); streamFilters_->binderFilter_->ReceiveTraction(eventTimeStamp_, eventTid_, transactionId); - if (traceDataCache_->BinderRunnableTraceEnabled()) { - streamFilters_->cpuFilter_->InsertRunnableBinderRecvEvent( - transactionId, streamFilters_->processFilter_->GetInternalTid(eventTid_)); - } TS_LOGD("transactionId:%d", transactionId); return true; } diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_cpu_profiler_parser.cpp b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_cpu_profiler_parser.cpp index 75b01b111..42c743dc2 100644 --- a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_cpu_profiler_parser.cpp +++ b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_cpu_profiler_parser.cpp @@ -48,7 +48,7 @@ void from_json(const json& j, Node& node) j.at("id").get_to(node.id); j.at("callFrame").get_to(node.callFrame); j.at("hitCount").get_to(node.hitCount); - for (int32_t i = 0; i < j["children"].size(); i++) { + for (size_t i = 0; i < j["children"].size(); i++) { int child = j["children"][i]; nodes_.emplace(child, node.id); auto children = std::to_string(child); @@ -94,7 +94,7 @@ void HtraceJsCpuProfilerParser::ParseJsCpuProfiler(std::string result) uint32_t sample = std::numeric_limits::max(); uint64_t sampleEndTime = startTime; uint64_t dur = 0; - for (auto i = 0; i < jMessage.at("samples").size(); i++) { + for (size_t i = 0; i < jMessage.at("samples").size(); i++) { if (sample != std::numeric_limits::max() && sample != jMessage.at("samples")[i]) { dur = (sampleEndTime * TIME_SECOND_COVER) - (startTime * TIME_SECOND_COVER); auto startNewTime = diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.cpp b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.cpp index 3976221f1..09f88c09a 100644 --- a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.cpp +++ b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.cpp @@ -52,13 +52,13 @@ struct Snapshot { }; void from_json(const json& j, Meta& v) { - for (int32_t i = 0; i < j["node_fields"].size(); i++) { + for (size_t i = 0; i < j["node_fields"].size(); i++) { v.nodeFields.emplace_back(j["node_fields"][i]); } - for (int32_t i = 0; i < j["node_types"].size(); i++) { + for (size_t i = 0; i < j["node_types"].size(); i++) { std::vector nodeTypes; if (j["node_types"][i].is_array()) { - for (int32_t m = 0; m < j["node_types"][i].size(); m++) { + for (size_t m = 0; m < j["node_types"][i].size(); m++) { nodeTypes.emplace_back(j["node_types"][i][m]); } v.nodeTypes.emplace_back(nodeTypes); @@ -67,13 +67,13 @@ void from_json(const json& j, Meta& v) v.nodeTypes.emplace_back(nodeTypes); } } - for (int32_t i = 0; i < j["edge_fields"].size(); i++) { + for (size_t i = 0; i < j["edge_fields"].size(); i++) { v.edgeFields.emplace_back(j["edge_fields"][i]); } - for (int32_t i = 0; i < j["edge_types"].size(); i++) { + for (size_t i = 0; i < j["edge_types"].size(); i++) { std::vector edgeTypes; if (j["edge_types"][i].is_array()) { - for (int32_t m = 0; m < j["edge_types"][i].size(); m++) { + for (size_t m = 0; m < j["edge_types"][i].size(); m++) { edgeTypes.emplace_back(j["edge_types"][i][m]); } v.edgeTypes.emplace_back(edgeTypes); @@ -82,16 +82,16 @@ void from_json(const json& j, Meta& v) v.edgeTypes.emplace_back(edgeTypes); } } - for (int32_t i = 0; i < j["trace_function_info_fields"].size(); i++) { + for (size_t i = 0; i < j["trace_function_info_fields"].size(); i++) { v.traceFunctionInfoFields.emplace_back(j["trace_function_info_fields"][i]); } - for (int32_t i = 0; i < j["trace_node_fields"].size(); i++) { + for (size_t i = 0; i < j["trace_node_fields"].size(); i++) { v.traceNodeFields.emplace_back(j["trace_node_fields"][i]); } - for (int32_t i = 0; i < j["sample_fields"].size(); i++) { + for (size_t i = 0; i < j["sample_fields"].size(); i++) { v.sampleFields.emplace_back(j["sample_fields"][i]); } - for (int32_t i = 0; i < j["location_fields"].size(); i++) { + for (size_t i = 0; i < j["location_fields"].size(); i++) { v.locationFields.emplace_back(j["location_fields"][i]); } return; @@ -121,20 +121,20 @@ std::vector g_ids; void from_json(const json& j, Nodes& v) { int32_t edgeIndex = 0; - for (int32_t i = 0; i < j.size() / NODES_SINGLE_LENGTH; i++) { + for (size_t i = 0; i < j.size() / NODES_SINGLE_LENGTH; i++) { v.types.emplace_back(j[i * NODES_SINGLE_LENGTH]); v.names.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_FIRST]); v.ids.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_SECOND]); v.selfSizes.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_THIRD]); v.edgeCounts.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_FOURTH]); - for (int32_t m = edgeIndex; m < edgeIndex + v.edgeCounts.at(i); m++) { + for (size_t m = edgeIndex; m < edgeIndex + v.edgeCounts.at(i); m++) { g_fromNodeIds.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_SECOND]); } edgeIndex += v.edgeCounts.at(i); v.traceNodeIds.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_FIFTH]); v.detachedness.emplace_back(j[i * NODES_SINGLE_LENGTH + OFFSET_SIXTH]); } - for (int32_t m = 0; m < j.size(); m++) { + for (size_t m = 0; m < j.size(); m++) { g_ids.emplace_back(j[m]); } } @@ -150,7 +150,7 @@ const int32_t EDGES_SINGLE_LENGTH = 3; void from_json(const json& j, Edges& v) { v.fromNodeIds = g_fromNodeIds; - for (int32_t i = 0; i < j.size() / EDGES_SINGLE_LENGTH; i++) { + for (size_t i = 0; i < j.size() / EDGES_SINGLE_LENGTH; i++) { v.types.emplace_back(j[i * EDGES_SINGLE_LENGTH]); v.nameOrIndexes.emplace_back(j[i * EDGES_SINGLE_LENGTH + OFFSET_FIRST]); v.toNodes.emplace_back(j[i * EDGES_SINGLE_LENGTH + OFFSET_SECOND]); @@ -168,7 +168,7 @@ struct Location { const int32_t LOCATION_SINGLE_LENGTH = 4; void from_json(const json& j, Location& v) { - for (int32_t i = 0; i < j.size() / LOCATION_SINGLE_LENGTH; i++) { + for (size_t i = 0; i < j.size() / LOCATION_SINGLE_LENGTH; i++) { v.objectIndexes.emplace_back(j[i * LOCATION_SINGLE_LENGTH]); v.scriptIds.emplace_back(j[i * LOCATION_SINGLE_LENGTH + OFFSET_FIRST]); v.lines.emplace_back(j[i * LOCATION_SINGLE_LENGTH + OFFSET_SECOND]); @@ -183,7 +183,7 @@ struct Sample { const int32_t SAMPLE_SINGLE_LENGTH = 2; void from_json(const json& j, Sample& v) { - for (int32_t i = 0; i < j.size() / SAMPLE_SINGLE_LENGTH; i++) { + for (size_t i = 0; i < j.size() / SAMPLE_SINGLE_LENGTH; i++) { v.timestampUs.emplace_back(j[i * SAMPLE_SINGLE_LENGTH]); v.lastAssignedIds.emplace_back(j[i * SAMPLE_SINGLE_LENGTH + OFFSET_FIRST]); } @@ -194,7 +194,7 @@ struct Strings { }; void from_json(const json& j, Strings& v) { - for (int32_t i = 0; i < j.size(); i++) { + for (size_t i = 0; i < j.size(); i++) { v.strings.emplace_back(j[i]); } } @@ -210,7 +210,7 @@ struct TraceFuncInfo { const int32_t TRACE_FUNC_INFO_SINGLE_LENGTH = 6; void from_json(const json& j, TraceFuncInfo& v) { - for (int32_t i = 0; i < j.size() / TRACE_FUNC_INFO_SINGLE_LENGTH; i++) { + for (size_t i = 0; i < j.size() / TRACE_FUNC_INFO_SINGLE_LENGTH; i++) { v.functionIds.emplace_back(j[i * TRACE_FUNC_INFO_SINGLE_LENGTH]); v.names.emplace_back(j[i * TRACE_FUNC_INFO_SINGLE_LENGTH + OFFSET_FIRST]); v.scriptNames.emplace_back(j[i * TRACE_FUNC_INFO_SINGLE_LENGTH + OFFSET_SECOND]); @@ -421,11 +421,11 @@ void HtraceJSMemoryParser::ParserSnapInfo(int32_t fileId, const std::string& key, const std::vector>& types) { - for (int32_t m = 0; m < types[0].size(); ++m) { + for (size_t m = 0; m < types[0].size(); ++m) { (void)traceDataCache_->GetJsHeapInfoData()->AppendNewData(fileId, key, 0, std::numeric_limits::max(), types[0][m]); } - for (int32_t i = 1; i < types.size(); ++i) { + for (size_t i = 1; i < types.size(); ++i) { (void)traceDataCache_->GetJsHeapInfoData()->AppendNewData(fileId, key, 1, std::numeric_limits::max(), types[i][0]); } @@ -451,7 +451,7 @@ void HtraceJSMemoryParser::ParserJSSnapInfo(int32_t fileId, const json& jMessage void HtraceJSMemoryParser::ParseNodes(int32_t fileId, const json& jMessage) { jsonns::Nodes node = jMessage.at("nodes"); - for (int32_t i = 0; i < node.names.size(); ++i) { + for (size_t i = 0; i < node.names.size(); ++i) { auto type = node.types[i]; auto name = node.names[i]; auto id = node.ids[i]; @@ -469,7 +469,7 @@ void HtraceJSMemoryParser::ParseNodes(int32_t fileId, const json& jMessage) void HtraceJSMemoryParser::ParseEdges(int32_t fileId, const json& jMessage) { jsonns::Edges edge = jMessage.at("edges"); - for (int32_t i = 0; i < edge.types.size(); ++i) { + for (size_t i = 0; i < edge.types.size(); ++i) { auto type = edge.types[i]; auto nameOrIndex = edge.nameOrIndexes[i]; auto toNode = edge.toNodes[i]; @@ -484,7 +484,7 @@ void HtraceJSMemoryParser::ParseEdges(int32_t fileId, const json& jMessage) void HtraceJSMemoryParser::ParseLocation(int32_t fileId, const json& jMessage) { jsonns::Location location = jMessage.at("locations"); - for (int32_t i = 0; i < location.columns.size(); ++i) { + for (size_t i = 0; i < location.columns.size(); ++i) { auto objectIndex = location.objectIndexes[i]; auto scriptId = location.scriptIds[i]; auto line = location.lines[i]; @@ -496,7 +496,7 @@ void HtraceJSMemoryParser::ParseLocation(int32_t fileId, const json& jMessage) void HtraceJSMemoryParser::ParseSample(int32_t fileId, const json& jMessage) { jsonns::Sample sample = jMessage.at("samples"); - for (int32_t i = 0; i < sample.timestampUs.size(); ++i) { + for (size_t i = 0; i < sample.timestampUs.size(); ++i) { auto timestampUs = sample.timestampUs[i]; auto lastAssignedId = sample.lastAssignedIds[i]; (void)traceDataCache_->GetJsHeapSampleData()->AppendNewData(fileId, timestampUs, lastAssignedId); @@ -506,7 +506,7 @@ void HtraceJSMemoryParser::ParseSample(int32_t fileId, const json& jMessage) void HtraceJSMemoryParser::ParseString(int32_t fileId, const json& jMessage) { jsonns::Strings string = jMessage.at("strings"); - for (int32_t i = 0; i < string.strings.size(); ++i) { + for (size_t i = 0; i < string.strings.size(); ++i) { (void)traceDataCache_->GetJsHeapStringData()->AppendNewData(fileId, i, string.strings[i]); } return; @@ -514,7 +514,7 @@ void HtraceJSMemoryParser::ParseString(int32_t fileId, const json& jMessage) void HtraceJSMemoryParser::ParseTraceFuncInfo(int32_t fileId, const json& jMessage) { jsonns::TraceFuncInfo traceFuncInfo = jMessage.at("trace_function_infos"); - for (int32_t i = 0; i < traceFuncInfo.functionIds.size(); ++i) { + for (size_t i = 0; i < traceFuncInfo.functionIds.size(); ++i) { auto functionId = traceFuncInfo.functionIds[i]; auto name = traceFuncInfo.names[i]; auto scriptName = traceFuncInfo.scriptNames[i]; @@ -529,7 +529,7 @@ void HtraceJSMemoryParser::ParseTraceFuncInfo(int32_t fileId, const json& jMessa void HtraceJSMemoryParser::ParseTraceNode(int32_t fileId, const json& jMessage) { jsonns::TraceTree traceTree = jMessage.at("trace_tree"); - for (int32_t i = 0; i < traceTree.ids.size(); ++i) { + for (size_t i = 0; i < traceTree.ids.size(); ++i) { auto id = traceTree.ids[i]; auto funcInfoIndex = traceTree.functionInfoIndexes[i]; auto count = traceTree.counts[i]; diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.h b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.h index a3420300d..fb79393de 100644 --- a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.h +++ b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_js_memory_parser.h @@ -50,7 +50,6 @@ private: void ParseTraceNode(int32_t fileId, const json& jMessage); void ParserSnapInfo(int32_t fileId, const std::string& key, const std::vector>& types); int32_t type_ = 0; - int32_t pid_ = 0; const std::string snapshotEnd_ = "{\"id\":1,\"result\":{}}"; const std::string timeLineEnd_ = "{\"id\":2,\"result\":{}}"; const std::string jsCpuProfilerStart_ = "{\"id\":3,\"result\":{}}"; diff --git a/trace_streamer/src/parser/print_event_parser.cpp b/trace_streamer/src/parser/print_event_parser.cpp index 58ba31914..c9b17935f 100644 --- a/trace_streamer/src/parser/print_event_parser.cpp +++ b/trace_streamer/src/parser/print_event_parser.cpp @@ -12,17 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "print_event_parser.h" - -#include - #include "animation_filter.h" #include "clock_filter_ex.h" #include "frame_filter.h" #include "stat_filter.h" #include "string_to_numerical.h" - +#include namespace SysTuning { namespace TraceStreamer { PrintEventParser::PrintEventParser(TraceDataCache* dataCache, const TraceStreamerFilters* filter) diff --git a/trace_streamer/src/rpc/rpc_server.cpp b/trace_streamer/src/rpc/rpc_server.cpp index 4534e46a7..f73103de2 100644 --- a/trace_streamer/src/rpc/rpc_server.cpp +++ b/trace_streamer/src/rpc/rpc_server.cpp @@ -40,14 +40,12 @@ struct ParserConfig { int32_t taskConfigValue; int32_t appConfigValue; int32_t aniConfigValue; - int32_t binderConfigValue; }; void from_json(const json& j, ParserConfig& v) { j.at("TaskPool").get_to(v.taskConfigValue); j.at("AppStartup").get_to(v.appConfigValue); j.at("AnimationAnalysis").get_to(v.aniConfigValue); - j.at("BinderRunnable").get_to(v.binderConfigValue); } } // namespace jsonns bool RpcServer::ParseData(const uint8_t* data, size_t len, ResultCallBack resultCallBack) @@ -285,7 +283,6 @@ bool RpcServer::ParserConfig(std::string parserConfigJson) ts_->UpdateAppStartTraceStatus(parserConfig.appConfigValue); ts_->UpdateAnimationTraceStatus(parserConfig.aniConfigValue); ts_->UpdateTaskPoolTraceStatus(parserConfig.taskConfigValue); - ts_->UpdateBinderRunnableTraceStatus(parserConfig.binderConfigValue); return true; } } // namespace TraceStreamer diff --git a/trace_streamer/src/table/base/table_base.cpp b/trace_streamer/src/table/base/table_base.cpp index 882ecd613..b9bef31a8 100644 --- a/trace_streamer/src/table/base/table_base.cpp +++ b/trace_streamer/src/table/base/table_base.cpp @@ -272,14 +272,14 @@ void TableBase::Cursor::FilterTS(unsigned char op, sqlite3_value* argv, const st case SQLITE_INDEX_CONSTRAINT_LT: { indexMap_->IntersectLessEqual(times, v, getValue); break; - case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: { - indexMap_->RemoveNullElements(times, v); - break; - } - default: - break; - } // end of switch (op) - } + } + case SQLITE_INDEX_CONSTRAINT_ISNOTNULL: { + indexMap_->RemoveNullElements(times, v); + break; + } + default: + break; + } // end of switch (op) } int32_t TableBase::Cursor::RowId(sqlite3_int64* id) diff --git a/trace_streamer/src/trace_data/trace_data_cache.cpp b/trace_streamer/src/trace_data/trace_data_cache.cpp index aee57a4fd..90fbcb26d 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.cpp +++ b/trace_streamer/src/trace_data/trace_data_cache.cpp @@ -321,13 +321,5 @@ void TraceDataCache::UpdateAppStartTraceStatus(bool status) { appStartTraceEnabled_ = status; } -bool TraceDataCache::BinderRunnableTraceEnabled() -{ - return binderRunnableTraceEnabled_; -} -void TraceDataCache::UpdateBinderRunnableTraceStatus(bool status) -{ - binderRunnableTraceEnabled_ = status; -} } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/trace_data/trace_data_cache.h b/trace_streamer/src/trace_data/trace_data_cache.h index 34821819b..3311a02cf 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.h +++ b/trace_streamer/src/trace_data/trace_data_cache.h @@ -37,8 +37,6 @@ public: void UpdateTaskPoolTraceStatus(bool status); bool AppStartTraceEnabled(); void UpdateAppStartTraceStatus(bool status); - bool BinderRunnableTraceEnabled(); - void UpdateBinderRunnableTraceStatus(bool status); private: void InitDB() override; @@ -46,7 +44,6 @@ private: bool animationTraceEnabled_ = false; bool taskPoolTraceEnabled_ = false; bool appStartTraceEnabled_ = false; - bool binderRunnableTraceEnabled_ = false; }; } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/trace_data/trace_data_cache_base.cpp b/trace_streamer/src/trace_data/trace_data_cache_base.cpp index 0bc4ad2d1..497eea8d2 100644 --- a/trace_streamer/src/trace_data/trace_data_cache_base.cpp +++ b/trace_streamer/src/trace_data/trace_data_cache_base.cpp @@ -24,8 +24,7 @@ TraceDataCacheBase::TraceDataCacheBase() internalThreadsData_.emplace_back(0); internalThreadsData_.front().internalPid_ = 0; GetDataIndex(""); - auto it = statusString_.rbegin(); - for (it++; it != statusString_.rend(); it++) { + for (auto it = statusString_.begin(); it != statusString_.end(); it++) { threadStatus2Value_[it->second] = it->first; } } diff --git a/trace_streamer/src/trace_data/trace_data_cache_base.h b/trace_streamer/src/trace_data/trace_data_cache_base.h index 1c10105f9..5d24b475c 100644 --- a/trace_streamer/src/trace_data/trace_data_cache_base.h +++ b/trace_streamer/src/trace_data/trace_data_cache_base.h @@ -23,7 +23,6 @@ #include #include #include "trace_stdtype.h" -#include "ts_common.h" namespace SysTuning { namespace TraceStreamer { using namespace TraceStdtype; @@ -68,8 +67,8 @@ public: {TASK_UNINTERRUPTIBLE_IO, "D-IO"}, {TASK_UNINTERRUPTIBLE_NIO, "D-NIO"}, {TASK_RUNNING, "Running"}, - {TASK_INTERRUPTED, "I"}, - {TASK_TRACED, "T"}, + {TASK_INTERRUPTED, "T"}, + {TASK_TRACED, "t"}, {TASK_EXIT_DEAD, "X"}, {TASK_ZOMBIE, "Z"}, {TASK_CLONE, "I"}, @@ -78,10 +77,9 @@ public: {TASK_DK_IO, "DK-IO"}, {TASK_DK_NIO, "DK-NIO"}, {TASK_TRACED_KILL, "TK"}, - {TASK_WAKEKILL, "R"}, + {TASK_WAKEKILL, "K"}, {TASK_PARKED, "P"}, {TASK_FOREGROUND, "R+"}, - {TASK_RUNNABLE_BINDER, "R-B"}, {TASK_MAX, "S"}, {TASK_INVALID, "U"}}; std::map threadStatus2Value_ = {}; diff --git a/trace_streamer/src/trace_data/trace_stdtype.cpp b/trace_streamer/src/trace_data/trace_stdtype.cpp index a4a8ae17a..8928913a6 100644 --- a/trace_streamer/src/trace_data/trace_stdtype.cpp +++ b/trace_streamer/src/trace_data/trace_stdtype.cpp @@ -142,11 +142,6 @@ void SchedSlice::Update(uint64_t index, uint64_t ts, uint64_t state) endStates_[index] = state; } -void SchedSlice::UpdateEndState(uint64_t index, uint64_t state) -{ - endStates_[index] = state; -} - void SchedSlice::UpdateArg(uint64_t index, uint32_t argsetId) { argSets_[index] = argsetId; diff --git a/trace_streamer/src/trace_data/trace_stdtype.h b/trace_streamer/src/trace_data/trace_stdtype.h index edc6b4121..c12dd700e 100644 --- a/trace_streamer/src/trace_data/trace_stdtype.h +++ b/trace_streamer/src/trace_data/trace_stdtype.h @@ -202,7 +202,6 @@ public: uint64_t priority); void SetDuration(size_t index, uint64_t duration); void Update(uint64_t index, uint64_t ts, uint64_t state); - void UpdateEndState(uint64_t index, uint64_t state); void UpdateArg(uint64_t index, uint32_t argsetId); const std::deque& EndStatesData() const @@ -1941,7 +1940,7 @@ public: void UpdateCallStackSliceId(uint64_t row, uint64_t callStackSliceId); void SetEndTimeAndFlag(uint64_t row, uint64_t ts, uint64_t expectDur, uint64_t expectEnd); void Erase(uint64_t row); - static const uint32_t GetAbnormalStartEndTimeState() + static uint32_t GetAbnormalStartEndTimeState() { return abnormalStartEndTimeState_; } diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp index 2d3748355..785808d78 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp @@ -301,9 +301,5 @@ void TraceStreamerSelector::UpdateAppStartTraceStatus(bool status) { traceDataCache_->UpdateAppStartTraceStatus(status); } -void TraceStreamerSelector::UpdateBinderRunnableTraceStatus(bool status) -{ - traceDataCache_->UpdateBinderRunnableTraceStatus(status); -} } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.h b/trace_streamer/src/trace_streamer/trace_streamer_selector.h index 5f7bd52b2..d71a479ad 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.h +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.h @@ -52,7 +52,6 @@ public: void UpdateAnimationTraceStatus(bool status); void UpdateTaskPoolTraceStatus(bool status); void UpdateAppStartTraceStatus(bool status); - void UpdateBinderRunnableTraceStatus(bool status); private: void InitFilter(); diff --git a/trace_streamer/test/BUILD.gn b/trace_streamer/test/BUILD.gn index 1c4307737..097252ade 100755 --- a/trace_streamer/test/BUILD.gn +++ b/trace_streamer/test/BUILD.gn @@ -144,7 +144,7 @@ if (is_test) { "-fno-use-cxa-atexit", "-DIS_UT", ] - if (is_macx) { + if (is_mac) { lib_dirs = [ "/usr/local/opt/llvm/lib" ] } libs = [ "LLVMCore" ] -- Gitee From 159fb8cb5b14326f627dca35f1f4c45982801a91 Mon Sep 17 00:00:00 2001 From: zhangzepeng Date: Sat, 19 Aug 2023 10:29:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E2=80=99sync.code.by.huawei=E2=80=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzepeng --- trace_streamer/.gitignore | 1 + trace_streamer/BUILD.gn | 5 +- trace_streamer/build/ts.gni | 2 + trace_streamer/gn/BUILD.gn | 11 ---- trace_streamer/gn/CONFIG.gn | 3 - .../patch_googletest/googletestbuild.gn | 16 ------ .../prebuilts/patch_hiperf/BUILD.gn | 5 +- .../patch_libunwind/libunwindbuild.gn | 37 ------------ .../prebuilts/patch_protobuf/protobufbuild.gn | 32 +---------- trace_streamer/src/BUILD.gn | 2 +- trace_streamer/src/base/ts_common.h | 1 + trace_streamer/src/filter/binder_filter.cpp | 4 ++ trace_streamer/src/filter/binder_filter.h | 1 + trace_streamer/src/filter/cpu_filter.cpp | 56 +++++++++++++++++++ trace_streamer/src/filter/cpu_filter.h | 13 +++++ .../bytrace_parser/bytrace_event_parser.cpp | 9 +++ .../src/parser/hiperf_parser/BUILD.gn | 2 +- .../htrace_event_parser.cpp | 8 +++ trace_streamer/src/rpc/rpc_server.cpp | 3 + .../src/trace_data/trace_data_cache.cpp | 8 +++ .../src/trace_data/trace_data_cache.h | 3 + .../src/trace_data/trace_data_cache_base.h | 2 + .../src/trace_data/trace_stdtype.cpp | 5 ++ trace_streamer/src/trace_data/trace_stdtype.h | 1 + .../trace_streamer_selector.cpp | 4 ++ .../trace_streamer/trace_streamer_selector.h | 1 + 26 files changed, 131 insertions(+), 104 deletions(-) diff --git a/trace_streamer/.gitignore b/trace_streamer/.gitignore index d07e5f300..b185167f5 100755 --- a/trace_streamer/.gitignore +++ b/trace_streamer/.gitignore @@ -17,3 +17,4 @@ out.perf perf.data out.floded ./.db +.history \ No newline at end of file diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn index 65879c3c0..58094a421 100644 --- a/trace_streamer/BUILD.gn +++ b/trace_streamer/BUILD.gn @@ -41,12 +41,11 @@ if (!is_independent_compile) { group("trace_streamer_all") { if (host_os == "mac") { deps = [ "src:trace_streamer(//build/toolchain/mac:clang_arm64)" ] - # deps = [ "src:trace_streamer" ] } else { - deps = [ + deps = [ "src:trace_streamer(//build/toolchain/linux:clang_x64)", - "src:trace_streamer(//build/toolchain/ohos:ohos_clang_arm64)", "src:trace_streamer(//build/toolchain/mingw:mingw_x86_64)", + "src:trace_streamer(//build/toolchain/ohos:ohos_clang_arm64)", ] } } diff --git a/trace_streamer/build/ts.gni b/trace_streamer/build/ts.gni index bf1aa4c22..30464b231 100755 --- a/trace_streamer/build/ts.gni +++ b/trace_streamer/build/ts.gni @@ -23,6 +23,7 @@ if (is_independent_compile) { clang_x64_folder = "." enable_ts_utest = target == "test" TS_DIR = "//." + COMMON_LIBRARY = "//commonlibrary" } else { PERF_DIR = "//developtools" with_ebpf_help_table = false @@ -37,6 +38,7 @@ if (is_independent_compile) { enable_ts_utest = false is_fuzz = false TS_DIR = "//developtools/smartperf_host/trace_streamer" + COMMON_LIBRARY = "//commonlibrary" } script_executable = "/usr/bin/env" diff --git a/trace_streamer/gn/BUILD.gn b/trace_streamer/gn/BUILD.gn index 66a39d74a..489954fa1 100755 --- a/trace_streamer/gn/BUILD.gn +++ b/trace_streamer/gn/BUILD.gn @@ -84,21 +84,12 @@ config("default") { "-fstack-protector-strong", "-fstack-protector-all", "-D_FORTIFY_SOURCE=2 -O2", - - # "-D SUPPORTTHREAD", # if support thread - - # "-D HAVE_ELF_H", "-D target_cpu_x64", "-D target_cpu_x86_64", - - # "-D HAVE_LINK_H", - # "-D_GNU_SOURCE", "-DHAVE_CONFIG_H", "-DCC_IS_CLANG", ] libs += [ "z" ] - - # with_libunwind = true } if (!use_wasm && !is_win && !is_mac && !is_test && !is_mingw) { cflags += [ "-D HAVE_LIBUNWIND" ] @@ -109,8 +100,6 @@ config("default") { cflags += [ "-D IS_WASM", "-D GOOGLE_PROTOBUF_NO_RDTSC", - - # "-D HAVE_LIBUNWIND", "-D target_cpu_x64", "-D target_cpu_x86_64", "-DHAVE_CONFIG_H", diff --git a/trace_streamer/gn/CONFIG.gn b/trace_streamer/gn/CONFIG.gn index d0dae36a9..31b988ee0 100755 --- a/trace_streamer/gn/CONFIG.gn +++ b/trace_streamer/gn/CONFIG.gn @@ -107,9 +107,6 @@ set_defaults("ohos_source_set") { configs = default_configs } -# set_defaults("ohos_source_hiperf") { -# configs = hiperf_default_configs -# } set_defaults("ohos_shared_library") { configs = default_configs } diff --git a/trace_streamer/prebuilts/patch_googletest/googletestbuild.gn b/trace_streamer/prebuilts/patch_googletest/googletestbuild.gn index 7ebdd491c..95335b888 100755 --- a/trace_streamer/prebuilts/patch_googletest/googletestbuild.gn +++ b/trace_streamer/prebuilts/patch_googletest/googletestbuild.gn @@ -29,8 +29,6 @@ static_library("gtest") { cflags = [ "-Wno-inconsistent-missing-override", - - # "-Dprivate=public", #allow test code access private members "-fprofile-arcs", "-ftest-coverage", "-Wno-unused-command-line-argument", @@ -86,8 +84,6 @@ static_library("gtest") { sources -= [ "googletest/src/gtest-all.cc" ] public_configs = [ ":gtest_config" ] configs += [ ":gtest_private_config" ] - - # configs -= ["//build/config/coverage:default_coverage"] } static_library("gtest_main") { @@ -96,8 +92,6 @@ static_library("gtest_main") { cflags = [ "-Wno-inconsistent-missing-override", - - # "-Dprivate=public", #allow test code access private members "-fprofile-arcs", "-ftest-coverage", "-Wno-unused-command-line-argument", @@ -109,8 +103,6 @@ static_library("gtest_main") { "-Wno-missing-noreturn", ] public_deps = [ ":gtest" ] - - # configs -= ["//build/config/coverage:default_coverage"] } config("gmock_private_config") { @@ -132,7 +124,6 @@ config("gmock_config") { cflags = [ "-Wno-inconsistent-missing-override", - # "-Dprivate=public", #allow test code access private members "-fprofile-arcs", "-ftest-coverage", "-Wno-unused-command-line-argument", @@ -151,7 +142,6 @@ static_library("gmock") { cflags = [ "-Wno-inconsistent-missing-override", - # "-Dprivate=public", #allow test code access private members "-fprofile-arcs", "-ftest-coverage", "-Wno-unused-command-line-argument", @@ -189,8 +179,6 @@ static_library("gmock") { sources -= [ "googlemock/src/gmock-all.cc" ] public_configs = [ ":gmock_config" ] configs += [ ":gmock_private_config" ] - - # configs -= ["//build/config/coverage:default_coverage"] deps = [ ":gtest" ] } @@ -199,8 +187,6 @@ static_library("gmock_main") { cflags = [ "-Wno-inconsistent-missing-override", - - # "-Dprivate=public", #allow test code access private members "-fprofile-arcs", "-ftest-coverage", "-Wno-unused-command-line-argument", @@ -216,6 +202,4 @@ static_library("gmock_main") { ":gmock", ":gtest", ] - - # configs -= ["//build/config/coverage:default_coverage"] } diff --git a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn index c3733775f..c31ca56f9 100644 --- a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn +++ b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn @@ -43,6 +43,9 @@ ohos_source_set("hiperf_src") { subsystem_name = "developtools" part_name = "smartperf_host" cflags = [ "-D ALWAYSTRUE" ] + if (is_mingw) { + cflags += [ "-includeMingW64Fix.h" ] + } sources = [ "./src/callstack.cpp", "./src/callstack.h", @@ -89,7 +92,7 @@ group("hiperf_platform_common") { deps = [ ":elf", ":hiperf_src", - "${THIRD_PARTY}/protobuf:protobuf_static", "${THIRD_PARTY}/protobuf:protobuf_lite_static", + "${THIRD_PARTY}/protobuf:protobuf_static", ] } diff --git a/trace_streamer/prebuilts/patch_libunwind/libunwindbuild.gn b/trace_streamer/prebuilts/patch_libunwind/libunwindbuild.gn index 426bb8b4d..93f94de8b 100644 --- a/trace_streamer/prebuilts/patch_libunwind/libunwindbuild.gn +++ b/trace_streamer/prebuilts/patch_libunwind/libunwindbuild.gn @@ -213,8 +213,6 @@ libunwind_la_SOURCES_local_nounwind = [ "src/mi/dyn-register.c", "src/mi/Ldyn-extract.c", "src/mi/Lfind_dynamic_proc_info.c", - - # "src/mi/Lget_accessors.c", # miss "src/mi/Lget_proc_info_by_ip.c", "src/mi/Lget_proc_name.c", "src/mi/Lput_dynamic_unwind_info.c", @@ -254,8 +252,6 @@ config("unwind_config_public") { cflags = [ "-D_GNU_SOURCE", "-DHAVE_CONFIG_H", - - # "-DNDEBUG", "-DCC_IS_CLANG", "-fcommon", "-Werror", @@ -274,19 +270,6 @@ config("unwind_config_public") { "-Wno-attributes", "-Wno-pointer-to-int-cast", "-Wno-implicit-function-declaration", - - # "-Wno-absolute-value", - # "-Wno-header-guard", - # "-Wno-tautological-constant-out-of-range-compare", - # "-Wno-sometimes-uninitialized", - # "-Wno-int-to-void-pointer-cast", - ] - } - - if (use_wasm) { - cflags += [ - # "-D __mips__" - # "-D WASM", ] } @@ -339,10 +322,6 @@ config("unwind_config_remote_public") { defines += [ "build_remote=1" ] defines += [ "target_cpu=${target_cpu}" ] - - # defines += [ "host_toolchain=${host_toolchain}" ] - # defines += [ "current_toolchain=${current_toolchain}" ] - # defines += [ "default_toolchain=${default_toolchain}" ] } config("unwind_config_arm") { @@ -435,22 +414,14 @@ ohos_source_set("unwind_source") { sources += arm64_source public_configs = [ ":unwind_config_arm64" ] } else if (target_cpu == "x64") { - # deps = [ "unwind_source_x64" ] sources += x64_source public_configs = [ ":unwind_config_x64" ] - - # public_configs = [ - # ":unwind_config_public", - # ":unwind_config_remote_public", - # ":unwind_config_x64", - # ] } sources += [ "src/os-ohos.c" ] } if (defined(ohos_lite)) { - # shared_library("libunwind") { source_set("libunwind") { deps = [ ":unwind_source" ] public_configs = [ ":unwind_config_public" ] @@ -458,14 +429,6 @@ if (defined(ohos_lite)) { } else { source_set("libunwind") { deps = [ ":unwind_source" ] - - # install_images = [ - # "system", - # "updater", - # ] public_configs = [ ":unwind_config_public" ] - - # part_name = "smartperf_host" - # subsystem_name = "developtools" } } diff --git a/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn b/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn index 31fdfda99..803128c4b 100755 --- a/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn +++ b/trace_streamer/prebuilts/patch_protobuf/protobufbuild.gn @@ -116,9 +116,6 @@ if (use_wasm) { "-D HAVE_PTHREAD", "-std=c++17", ] - - #configs = default_configs - public_configs = [ ":protobuf_config" ] } } else { @@ -136,9 +133,6 @@ if (use_wasm) { "-D HAVE_PTHREAD", "-std=c++17", ] - - # configs = default_configs - public_configs = [ ":protobuf_config" ] } } @@ -158,9 +152,6 @@ if (use_wasm) { ] deps = [ ":protobuf_lite_static" ] - - #configs = default_configs - public_configs = [ ":protobuf_config" ] } } else { @@ -172,14 +163,6 @@ if (use_wasm) { "src", ] - #cflags_cc = [ - # "-Wno-sign-compare", - # "-ftrapv", - # "-fstack-protector-strong", - # "-fstack-protector-all", - # "-D_FORTIFY_SOURCE=2 -O2", - - #] cflags = [ "-Wno-sign-compare", "-D HAVE_PTHREAD", @@ -188,8 +171,6 @@ if (use_wasm) { "-fstack-protector-all", "-D_FORTIFY_SOURCE=2 -O2", "-std=c++17", - - # "-Wl,--disable-new-dtags,--rpath,/libpath1:/libpath2" ] ldflags = [ "-fstack-protector" ] @@ -302,13 +283,6 @@ if (use_wasm) { "$protobuf_dir/**/*.h", "$protobuf_dir/**/*.inc", "src", - - # "/opt/clang-mingw/i686-w64-mingw32/x86_64-linux-gnu", - # "/opt/clang-mingw/i686-w64-mingw32/x86_64-linux-gnu/c++/7", - # "/opt/clang-mingw/i686-w64-mingw32/include/c++/7", - # "/usr/include", - # "/usr/include/c++/7", - # "/usr/include/x86_64-linux-gnu/c++/7", ] if (!use_wasm) { configs = default_configs @@ -317,21 +291,17 @@ if (use_wasm) { "-Wno-sign-compare", "-Wno-unused-function", "-Wno-unused-private-field", - - # "-std=gnu++17", ] cflags = [ "-Wno-sign-compare", "-D HAVE_PTHREAD", "-Wno-unused-function", "-std=c++17", - - # "-Wl,--disable-new-dtags,--rpath,/libpath1:/libpath2" ] deps = [ - ":protobuf_static", ":protobuf_lite_static", + ":protobuf_static", ] public_configs = [ ":protobuf_config" ] diff --git a/trace_streamer/src/BUILD.gn b/trace_streamer/src/BUILD.gn index c993b450c..ab8f4633b 100644 --- a/trace_streamer/src/BUILD.gn +++ b/trace_streamer/src/BUILD.gn @@ -85,7 +85,7 @@ trace_streamer_include = [ "${THIRD_PARTY}/libunwind/src", "${THIRD_PARTY}/perf_include/libbpf", "${THIRD_PARTY}/googletest/googletest/include", - "//commonlibrary/c_utils/base/include", + "${COMMON_LIBRARY}/c_utils/base/include", "//prebuilts/clang/ohos/darwin-arm64/llvm/include/c++/v1", "include/dummy/musl", ] diff --git a/trace_streamer/src/base/ts_common.h b/trace_streamer/src/base/ts_common.h index 908c8fbe9..1464210cc 100644 --- a/trace_streamer/src/base/ts_common.h +++ b/trace_streamer/src/base/ts_common.h @@ -103,6 +103,7 @@ enum EndState { TASK_PARKED = 512, // (R+) Process groups in the foreground TASK_FOREGROUND = 2048, + TASK_RUNNABLE_BINDER = 2049, TASK_MAX = 4096, TASK_INVALID = 9999 }; diff --git a/trace_streamer/src/filter/binder_filter.cpp b/trace_streamer/src/filter/binder_filter.cpp index 6a961fd4e..50188f2d9 100644 --- a/trace_streamer/src/filter/binder_filter.cpp +++ b/trace_streamer/src/filter/binder_filter.cpp @@ -190,6 +190,10 @@ void BinderFilter::TractionUnlock(int64_t ts, uint32_t pid, const std::string& t lastEventTs_.erase(pid); lastEventTs_[pid] = ts; } +bool BinderFilter::IsAsync(int32_t flags) const +{ + return (flags & noReturnMsgFlag_) == noReturnMsgFlag_; +} void BinderFilter::Clear() { lastEventTs_.clear(); diff --git a/trace_streamer/src/filter/binder_filter.h b/trace_streamer/src/filter/binder_filter.h index d50d391df..457dee0b9 100644 --- a/trace_streamer/src/filter/binder_filter.h +++ b/trace_streamer/src/filter/binder_filter.h @@ -45,6 +45,7 @@ public: void TractionLock(int64_t ts, uint32_t pid, const std::string& tag); void TractionLocked(int64_t ts, uint32_t pid, const std::string& tag); void TractionUnlock(int64_t ts, uint32_t pid, const std::string& tag); + bool IsAsync(int32_t flags) const; void Clear(); private: diff --git a/trace_streamer/src/filter/cpu_filter.cpp b/trace_streamer/src/filter/cpu_filter.cpp index dfb354dda..6be217a23 100644 --- a/trace_streamer/src/filter/cpu_filter.cpp +++ b/trace_streamer/src/filter/cpu_filter.cpp @@ -31,10 +31,12 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, uint64_t nextPior, DataIndex nextInfo) { + BinderTransactionInfo btInfo = {prevPid, nextPid, INVALID_UINT64, INVALID_UINT64}; auto index = traceDataCache_->GetSchedSliceData()->AppendSchedSlice(ts, 0, cpu, nextPid, 0, nextPior); auto prevTidOnCpu = cpuToRowSched_.find(cpu); if (prevTidOnCpu != cpuToRowSched_.end()) { traceDataCache_->GetSchedSliceData()->Update(prevTidOnCpu->second.row, ts, prevState); + btInfo.schedSliceRow = prevTidOnCpu->second.row; cpuToRowSched_.at(cpu).row = index; } else { cpuToRowSched_.insert(std::make_pair(cpu, RowPos{nextPid, index})); @@ -83,6 +85,7 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, } auto threadStateRow = traceDataCache_->GetThreadStateData()->AppendThreadState(ts, INVALID_TIME, INVALID_CPU, prevPid, prevState); + btInfo.threadStateRow = threadStateRow; if (prevState == TASK_UNINTERRUPTIBLE || prevState == TASK_DK) { if (!pidToThreadSliceRow.count(prevPid)) { pidToThreadSliceRow.emplace(std::make_pair(prevPid, threadStateRow)); @@ -92,6 +95,16 @@ void CpuFilter::InsertSwitchEvent(uint64_t ts, } (void)RemberInternalTidInStateTable(prevPid, threadStateRow, prevState); } + if (traceDataCache_->BinderRunnableTraceEnabled() && iTidToTransaction_.find(prevPid) != iTidToTransaction_.end()) { + uint64_t transactionId = iTidToTransaction_.at(prevPid); + auto iter = transactionIdToInfo_.find(transactionId); + if (prevState != TASK_FOREGROUND || iter == transactionIdToInfo_.end() || iter->second.iTidFrom != prevPid || + btInfo.schedSliceRow == INVALID_UINT64 || btInfo.threadStateRow == INVALID_UINT64) { + TransactionClear(prevState, transactionId); + return; + } + transactionIdToInfo_[transactionId] = btInfo; + } } bool CpuFilter::InsertBlockedReasonEvent(uint64_t ts, @@ -196,6 +209,8 @@ void CpuFilter::Clear() cpuToRowSched_.clear(); lastWakeUpMsg_.clear(); internalTidToRowThreadState_.clear(); + iTidToTransaction_.clear(); + transactionIdToInfo_.clear(); } void CpuFilter::InsertWakeupEvent(uint64_t ts, uint32_t internalTid, bool isWaking) { @@ -256,5 +271,46 @@ void CpuFilter::CheckWakeupEvent(uint32_t internalTid) } return; } + +void CpuFilter::InsertRunnableBinderEvent(uint32_t transactionId, uint32_t iTid) +{ + if (iTidToTransaction_.find(iTid) != iTidToTransaction_.end()) { + iTidToTransaction_.erase(iTid); + } + iTidToTransaction_.emplace(iTid, transactionId); + if (transactionIdToInfo_.find(transactionId) != transactionIdToInfo_.end()) { + transactionIdToInfo_.erase(transactionId); + } + transactionIdToInfo_.emplace(transactionId, + BinderTransactionInfo{iTid, INVALID_UINT32, INVALID_UINT64, INVALID_UINT64}); +} + +void CpuFilter::InsertRunnableBinderRecvEvent(uint32_t transactionId, uint32_t iTid) +{ + auto iter = transactionIdToInfo_.find(transactionId); + if (iter == transactionIdToInfo_.end()) { + return; + } + if (iter->second.iTidTo == iTid && iter->second.schedSliceRow != INVALID_UINT64 && + iter->second.threadStateRow != INVALID_UINT64) { + traceDataCache_->GetSchedSliceData()->UpdateEndState(iter->second.schedSliceRow, TASK_RUNNABLE_BINDER); + traceDataCache_->GetThreadStateData()->UpdateState(iter->second.threadStateRow, TASK_RUNNABLE_BINDER); + } + TransactionClear(INVALID_UINT32, transactionId); +} + +void CpuFilter::TransactionClear(uint32_t iTidFrom, uint32_t transactionId) +{ + if (iTidToTransaction_.find(iTidFrom) != iTidToTransaction_.end()) { + iTidToTransaction_.erase(iTidFrom); + } + auto iter = transactionIdToInfo_.find(transactionId); + if (iter != transactionIdToInfo_.end()) { + if (iTidToTransaction_.find(iter->second.iTidFrom) != iTidToTransaction_.end()) { + iTidToTransaction_.erase(iter->second.iTidFrom); + } + transactionIdToInfo_.erase(transactionId); + } +} } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/filter/cpu_filter.h b/trace_streamer/src/filter/cpu_filter.h index 0c46d93c6..701bfe1b0 100644 --- a/trace_streamer/src/filter/cpu_filter.h +++ b/trace_streamer/src/filter/cpu_filter.h @@ -21,6 +21,7 @@ #include #include #include +#include #include "filter_base.h" #include "trace_data_cache.h" @@ -55,6 +56,8 @@ public: void InsertWakeupEvent(uint64_t ts, uint32_t internalTid, bool isWaking = false); bool InsertProcessExitEvent(uint64_t ts, uint64_t cpu, uint32_t pid); bool InsertProcessFreeEvent(uint64_t ts, uint32_t pid); + void InsertRunnableBinderEvent(uint32_t transactionId, uint32_t iTid); + void InsertRunnableBinderRecvEvent(uint32_t transactionId, uint32_t iTid); void Finish() const; void Clear(); @@ -64,6 +67,7 @@ private: uint64_t RowOfInternalTidInStateTable(uint32_t uid) const; void ClearInternalTidInStateTable(uint32_t uid); uint64_t StateOfInternalTidInStateTable(uint32_t uid) const; + void TransactionClear(uint32_t iTidFrom, uint32_t transactionId); std::map cpuToRowThreadState_ = {}; typedef struct { uint32_t iTid; @@ -83,6 +87,15 @@ private: const DataIndex caller_ = traceDataCache_->GetDataIndex("caller"); const DataIndex delay_ = traceDataCache_->GetDataIndex("delay"); std::map toRunnableTid_ = {}; + + struct BinderTransactionInfo { + uint32_t iTidFrom; + uint32_t iTidTo; + uint64_t schedSliceRow; + uint64_t threadStateRow; + }; + std::unordered_map iTidToTransaction_; + std::unordered_map transactionIdToInfo_; }; } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp b/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp index 90067a300..1ed61fff3 100644 --- a/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp +++ b/trace_streamer/src/parser/bytrace_parser/bytrace_event_parser.cpp @@ -611,6 +611,11 @@ bool BytraceEventParser::BinderTransaction(const ArgsMap& args, const BytraceLin streamFilters_->binderFilter_->SendTraction(line.ts, line.pid, transactionId.value(), destNode.value(), destProc.value(), destThread.value(), isReply.value(), flags.value(), codeStr.value()); + if (traceDataCache_->BinderRunnableTraceEnabled() && transactionId.has_value() && flags.has_value() && + !streamFilters_->binderFilter_->IsAsync(flags.value())) { + streamFilters_->cpuFilter_->InsertRunnableBinderEvent(transactionId.value(), + streamFilters_->processFilter_->GetInternalTid(line.pid)); + } return true; } bool BytraceEventParser::BinderTransactionReceived(const ArgsMap& args, const BytraceLine& line) const @@ -623,6 +628,10 @@ bool BytraceEventParser::BinderTransactionReceived(const ArgsMap& args, const By streamFilters_->statFilter_->IncreaseStat(TRACE_EVENT_BINDER_TRANSACTION_RECEIVED, STAT_EVENT_RECEIVED); auto transactionId = base::StrToInt(args.at("transaction")); streamFilters_->binderFilter_->ReceiveTraction(line.ts, line.pid, transactionId.value()); + if (traceDataCache_->BinderRunnableTraceEnabled() && transactionId.has_value()) { + streamFilters_->cpuFilter_->InsertRunnableBinderRecvEvent( + transactionId.value(), streamFilters_->processFilter_->GetInternalTid(line.pid)); + } TS_LOGD("ts:%lu, pid:%u, transactionId:%lu", line.ts, line.pid, transactionId.value()); return true; } diff --git a/trace_streamer/src/parser/hiperf_parser/BUILD.gn b/trace_streamer/src/parser/hiperf_parser/BUILD.gn index 1c4c74e88..15a919d37 100644 --- a/trace_streamer/src/parser/hiperf_parser/BUILD.gn +++ b/trace_streamer/src/parser/hiperf_parser/BUILD.gn @@ -38,7 +38,7 @@ ohos_source_set("hiperf_parser_src") { "${THIRD_PARTY}/protobuf/src", "${THIRD_PARTY}/perf_include", "${THIRD_PARTY}/perf_include/libbpf", - "//commonlibrary/c_utils/base/include", + "${COMMON_LIBRARY}/c_utils/base/include", "${THIRD_PARTY}/googletest/googletest/include", ] include_dirs += [ "${THIRD_PARTY}/libunwind/include" ] diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp index e17571464..ee4bbdbf7 100644 --- a/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp +++ b/trace_streamer/src/parser/htrace_pbreader_parser/htrace_event_parser/htrace_event_parser.cpp @@ -339,6 +339,10 @@ bool HtraceEventParser::BinderTractionEvent(const ProtoReader::DataArea& event) destTid, transactionId, isReply, flags, msg.code()); streamFilters_->binderFilter_->SendTraction(eventTimeStamp_, eventTid_, transactionId, destNode, destTgid, destTid, isReply, flags, msg.code()); + if (traceDataCache_->BinderRunnableTraceEnabled() && !streamFilters_->binderFilter_->IsAsync(flags)) { + streamFilters_->cpuFilter_->InsertRunnableBinderEvent( + transactionId, streamFilters_->processFilter_->GetInternalTid(eventTid_)); + } return true; } bool HtraceEventParser::BinderTractionReceivedEvent(const ProtoReader::DataArea& event) const @@ -347,6 +351,10 @@ bool HtraceEventParser::BinderTractionReceivedEvent(const ProtoReader::DataArea& ProtoReader::BinderTransactionReceivedFormat_Reader msg(event.Data(), event.Size()); int32_t transactionId = msg.debug_id(); streamFilters_->binderFilter_->ReceiveTraction(eventTimeStamp_, eventTid_, transactionId); + if (traceDataCache_->BinderRunnableTraceEnabled()) { + streamFilters_->cpuFilter_->InsertRunnableBinderRecvEvent( + transactionId, streamFilters_->processFilter_->GetInternalTid(eventTid_)); + } TS_LOGD("transactionId:%d", transactionId); return true; } diff --git a/trace_streamer/src/rpc/rpc_server.cpp b/trace_streamer/src/rpc/rpc_server.cpp index f73103de2..4534e46a7 100644 --- a/trace_streamer/src/rpc/rpc_server.cpp +++ b/trace_streamer/src/rpc/rpc_server.cpp @@ -40,12 +40,14 @@ struct ParserConfig { int32_t taskConfigValue; int32_t appConfigValue; int32_t aniConfigValue; + int32_t binderConfigValue; }; void from_json(const json& j, ParserConfig& v) { j.at("TaskPool").get_to(v.taskConfigValue); j.at("AppStartup").get_to(v.appConfigValue); j.at("AnimationAnalysis").get_to(v.aniConfigValue); + j.at("BinderRunnable").get_to(v.binderConfigValue); } } // namespace jsonns bool RpcServer::ParseData(const uint8_t* data, size_t len, ResultCallBack resultCallBack) @@ -283,6 +285,7 @@ bool RpcServer::ParserConfig(std::string parserConfigJson) ts_->UpdateAppStartTraceStatus(parserConfig.appConfigValue); ts_->UpdateAnimationTraceStatus(parserConfig.aniConfigValue); ts_->UpdateTaskPoolTraceStatus(parserConfig.taskConfigValue); + ts_->UpdateBinderRunnableTraceStatus(parserConfig.binderConfigValue); return true; } } // namespace TraceStreamer diff --git a/trace_streamer/src/trace_data/trace_data_cache.cpp b/trace_streamer/src/trace_data/trace_data_cache.cpp index 90fbcb26d..aee57a4fd 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.cpp +++ b/trace_streamer/src/trace_data/trace_data_cache.cpp @@ -321,5 +321,13 @@ void TraceDataCache::UpdateAppStartTraceStatus(bool status) { appStartTraceEnabled_ = status; } +bool TraceDataCache::BinderRunnableTraceEnabled() +{ + return binderRunnableTraceEnabled_; +} +void TraceDataCache::UpdateBinderRunnableTraceStatus(bool status) +{ + binderRunnableTraceEnabled_ = status; +} } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/trace_data/trace_data_cache.h b/trace_streamer/src/trace_data/trace_data_cache.h index 3311a02cf..34821819b 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.h +++ b/trace_streamer/src/trace_data/trace_data_cache.h @@ -37,6 +37,8 @@ public: void UpdateTaskPoolTraceStatus(bool status); bool AppStartTraceEnabled(); void UpdateAppStartTraceStatus(bool status); + bool BinderRunnableTraceEnabled(); + void UpdateBinderRunnableTraceStatus(bool status); private: void InitDB() override; @@ -44,6 +46,7 @@ private: bool animationTraceEnabled_ = false; bool taskPoolTraceEnabled_ = false; bool appStartTraceEnabled_ = false; + bool binderRunnableTraceEnabled_ = false; }; } // namespace TraceStreamer } // namespace SysTuning diff --git a/trace_streamer/src/trace_data/trace_data_cache_base.h b/trace_streamer/src/trace_data/trace_data_cache_base.h index 5d24b475c..7af5e6553 100644 --- a/trace_streamer/src/trace_data/trace_data_cache_base.h +++ b/trace_streamer/src/trace_data/trace_data_cache_base.h @@ -23,6 +23,7 @@ #include #include #include "trace_stdtype.h" +#include "ts_common.h" namespace SysTuning { namespace TraceStreamer { using namespace TraceStdtype; @@ -80,6 +81,7 @@ public: {TASK_WAKEKILL, "K"}, {TASK_PARKED, "P"}, {TASK_FOREGROUND, "R+"}, + {TASK_RUNNABLE_BINDER, "R-B"}, {TASK_MAX, "S"}, {TASK_INVALID, "U"}}; std::map threadStatus2Value_ = {}; diff --git a/trace_streamer/src/trace_data/trace_stdtype.cpp b/trace_streamer/src/trace_data/trace_stdtype.cpp index 8928913a6..a4a8ae17a 100644 --- a/trace_streamer/src/trace_data/trace_stdtype.cpp +++ b/trace_streamer/src/trace_data/trace_stdtype.cpp @@ -142,6 +142,11 @@ void SchedSlice::Update(uint64_t index, uint64_t ts, uint64_t state) endStates_[index] = state; } +void SchedSlice::UpdateEndState(uint64_t index, uint64_t state) +{ + endStates_[index] = state; +} + void SchedSlice::UpdateArg(uint64_t index, uint32_t argsetId) { argSets_[index] = argsetId; diff --git a/trace_streamer/src/trace_data/trace_stdtype.h b/trace_streamer/src/trace_data/trace_stdtype.h index c12dd700e..58334ef79 100644 --- a/trace_streamer/src/trace_data/trace_stdtype.h +++ b/trace_streamer/src/trace_data/trace_stdtype.h @@ -202,6 +202,7 @@ public: uint64_t priority); void SetDuration(size_t index, uint64_t duration); void Update(uint64_t index, uint64_t ts, uint64_t state); + void UpdateEndState(uint64_t index, uint64_t state); void UpdateArg(uint64_t index, uint32_t argsetId); const std::deque& EndStatesData() const diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp index 785808d78..d2266184f 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp @@ -289,6 +289,10 @@ void TraceStreamerSelector::SetCancel(bool cancel) { traceDataCache_->SetCancel(cancel); } +void TraceStreamerSelector::UpdateBinderRunnableTraceStatus(bool status) +{ + traceDataCache_->UpdateBinderRunnableTraceStatus(status); +} void TraceStreamerSelector::UpdateAnimationTraceStatus(bool status) { traceDataCache_->UpdateAnimationTraceStatus(status); diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.h b/trace_streamer/src/trace_streamer/trace_streamer_selector.h index d71a479ad..5f7bd52b2 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.h +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.h @@ -52,6 +52,7 @@ public: void UpdateAnimationTraceStatus(bool status); void UpdateTaskPoolTraceStatus(bool status); void UpdateAppStartTraceStatus(bool status); + void UpdateBinderRunnableTraceStatus(bool status); private: void InitFilter(); -- Gitee From a9deaa72a2a7bde23a95d65dcf4b66f0be4f0da0 Mon Sep 17 00:00:00 2001 From: zhangzepeng Date: Sat, 19 Aug 2023 11:38:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E2=80=99codeCheck=E2=80=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzepeng --- trace_streamer/src/include/BUILD.gn | 31 ------------------- .../src/include/dummy/musl/include/elf.h | 0 2 files changed, 31 deletions(-) delete mode 100755 trace_streamer/src/include/BUILD.gn delete mode 100644 trace_streamer/src/include/dummy/musl/include/elf.h diff --git a/trace_streamer/src/include/BUILD.gn b/trace_streamer/src/include/BUILD.gn deleted file mode 100755 index e0981553f..000000000 --- a/trace_streamer/src/include/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import("//build/ohos.gni") -ohos_source_set("ibase") { - subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" - part_name = "${OHOS_PROFILER_PART_NAME}" - sources = [ - "codec_cov.h", - "file.h", - "log.h", - "numerical_to_string.h", - "parting_string.h", - "string_to_numerical.h", - ] - include_dirs = [] - public_deps = [] - deps = [] - if (!is_independent_compile) { - configs = [ "${TS_DIR}/gn:ts_config" ] - } -} diff --git a/trace_streamer/src/include/dummy/musl/include/elf.h b/trace_streamer/src/include/dummy/musl/include/elf.h deleted file mode 100644 index e69de29bb..000000000 -- Gitee From 78a4e4db74159e39e9eb2d68f56c1f099ce7214f Mon Sep 17 00:00:00 2001 From: zhangzepeng Date: Sat, 19 Aug 2023 14:29:33 +0800 Subject: [PATCH 4/4] formatcheck Signed-off-by: zhangzepeng --- trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn b/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn index 2710dd4c8..0c71512f8 100755 --- a/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn +++ b/trace_streamer/src/parser/htrace_pbreader_parser/BUILD.gn @@ -67,7 +67,7 @@ ohos_source_set("htrace_pbreader_parser_src") { "${THIRD_PARTY}/perf_include/linux", "../hiperf_parser", "../hiperf_parser/include", - "//commonlibrary/c_utils/base/include", + "../../../commonlibrary/c_utils/base/include", "../../include/dummy/musl", ] if (is_mingw || is_mac) { -- Gitee