From b259e21b94cfcd36ea830759b1b03349d555df2f Mon Sep 17 00:00:00 2001 From: jichuan Date: Wed, 5 Jul 2023 10:19:47 +0800 Subject: [PATCH 1/5] add bundle.json Signed-off-by: jichuan --- bundle.json | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bundle.json diff --git a/bundle.json b/bundle.json new file mode 100644 index 000000000..a8adc5b75 --- /dev/null +++ b/bundle.json @@ -0,0 +1,39 @@ +{ + "name": "@ohos/smartperf_host", + "description": "xxx", + "version": "xxx", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "developtools/smartperf_host" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "smartperf_host", + "subsystem": "developtools", + "adapted_system_type": [ + "standard" + ], + "rom": "xxxKB", + "ram": "xxxKB", + "deps": { + "components": [ + "c_utils" + ], + "third_party": [ + "zlib", + "libsec_static", + "bounds_checking_function", + "protobuf", + "libunwind", + "sqlite" + ] + }, + "build": { + "sub_component": [ + "//developtools/smartperf_host/trace_streamer:trace_streamer" + ] + } + } +} \ No newline at end of file -- Gitee From 148ff2e54007a8a4aad1b6688229dfa17721ff0f Mon Sep 17 00:00:00 2001 From: jichuan Date: Wed, 5 Jul 2023 10:22:49 +0800 Subject: [PATCH 2/5] add patches.json Signed-off-by: jichuan --- patches/patches.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 patches/patches.json diff --git a/patches/patches.json b/patches/patches.json new file mode 100644 index 000000000..65982b06f --- /dev/null +++ b/patches/patches.json @@ -0,0 +1,9 @@ +{ + "patches": [ + { + "project": "productdefine_common", + "patch_file": "productdefine_common.patch", + "path": "productdefine/common" + } + ] +} \ No newline at end of file -- Gitee From 80800517f48da1a5dc4ba7d45765cb1d1a9fd1c6 Mon Sep 17 00:00:00 2001 From: jichuan Date: Wed, 5 Jul 2023 10:30:23 +0800 Subject: [PATCH 3/5] add patch Signed-off-by: jichuan --- patches/productdefine_common.patch | 83 ++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 patches/productdefine_common.patch diff --git a/patches/productdefine_common.patch b/patches/productdefine_common.patch new file mode 100644 index 000000000..9f5006785 --- /dev/null +++ b/patches/productdefine_common.patch @@ -0,0 +1,83 @@ +diff --git a/inherit/default.json b/inherit/default.json +index 3621e9e..d894aae 100644 +--- a/inherit/default.json ++++ b/inherit/default.json +@@ -461,7 +461,11 @@ + { + "component": "packing_tool", + "features": [] +- } ++ }, ++ { ++ "component": "smartperf_host", ++ "features": [] ++ } + ] + }, + { +diff --git a/inherit/ipcamera.json b/inherit/ipcamera.json +index 4075a32..e74bfbc 100644 +--- a/inherit/ipcamera.json ++++ b/inherit/ipcamera.json +@@ -449,6 +449,10 @@ + { + "component": "hiperf", + "features": [] ++ }, ++ { ++ "component": "smartperf_host", ++ "features": [] + } + ] + }, +diff --git a/inherit/pc.json b/inherit/pc.json +index 89392c5..fffd9e9 100644 +--- a/inherit/pc.json ++++ b/inherit/pc.json +@@ -461,7 +461,11 @@ + { + "component": "packing_tool", + "features": [] +- } ++ }, ++ { ++ "component": "smartperf_host", ++ "features": [] ++ } + ] + }, + { +diff --git a/inherit/rich.json b/inherit/rich.json +index 5013860..09cce24 100644 +--- a/inherit/rich.json ++++ b/inherit/rich.json +@@ -469,7 +469,11 @@ + { + "component": "packing_tool", + "features": [] +- } ++ }, ++ { ++ "component": "smartperf_host", ++ "features": [] ++ } + ] + }, + { +diff --git a/inherit/tablet.json b/inherit/tablet.json +index 1e0e322..4281d5f 100644 +--- a/inherit/tablet.json ++++ b/inherit/tablet.json +@@ -428,7 +428,11 @@ + { + "component": "packing_tool", + "features": [] +- } ++ }, ++ { ++ "component": "smartperf_host", ++ "features": [] ++ } + ] + }, + { -- Gitee From 0419d085f2d82946ed8b3d91a886ac8c7c040897 Mon Sep 17 00:00:00 2001 From: jichuan Date: Wed, 5 Jul 2023 10:32:41 +0800 Subject: [PATCH 4/5] fix: gn Signed-off-by: jichuan --- trace_streamer/BUILD.gn | 47 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn index 1bcdb155d..7190e798b 100644 --- a/trace_streamer/BUILD.gn +++ b/trace_streamer/BUILD.gn @@ -10,27 +10,28 @@ # 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/ts.gni") -group("trace_streamer") { - if (is_test) { - deps = [ "test:unittest" ] - testonly = true - } else if (is_fuzz) { - deps = [ "test:fuzztest" ] - testonly = true - } else if (is_protoc) { - deps = [ "${THIRD_PARTY}/protobuf:protoc" ] - } else if (is_spb) { - deps = [ "src/proto_reader/protoc_plugin:protoreader_plugin" ] - } else if (is_sdkdemo) { - deps = [ "sdk/demo_sdk:trace_streamer_sdk_builtin" ] - } else if (is_dubai_sdk) { - deps = [ "sdk/dubai_sdk:trace_streamer_dubai_builtin" ] - } else if (is_sdkdemo_test) { - deps = [ "sdk/test:sdkunittest" ] - } else if (use_wasm) { - deps = [ "src:trace_streamer_builtin" ] - } else { - deps = [ "src:trace_streamer" ] - } +import("//build/ohos.gni") + +ohos_executable("trace_streamer") { + cflags = [ "-D COMPILE_WITH_OHOS" ] + sources = [ "src/main.cpp" ] + include_dirs = [ + "src/base", + "./", + "src/trace_streamer", + "src/filter", + "src/table", + "src/trace_data", + "src/include", + "src/rpc", + "src/", + "src/parser", + "src/cfg", + "src/proto_reader/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", + ] } -- Gitee From 62ddcf78676c57c413d6318fd83ad781a90cba13 Mon Sep 17 00:00:00 2001 From: jichuan Date: Wed, 5 Jul 2023 10:44:07 +0800 Subject: [PATCH 5/5] fix: main.cpp Signed-off-by: jichuan --- trace_streamer/src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trace_streamer/src/main.cpp b/trace_streamer/src/main.cpp index eff838d35..f13e2d20c 100644 --- a/trace_streamer/src/main.cpp +++ b/trace_streamer/src/main.cpp @@ -45,7 +45,9 @@ namespace TraceStreamer { using namespace SysTuning::TraceStreamer; using namespace SysTuning::base; constexpr size_t G_CHUNK_SIZE = 1024 * 1024; +#ifndef COMPILE_WITH_OHOS constexpr int G_MIN_PARAM_NUM = 2; +#endif constexpr size_t G_FILE_PERMISSION = 664; // set version info in meta.cpp please void ExportStatusToLog(const std::string& dbPath, TraceParserStatus status) @@ -297,6 +299,7 @@ int CheckArgs(int argc, char** argv, TraceExportOption& traceExportOption, HttpO } // namespace SysTuning int main(int argc, char** argv) { +#ifndef COMPILE_WITH_OHOS if (argc < G_MIN_PARAM_NUM) { ShowHelpInfo(argv[0]); return 1; @@ -354,5 +357,6 @@ int main(int argc, char** argv) if (!tsOption.sqlOperatorFilePath.empty()) { ReadSqlFileAndPrintResult(ts, tsOption.sqlOperatorFilePath); } +#endif return 0; } -- Gitee