diff --git a/ide/test/base-ui/chart/pie/LitChartPie.test.ts b/ide/test/base-ui/chart/pie/LitChartPie.test.ts
index 1e580fde2edfe2dc2e11bf538e7c4400bb9e11c3..6b727e115dc69d7c8b20299714b7c4aa8a87c448 100644
--- a/ide/test/base-ui/chart/pie/LitChartPie.test.ts
+++ b/ide/test/base-ui/chart/pie/LitChartPie.test.ts
@@ -34,9 +34,9 @@ beforeAll(() => {
jest.spyOn(document.documentElement, 'scrollTop', 'get').mockImplementation(() => fakeWindow.scrollTop);
});
-window.ResizeObserver =
- window.ResizeObserver ||
- jest.fn().mockImplementation(() => ({
+window.ResizeObserver
+ = window.ResizeObserver
+ || jest.fn().mockImplementation(() => ({
disconnect: jest.fn(),
observe: jest.fn(),
unobserve: jest.fn(),
@@ -48,17 +48,6 @@ describe('litChartPie Test', () => {
expect(litChartPie).not.toBeUndefined();
});
- // it('litChartPieTest02', function () {
- // document.body.innerHTML = `
- //
- //
- //
`;
- // let clo = document.getElementById('chart-pie') as LitChartPie;
- // let mouseMoveEvent: MouseEvent = new MouseEvent('mousemove', { movementX: 1, movementY: 2 });
- // // this.cfg!.hoverHandler
- // clo.canvas.dispatchEvent(mouseMoveEvent);
- // });
-
it('litChartPieTest03', function () {
Utils.uuid = jest.fn(() => {
return Math.floor(Math.random() * 10 + 1);
@@ -364,11 +353,6 @@ describe('litChartPie Test', () => {
let mouseOutEvent: MouseEvent = new MouseEvent('mouseout', { movementX: 1, movementY: 2 });
clo.canvas.dispatchEvent(mouseOutEvent);
expect(clo.config).not.toBeUndefined();
- // clo.dataSource = [
- // {pid:1, pName:"1", tid:1, tName:"11", total:12, size:"big core",timeStr:'11'},
- // {pid:2, pName:"2", tid:2, tName: "222", total:13, size:"big core",timeStr:'22'}
- // ]
- // expect(clo.data[0].obj.pid).toBe(2)
});
it('litChartPieTest05', function () {
diff --git a/ide/test/trace/component/trace/base/TraceRow.test.ts b/ide/test/trace/component/trace/base/TraceRow.test.ts
index 969613bd62f97749fd02b248633ad49707a6280f..4a5f8a213b76bff6df534ba784a2fec950b08f8e 100644
--- a/ide/test/trace/component/trace/base/TraceRow.test.ts
+++ b/ide/test/trace/component/trace/base/TraceRow.test.ts
@@ -284,17 +284,9 @@ describe('TraceRow Test', () => {
});
it('TraceRow Test25', () => {
- // let traceRow = new TraceRow({canvasNumber:1,alpha: true, contextId: '2d', isOffScreen: true});
- // traceRow.expansion = false;
- // expect(traceRow.expansion).toBeFalsy();
});
it('TraceRow Test26', () => {
- // let traceRow = new TraceRow({canvasNumber:1,alpha: true, contextId: '2d', isOffScreen: true});
- // traceRow.parentNode = jest.fn(()=>true);
- // traceRow.parentNode.lastChild = jest.fn(()=>true);
- // traceRow.expansion = true;
- // expect(traceRow.expansion).toBeTruthy();
});
it('TraceRow Test27', () => {
diff --git a/ide/test/trace/component/trace/sheet/file-system/TabPaneIOTierStatistics.test.ts b/ide/test/trace/component/trace/sheet/file-system/TabPaneIOTierStatistics.test.ts
index 54489d3f671827e9f04680649a53d2285bd31b4f..51e810bebdd06af2103718579e88ec21f41cf17a 100644
--- a/ide/test/trace/component/trace/sheet/file-system/TabPaneIOTierStatistics.test.ts
+++ b/ide/test/trace/component/trace/sheet/file-system/TabPaneIOTierStatistics.test.ts
@@ -22,19 +22,15 @@ import crypto from 'crypto';
// @ts-ignore
import { TabPaneFilter } from '../../../../../../dist/trace/component/trace/sheet/TabPaneFilter.js';
// @ts-ignore
-import {getTabPaneIOTierStatisticsData} from "../../../../../../dist/trace/database/SqlLite.js";
+import {getTabPaneIOTierStatisticsData} from '../../../../../../dist/trace/database/SqlLite.js';
// @ts-ignore
-window.ResizeObserver =
- window.ResizeObserver ||
- jest.fn().mockImplementation(() => ({
+window.ResizeObserver
+ = window.ResizeObserver
+ || jest.fn().mockImplementation(() => ({
disconnect: jest.fn(),
observe: jest.fn(),
unobserve: jest.fn(),
}));
-//
-// jest.mock('../../../../../../dist/base-ui/table/lit-table.js', () => {
-// return {};
-// });
const sqlit = require('../../../../../../dist/trace/database/SqlLite.js');
jest.mock('../../../../../../dist/trace/database/SqlLite.js');
@@ -46,7 +42,7 @@ Object.defineProperty(global.self, 'crypto', {
});
describe('TabPaneIOTierStatistics Test', () => {
- document.body.innerHTML = ``;
+ document.body.innerHTML = '';
let tabPane = document.querySelector('#io-tier-statistics');
let param = {
@@ -97,52 +93,52 @@ describe('TabPaneIOTierStatistics Test', () => {
let queryResult = sqlit.getTabPaneIOTierStatisticsData;
queryResult.mockResolvedValue([
{
- "pid": 186,
- "pname": "kworker/u8:4",
- "tier": 0,
- "ipid": 2,
- "path": "-",
- "count": 3,
- "allDuration": 19543418,
- "minDuration": 6408209,
- "maxDuration": 6668084,
- "avgDuration": 6514472.66666667
+ 'pid': 186,
+ 'pname': 'kworker/u8:4',
+ 'tier': 0,
+ 'ipid': 2,
+ 'path': '-',
+ 'count': 3,
+ 'allDuration': 19543418,
+ 'minDuration': 6408209,
+ 'maxDuration': 6668084,
+ 'avgDuration': 6514472.66666667
},
{
- "pid": 186,
- "pname": "kworker/u8:4",
- "tier": 0,
- "ipid": 2,
- "path": "/data/thermal/config/configLevel",
- "count": 1,
- "allDuration": 5916167,
- "minDuration": 5916167,
- "maxDuration": 5916167,
- "avgDuration": 5916167
+ 'pid': 186,
+ 'pname': 'kworker/u8:4',
+ 'tier': 0,
+ 'ipid': 2,
+ 'path': '/data/thermal/config/configLevel',
+ 'count': 1,
+ 'allDuration': 5916167,
+ 'minDuration': 5916167,
+ 'maxDuration': 5916167,
+ 'avgDuration': 5916167
},
{
- "pid": 186,
- "pname": "kworker/u8:4",
- "tier": 0,
- "ipid": 2,
- "path": "/data/local/tmp/hiebpf.data",
- "count": 2,
- "allDuration": 9192751,
- "minDuration": 2386417,
- "maxDuration": 6806334,
- "avgDuration": 4596375.5
+ 'pid': 186,
+ 'pname': 'kworker/u8:4',
+ 'tier': 0,
+ 'ipid': 2,
+ 'path': '/data/local/tmp/hiebpf.data',
+ 'count': 2,
+ 'allDuration': 9192751,
+ 'minDuration': 2386417,
+ 'maxDuration': 6806334,
+ 'avgDuration': 4596375.5
},
{
- "pid": 237,
- "pname": "jbd2/mmcblk0p11",
- "tier": 0,
- "ipid": 7,
- "path": "-",
- "count": 7,
- "allDuration": 32377630,
- "minDuration": 2749251,
- "maxDuration": 5033292,
- "avgDuration": 4625375.71428571
+ 'pid': 237,
+ 'pname': 'jbd2/mmcblk0p11',
+ 'tier': 0,
+ 'ipid': 7,
+ 'path': '-',
+ 'count': 7,
+ 'allDuration': 32377630,
+ 'minDuration': 2749251,
+ 'maxDuration': 5033292,
+ 'avgDuration': 4625375.71428571
}
]);
tabPane.data = param;
diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn
index e1328b00628536f9d5dbf61c4e67089336b9ca0a..839a23f8db58935cef8e9b4b095fb2a02026701a 100644
--- a/trace_streamer/BUILD.gn
+++ b/trace_streamer/BUILD.gn
@@ -10,15 +10,9 @@
# 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.
-if (target_os == "ohos") {
- import("//build/ohos.gni")
-} else {
- import("build/ts.gni")
-}
-
+import("build/ts.gni")
group("trace_streamer") {
- if (target_os == "ohos") {
- } else if (is_test) {
+ if (is_test) {
deps = [ "test:unittest" ]
testonly = true
} else if (is_fuzz) {
@@ -27,7 +21,9 @@ group("trace_streamer") {
} else if (is_protoc) {
deps = [ "${THIRD_PARTY}/protobuf:protoc" ]
} else if (is_spb) {
- deps = [ "src/proto_reader/protoc_plugin:protoreader_plugin" ]
+ deps = [
+ "src/proto_reader/protoc_plugin:protoreader_plugin(${host_toolchain})",
+ ]
} else if (is_sdkdemo) {
deps = [ "sdk/demo_sdk:trace_streamer_sdk_builtin" ]
} else if (is_dubai_sdk) {
diff --git a/trace_streamer/build.sh b/trace_streamer/build.sh
index e1cb2f2abd8541dc52739e6f51ac62da334214a6..1a2737acc38f3f2bbe2251c8f3b50446691b542d 100755
--- a/trace_streamer/build.sh
+++ b/trace_streamer/build.sh
@@ -39,15 +39,19 @@ usage="Usage: $basename $0 wasm/test/fuzz/protoc debug/release/clean"
./dl_tools.sh $gn_path
if { [ "$1" == "dubaisdk" ] || [ "$1" == "sdkdemo" ] || [ "$1" == "wasm" ] || [ "$1" == "test" ] || [ "$1" == "fuzz" ]; } && [ "$#" -ne 0 ];then
- if [ ! -f "out/$1/clang_x64/developtools/profiler/protoc" ] && [ "$1" != "protoc" ];then
+ TARGET_DIR=$1
+ if [[ $PARAMS == *"debug"* ]]; then
+ TARGET_DIR=$1"_debug"
+ fi
+ if [ ! -f "out/$TARGET_DIR/clang_x64/developtools/smartperf_host/protoc" ] && [ "$1" != "protoc" ];then
./build.sh protoc
- mkdir -p out/$1/clang_x64/developtools/profiler
- cp out/$target_os/clang_x64/developtools/profiler/protoc out/$1/clang_x64/developtools/profiler/protoc
+ mkdir -p out/$TARGET_DIR/clang_x64/developtools/smartperf_host
+ cp out/$target_os/clang_x64/developtools/smartperf_host/protoc out/$TARGET_DIR/clang_x64/developtools/smartperf_host/protoc
fi
- if [ ! -f "out/$1/clang_x64/developtools/profiler/protoreader_plugin" ] && [ "$1" != "spb" ] && [ -f "out/$1/clang_x64/developtools/profiler/protoc" ];then
+ if [ ! -f "out/$TARGET_DIR/clang_x64/developtools/smartperf_host/protoreader_plugin" ] && [ "$1" != "spb" ] && [ -f "out/$TARGET_DIR/clang_x64/developtools/smartperf_host/protoc" ];then
./build.sh spb
- mkdir -p out/$1/clang_x64/developtools/profiler
- cp out/$target_os/clang_x64/developtools/profiler/protoreader_plugin out/$1/clang_x64/developtools/profiler/protoreader_plugin
+ mkdir -p out/$TARGET_DIR/clang_x64/developtools/smartperf_host
+ cp out/$target_os/clang_x64/developtools/smartperf_host/protoreader_plugin out/$TARGET_DIR/clang_x64/developtools/smartperf_host/protoreader_plugin
fi
fi
if [ $target_os == "windows" ];then
diff --git a/trace_streamer/build/config.gni b/trace_streamer/build/config.gni
index f11538dc9287ef6c83a86717ec401ca1c4f155bb..f287cf24421de871281053d5641a00e956dc2340 100644
--- a/trace_streamer/build/config.gni
+++ b/trace_streamer/build/config.gni
@@ -11,24 +11,3 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("ts.gni")
-asdk_libs_dir="."
-host_toolchain = ""
-OHOS_TRACE_STREAMER_PROTOS_DIR = get_path_info("../src", "abspath")
-OHOS_PROFILER_3RDPARTY_DIR = get_path_info("../third_party/", "abspath")
-OHOS_PROFILER_3RDPARTY_GRPC_DIR = "${OHOS_PROFILER_3RDPARTY_DIR}/grpc"
-OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR = "${OHOS_PROFILER_3RDPARTY_DIR}/protobuf"
-OHOS_PROFILER_3RDPARTY_GOOGLETEST_DIR =
- "${OHOS_PROFILER_3RDPARTY_DIR}/googletest"
-
-OHOS_PROFILER_SUBSYS_NAME = "developtools"
-OHOS_PROFILER_PART_NAME = "profiler"
-OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH = "profiler"
-
-build_l2 = false
-if (getenv("BUILD_L2") == "true") {
- build_l2 = true
-}
-
-declare_args() {
- profiler_SmartPerf = true
-}
diff --git a/trace_streamer/build/protoc.sh b/trace_streamer/build/protoc.sh
index 2dfdf6344faa9d1cd283f2269ff61ae7aa8d869a..7537db2c856f003f6b90f83e37aa82ced84462e5 100755
--- a/trace_streamer/build/protoc.sh
+++ b/trace_streamer/build/protoc.sh
@@ -14,10 +14,12 @@
set -e
THIS_DIR=$(dirname ${BASH_SOURCE[0]})
-PROJECT_TOP=$(realpath $THIS_DIR/../../..)
-TAIL_DIR="developtools/profiler"
+PROJECT_TOP=$(realpath $THIS_DIR/../../../..)
+TAIL_DIR="thirdparty/protobuf"
+SUBSYS_DIR="developtools/smartperf_host"
if [[ $2 == *"developtools"* ]]; then
TAIL_DIR="."
+ SUBSYS_DIR="."
PROJECT_TOP=$(realpath $THIS_DIR/..)
fi
OHOS_X64_OUT=$PROJECT_TOP/$2/
@@ -25,8 +27,8 @@ LIBCXX_X64_OUT=$PROJECT_TOP/$1/ndk/libcxx/linux_x86_64
SUBSYS_X64_OUT=$PROJECT_TOP/$2/$TAIL_DIR
PROTOC=$PROJECT_TOP/$2/$TAIL_DIR/protoc
-OPT_PLUGIN_PROTOREADER_PATH=$PROJECT_TOP/$2/$TAIL_DIR/protoreader_plugin
-OPT_PLUGIN_PROTOREADER="--plugin=protoc-gen-plugin=$PROJECT_TOP/$2/$TAIL_DIR/protoreader_plugin --plugin_out=wrapper_namespace=ProtoReader"
+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"
OPT_OUT=--opt_out
OPT_PROTOREADER_OUT=--cpp_out
PYTHON_SHELL=$THIS_DIR/make_standard_proto.py # shell path
diff --git a/trace_streamer/build/protoc_w.sh b/trace_streamer/build/protoc_w.sh
index 6b1f6e26f84ebcbde0bcd83d38efe27c20454df7..ebc7a8adecb958b818fa1c255fdc0828da45de03 100644
--- a/trace_streamer/build/protoc_w.sh
+++ b/trace_streamer/build/protoc_w.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Copyright (c) 2023 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
diff --git a/trace_streamer/build/ts.gni b/trace_streamer/build/ts.gni
index b15b99276caf0ed973db90dc6afbab3c2f288afe..8c30a926347ac1fa32027813271a8a06950134f7 100755
--- a/trace_streamer/build/ts.gni
+++ b/trace_streamer/build/ts.gni
@@ -10,47 +10,23 @@
# 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("config.gni")
-if (target_os == "linux" || target_os == "macx" || target_os == "windows") {
- clang_x64_folder = "."
- THIRD_PARTY = "//third_party"
- SRC = "//src"
- PREBUILTS = "//prebuilts"
- # kernel_version = "5.10.79_aarch64"
- kernel_version = "."
- if (target == "test") {
- enable_ts_utest = true
- } else {
- enable_ts_utest = false
+declare_args() {
+ profiler_SmartPerf = true
+ is_independent_compile = false
}
- device_kernel_version = "default"
- is_ohos = false
- PERF_DIR = "//third_party"
- OHOS_TRACE_STREAMER_PROTOS_DIR = get_path_info("../src", "abspath")
- OHOS_TRACE_STREAMER_DIR = get_path_info("../", "abspath")
- OHOS_TRACE_STREAMER_DIR_PROTOC= get_path_info("./protoc.sh", "abspath")
-
- if (target_os == "windows") {
- OHOS_TRACE_STREAMER_DIR_PROTOC= get_path_info("./protoc_w.sh", "abspath")
- } else {
- script_executable = "/usr/bin/env"
- }
- OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR = get_path_info("../third_party/protobuf", "abspath")
+if (is_independent_compile) {
+ asdk_libs_dir="."
+ host_toolchain = ""
+ PERF_DIR = "//third_party"
+ clang_x64_folder = "."
+ enable_ts_utest = (target == "test")
} else {
- script_executable = "/usr/bin/env"
- clang_x64_folder = "clang_x64"
+ PERF_DIR = "//developtools"
with_ebpf_help_table = false
- OHOS_TRACE_STREAMER_DIR = get_path_info("..", "abspath")
- OHOS_TRACE_STREAMER_DIR_PROTOC= get_path_info("/protoc.sh", "abspath")
- THIRD_PARTY = get_path_info("../../../../../../third_party/", "abspath")
- PERF_DIR = get_path_info("../../../../../", "abspath")
- SRC = "${OHOS_TRACE_STREAMER_DIR}/src"
- PREBUILTS = "${OHOS_TRACE_STREAMER_DIR}/prebuilts"
- target = "trace_steamer"
+ clang_x64_folder = "clang_x64"
is_macx = false
- with_perf = true
is_test = false
is_protoc = false
is_spb = false
@@ -58,12 +34,34 @@ if (target_os == "linux" || target_os == "macx" || target_os == "windows") {
is_dubai_sdk = false
is_sdkdemo_test = false
use_wasm = false
- enable_ts_utest = true
- kernel_version = "."
+ enable_ts_utest = false
is_fuzz = false
- target = "trace_streamer"
- is_ohos = true
}
-if (is_ohos) {
- import("../../../../build/config.gni")
-}
\ No newline at end of file
+
+script_executable = "/usr/bin/env"
+device_kernel_version = "default"
+OHOS_TRACE_STREAMER_PROTOS_DIR = get_path_info("../src", "abspath")
+
+OHOS_TRACE_STREAMER_DIR = get_path_info("../", "abspath")
+SRC = "${OHOS_TRACE_STREAMER_DIR}/src"
+PREBUILTS = "//prebuilts"
+THIRD_PARTY = "//third_party"
+kernel_version = "."
+
+OHOS_TRACE_STREAMER_DIR_PROTOC= get_path_info("./protoc.sh", "abspath")
+
+if (target_os == "windows") {
+ OHOS_TRACE_STREAMER_DIR_PROTOC= get_path_info("./protoc_w.sh", "abspath")
+}
+
+OHOS_PROFILER_3RDPARTY_GRPC_DIR = "${THIRD_PARTY}/grpc"
+OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR = "${THIRD_PARTY}/protobuf"
+OHOS_PROFILER_3RDPARTY_GOOGLETEST_DIR = "${THIRD_PARTY}/googletest"
+OHOS_PROFILER_SUBSYS_NAME = "developtools"
+OHOS_PROFILER_PART_NAME = "smartperf_host"
+OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH = "smartperf_host"
+
+build_l2 = false
+if (getenv("BUILD_L2") == "true") {
+ build_l2 = true
+}
diff --git a/trace_streamer/build_operator.sh b/trace_streamer/build_operator.sh
index ac4a134e4bead3717f1150ecb2732e4000fbc595..8b1068fbdc6615975a3225c31b8bfd60c5737c31 100755
--- a/trace_streamer/build_operator.sh
+++ b/trace_streamer/build_operator.sh
@@ -15,7 +15,7 @@ set -e
ext="/clang_x64"
target_dir="linux"
subsys_name="developtools"
-part_name="profiler"
+part_name="smartperf_host"
is_debug="$1"
target="$2"
target_os="$3"
@@ -78,7 +78,7 @@ if [ "$is_clean" == "true" ];then
prebuilts/$gn_path/$gn gen out/"$target_dir""$ext"/$subsys_name/$part_name --clean
prebuilts/$gn_path/$ninja -C out/"$target_dir""$ext"/$subsys_name/$part_name -t clean
else
- prebuilts/$gn_path/$gn gen out/"$target_dir""$ext"/$subsys_name/$part_name --args='is_debug='"$is_debug"' target="'"$target"'" target_os="'"$target_os"'"'
+ prebuilts/$gn_path/$gn gen out/"$target_dir""$ext"/$subsys_name/$part_name --args='is_debug='"$is_debug"' target="'"$target"'" target_os="'"$target_os"'" is_independent_compile=true'
echo "begin to build ..."
mkdir -p out/windows
touch out/windows/trace_streamer.exe
diff --git a/trace_streamer/gn/BUILD.gn b/trace_streamer/gn/BUILD.gn
index 5a02ff778dbdd5be4a5c95b6d645661fa48fb373..be63ea1d678978e9ba4eebd86c29d42fcfe63c19 100755
--- a/trace_streamer/gn/BUILD.gn
+++ b/trace_streamer/gn/BUILD.gn
@@ -137,9 +137,6 @@ config("default") {
"-D __KERNEL__",
]
}
- if (with_perf) {
- cflags += [ "-D WITH_PERF" ]
- }
if (with_ebpf_help_table) {
cflags += [ "-D WITH_EBPF_HELP" ]
}
diff --git a/trace_streamer/gn/CONFIG.gn b/trace_streamer/gn/CONFIG.gn
index 8b4791d99bd2babdfa2e11ba5c704ce80c6a90ca..29d63b33ec2fd0de180e958b2d80b70575aa1ac3 100755
--- a/trace_streamer/gn/CONFIG.gn
+++ b/trace_streamer/gn/CONFIG.gn
@@ -14,7 +14,6 @@ is_win = false
is_linux = false
is_macx = false
is_protoc = false
-with_perf = true
with_ebpf_help_table = false
is_mingw = false
with_libunwind = false
diff --git a/trace_streamer/gn/toolchain/BUILD.gn b/trace_streamer/gn/toolchain/BUILD.gn
index 3b31509464aa0660a9b73a9d08b4865bff5d292d..37f5bc3d01272d238493b786cb65d93443e36f10 100755
--- a/trace_streamer/gn/toolchain/BUILD.gn
+++ b/trace_streamer/gn/toolchain/BUILD.gn
@@ -14,12 +14,12 @@
import("//gn/wasm.gni")
declare_args() {
if (target_os == "linux" || target_os == "macx") {
- cc = "/usr/bin/clang"
- cxx = "/usr/bin/clang++"
+ cc = "clang"
+ cxx = "clang++"
pic = "-fPIC"
rebuild_string = ""
extra_asmflags = ""
- asm = "/usr/bin/clang"
+ asm = "clang"
} else if (target_os == "windows") {
cc = "gcc.exe"
cxx = "g++.exe"
diff --git a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn
index f2869ab4972507ae8ec6fce980b5d78dc8152038..f724fe22e75b2d7e997a7b55faedb99724be1603 100644
--- a/trace_streamer/prebuilts/patch_hiperf/BUILD.gn
+++ b/trace_streamer/prebuilts/patch_hiperf/BUILD.gn
@@ -82,7 +82,7 @@ ohos_source_set("hiperf_src") {
]
}
-group("hiperf") {
+group("hiperf_platform_common") {
deps = [
":elf",
":hiperf_src",
diff --git a/trace_streamer/sdk/demo_sdk/BUILD.gn b/trace_streamer/sdk/demo_sdk/BUILD.gn
index 498c279f9c8f0c6166c83c1eb638d4d6f5403706..97ea1db69f3d27b763e1971b55bf5f7d714f8109 100755
--- a/trace_streamer/sdk/demo_sdk/BUILD.gn
+++ b/trace_streamer/sdk/demo_sdk/BUILD.gn
@@ -52,9 +52,6 @@ ohos_source_set("lib") {
"${THIRD_PARTY}/protobuf/src",
]
public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ]
- if (with_perf) {
- include_dirs += []
- }
}
ohos_source_set("trace_streamer_sdk") {
subsystem_name = "trace_streamer"
@@ -116,18 +113,12 @@ ohos_source_set("trace_streamer_sdk") {
"${THIRD_PARTY}/libunwind/src",
]
}
- if (with_perf) {
- sources += []
- include_dirs += []
- }
deps = [
"${SRC}/base:base",
"${THIRD_PARTY}/sqlite:sqlite",
"plugin:sdk_plugin",
]
public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ]
- if (with_perf) {
- }
if (use_wasm || enable_ts_utest) {
sources += [
diff --git a/trace_streamer/sdk/dubai_sdk/BUILD.gn b/trace_streamer/sdk/dubai_sdk/BUILD.gn
index 3f1f9124860bd3b9e49df24f312fd79f69bb4565..beff5bb07192c96d2235354766f7b25da0e14ef8 100755
--- a/trace_streamer/sdk/dubai_sdk/BUILD.gn
+++ b/trace_streamer/sdk/dubai_sdk/BUILD.gn
@@ -52,9 +52,6 @@ ohos_source_set("lib") {
"${THIRD_PARTY}/sqlite/include",
"${THIRD_PARTY}/protobuf/src",
]
- if (with_perf) {
- include_dirs += []
- }
public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ]
}
source_set("trace_streamer_sdk") {
@@ -115,17 +112,11 @@ source_set("trace_streamer_sdk") {
"${THIRD_PARTY}/libunwind/src",
]
}
- if (with_perf) {
- sources += []
- include_dirs += []
- }
deps = [
"${SRC}/base:base",
"${THIRD_PARTY}/sqlite:sqlite",
"plugin:sdk_plugin",
]
- if (with_perf) {
- }
if (use_wasm || enable_ts_utest) {
sources += [
diff --git a/trace_streamer/src/BUILD.gn b/trace_streamer/src/BUILD.gn
index f589630fec4ed0de12e8e37dfba26cdd4dedc86d..3ca2bc372f4c2c1e899bcfb870f65f172b77b8e8 100644
--- a/trace_streamer/src/BUILD.gn
+++ b/trace_streamer/src/BUILD.gn
@@ -11,74 +11,83 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("../build/ohos.gni")
+import("//build/ohos.gni")
import("../build/ts.gni")
if (use_wasm) {
import("//gn/wasm.gni")
}
-if (use_wasm) {
- ohos_source_set("trace_streamer_builtin") {
- subsystem_name = "trace_streamer"
- part_name = "src"
- sources = []
- include_dirs = []
- deps = []
- public_deps = []
- }
-}
-ohos_source_set("lib") {
- subsystem_name = "trace_streamer"
- part_name = "lib"
- sources = [ "main.cpp" ]
- deps = [
- ":trace_streamer_source",
- "proto_reader:proto_reader",
- ]
- include_dirs = [
- "base",
- "..",
- "trace_streamer",
- "filter",
- "table",
- "trace_data",
- "include",
- "rpc",
- "./",
- "parser",
- "cfg",
- "proto_reader/include",
- "${THIRD_PARTY}/sqlite/include",
- "${THIRD_PARTY}/json-master/single_include/nlohmann",
- "${THIRD_PARTY}/protobuf/src",
- "${THIRD_PARTY}/hiperf/include",
- ]
- include_dirs += [
- "parser/htrace_pbreader_parser",
- "parser/htrace_pbreader_parser/htrace_event_parser",
- "parser/htrace_pbreader_parser/htrace_cpu_parser",
+ohos_source_set("ts_sqlite") {
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
+ sources = [ "//third_party/sqlite/src/sqlite3.c" ]
+ include_dirs = [ "//third_party/sqlite/include" ]
+ cflags = [
+ "-Wno-shorten-64-to-32",
+ "-Wno-double-promotion",
+ "-Wno-disabled-macro-expansion",
+ "-Wno-float-equal",
+ "-Wno-cast-qual",
+ "-Wno-conversion",
+ "-Wno-cast-align",
+ "-Wno-unused-macros",
+ "-Wno-comma",
+ "-Wno-unreachable-code-break",
+ "-Wno-unreachable-code",
+ "-Wno-unreachable-code-return",
+ "-DSQLITE_THREADSAFE=1",
+ "-DQLITE_DEFAULT_MEMSTATUS=0",
+ "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS",
+ "-DSQLITE_OMIT_DEPRECATED",
+ "-DSQLITE_OMIT_SHARED_CACHE",
+ "-DHAVE_USLEEP",
+ "-DHAVE_UTIME",
+ "-DSQLITE_BYTEORDER=1234",
+ "-DSQLITE_DEFAULT_AUTOVACUUM=0",
+ "-DSQLITE_DEFAULT_MMAP_SIZE=0",
+ "-DSQLITE_CORE",
+ "-DSQLITE_TEMP_STORE=3",
+ "-DSQLITE_OMIT_LOAD_EXTENSION",
]
-
- if (with_perf) {
- include_dirs += [
- "parser/hiperf_parser",
- "${THIRD_PARTY}/hiperf/include",
- "${THIRD_PARTY}/hiperf/include/nonlinux",
- "${THIRD_PARTY}/hiperf/include/nonlinux/linux",
- "${THIRD_PARTY}/perf_include/musl",
- ]
- }
- public_deps = []
- if (!use_wasm && !is_test && !is_fuzz) {
- public_deps += [
- "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protoc",
- "proto_reader/protoc_plugin:protoreader_plugin",
- ]
- }
}
+
+trace_streamer_include = [
+ "base",
+ "..",
+ "trace_streamer",
+ "filter",
+ "table",
+ "trace_data",
+ "include",
+ "rpc",
+ "./",
+ "parser",
+ "cfg",
+ "proto_reader/include",
+ "parser/ebpf_parser",
+ "parser/htrace_pbreader_parser",
+ "parser/htrace_pbreader_parser/htrace_event_parser",
+ "parser/htrace_pbreader_parser/htrace_cpu_parser",
+ "parser/hiperf_parser",
+ "//developtools/hiperf/include",
+ "${THIRD_PARTY}/sqlite/include",
+ "${THIRD_PARTY}/json-master/single_include/nlohmann",
+ "${THIRD_PARTY}/json/single_include/nlohmann",
+ "${THIRD_PARTY}/protobuf/src",
+ "${THIRD_PARTY}/hiperf/include",
+ "${THIRD_PARTY}/hiperf/include/nonlinux",
+ "${THIRD_PARTY}/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",
+]
+
ohos_source_set("trace_streamer_source") {
- subsystem_name = "trace_streamer"
- part_name = "trace_streamer_source"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
sources = [
"cfg/trace_streamer_config.cpp",
"cfg/trace_streamer_config.h",
@@ -91,87 +100,31 @@ ohos_source_set("trace_streamer_source") {
"trace_streamer/trace_streamer_selector.h",
"version.cpp",
]
- include_dirs = [
- "base",
- "..",
- "trace_streamer",
- "filter",
- "table",
- "trace_data",
- "include",
- "rpc",
- "./",
- "parser",
- "cfg",
- "proto_reader/include",
- "parser/ebpf_parser",
- "${THIRD_PARTY}/sqlite/include",
- "${THIRD_PARTY}/protobuf/src",
- ]
+ if (!is_test && !is_fuzz) {
+ sources += [ "main.cpp" ]
+ }
+ if (use_wasm) {
+ sources += [
+ "rpc/wasm_func.cpp",
+ "rpc/wasm_func.h",
+ ]
+ }
+
+ include_dirs = trace_streamer_include
if (use_wasm) {
include_dirs +=
[ "../prebuilts/emsdk/emsdk/emscripten/cache/sysroot/include" ]
}
- if (is_macx && !is_test) {
- cflags = [ "-D_XOPEN_SOURCE=600" ]
- }
if (is_test) {
include_dirs += [ "../prebuilts/emsdk/emsdk/emscripten/system/include" ]
}
- include_dirs += [
- "parser/htrace_pbreader_parser",
- "parser/htrace_pbreader_parser/htrace_event_parser",
- "parser/htrace_pbreader_parser/htrace_cpu_parser",
- ]
-
- include_dirs += [
- "${THIRD_PARTY}/libunwind/include",
- "${THIRD_PARTY}/libunwind/src",
- "${THIRD_PARTY}/json-master/single_include/nlohmann",
- "${THIRD_PARTY}/hiperf/include",
- "${THIRD_PARTY}/hiperf/include/nonlinux/linux",
- "${THIRD_PARTY}/hiperf/include/nonlinux",
- ]
-
- if (with_perf) {
- include_dirs += [
- "parser/hiperf_parser",
- "${THIRD_PARTY}/perf_include/libbpf",
- "${THIRD_PARTY}/perf_include/musl",
- ]
- }
- public_deps = [
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/services:all_type_cpp_standard",
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/cpu_data:cpu_data_encoder",
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_encoder",
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hilog_data:hilog_data_encoder",
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hisysevent_data:hisysevent_data_encoder",
- "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/memory_data:memory_data_encoder",
- ]
-
- deps = [
- "${THIRD_PARTY}/sqlite:sqlite",
- "base:base",
- "filter:filter",
- "parser:parser",
- "table:table",
- "trace_data:trace_data",
- ]
- if (with_perf) {
- deps += [ "parser/hiperf_parser:hiperf_parser" ]
- } else {
- deps += [ "${THIRD_PARTY}/hiperf:elf" ]
- }
-
- if (use_wasm) {
- sources += [
- "rpc/wasm_func.cpp",
- "rpc/wasm_func.h",
- ]
+ cflags = [ "-D target_cpu_${target_cpu}" ]
+ if (!use_wasm && !is_win && !is_macx && !is_test) {
+ cflags += [ "-D HAVE_LIBUNWIND" ]
}
if (enable_ts_utest && !use_wasm) {
- cflags = [
+ cflags += [
"-fprofile-arcs",
"-ftest-coverage",
]
@@ -184,16 +137,55 @@ ohos_source_set("trace_streamer_source") {
cflags += [ "-D IS_UT" ]
}
}
+
+ public_deps = [
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/services:ts_all_type_cpp_standard",
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/cpu_data:cpu_data_reader",
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_reader",
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hilog_data:hilog_data_reader",
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/hisysevent_data:hisysevent_data_reader",
+ "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/memory_data:memory_data_reader",
+ ]
+ if (!use_wasm && !is_test && !is_fuzz) {
+ public_deps += [
+ "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protoc(${host_toolchain})",
+ "proto_reader/protoc_plugin:protoreader_plugin(${host_toolchain})",
+ ]
+ }
+
+ deps = [
+ ":ts_sqlite",
+ "base:base",
+ "filter:filter",
+ "parser:parser",
+ "parser/hiperf_parser:hiperf_parser",
+ "proto_reader:proto_reader",
+ "table:table",
+ "trace_data:trace_data",
+ ]
}
+
if (use_wasm) {
+ ohos_source_set("trace_streamer_builtin") {
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
+ sources = []
+ include_dirs = []
+ deps = []
+ public_deps = []
+ }
wasm_lib("trace_streamer_builtin_wasm") {
name = "trace_streamer_builtin"
- deps = [ ":lib" ]
+ deps = [ ":trace_streamer_source" ]
}
} else {
if (!is_test && !is_fuzz) {
- executable("trace_streamer") {
- deps = [ ":lib" ]
+ ohos_executable("trace_streamer") {
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
+ sources = []
+ include_dirs = trace_streamer_include
+ deps = [ ":trace_streamer_source" ]
}
}
}
diff --git a/trace_streamer/src/base/BUILD.gn b/trace_streamer/src/base/BUILD.gn
index 547d2d8837df76d1bef8c4dd3c287e72cc86ca08..643a88e32336a68b3f641843acc0b84bbd68405a 100644
--- a/trace_streamer/src/base/BUILD.gn
+++ b/trace_streamer/src/base/BUILD.gn
@@ -14,8 +14,8 @@
import("//build/ohos.gni")
import("../../build/ts.gni")
ohos_source_set("base") {
- subsystem_name = "trace_streamer"
- part_name = "trace_streamer_source_base"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
deps = [
":base_parser",
":base_table",
@@ -44,13 +44,13 @@ ohos_source_set("base") {
}
}
ohos_source_set("string_help") {
- subsystem_name = "trace_streamer"
- part_name = "string_help"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
sources = [ "string_help.cpp" ]
}
ohos_source_set("ibase") {
- subsystem_name = "trace_streamer"
- part_name = "ibase"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
sources = [
"codec_cov.h",
"file.h",
@@ -65,8 +65,8 @@ ohos_source_set("ibase") {
sources += [ "/usr/x86_64-w64-mingw32/include/windows.h" ]
}
ohos_source_set("base_parser") {
- subsystem_name = "trace_streamer"
- part_name = "parser"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
sources = [
"htrace_plugin_time_parser.cpp",
"htrace_plugin_time_parser.h",
@@ -76,8 +76,8 @@ ohos_source_set("base_parser") {
deps = []
}
ohos_source_set("base_table") {
- subsystem_name = "trace_streamer"
- part_name = "table"
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ part_name = "${OHOS_PROFILER_PART_NAME}"
sources = [
"filter_constraints.cpp",
"index_map.cpp",
diff --git a/trace_streamer/src/base/clock_filter.cpp b/trace_streamer/src/base/clock_filter.cpp
index e527e874b8be19ddc93dbf23d5a2c735f26ac294..9fce0b5314984c61e2bacb9738553eb0d9f0f4ff 100644
--- a/trace_streamer/src/base/clock_filter.cpp
+++ b/trace_streamer/src/base/clock_filter.cpp
@@ -16,6 +16,7 @@
#include "clock_filter.h"
#include
#include