From 8b8f6b6c207adc511a2fbcca8ddc4d32336c3a0c Mon Sep 17 00:00:00 2001 From: jichuan Date: Tue, 4 Jul 2023 16:28:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E4=B8=BB=E7=BA=BF=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jichuan --- bundle.json | 41 ++++++++++++++++ trace_streamer/BUILD.gn | 47 ++++++++++--------- trace_streamer/src/main.cpp | 4 ++ trace_streamer/src/trace_data/trace_stdtype.h | 8 ++-- 4 files changed, 73 insertions(+), 27 deletions(-) create mode 100755 bundle.json mode change 100644 => 100755 trace_streamer/BUILD.gn mode change 100644 => 100755 trace_streamer/src/main.cpp diff --git a/bundle.json b/bundle.json new file mode 100755 index 00000000..7e2f5546 --- /dev/null +++ b/bundle.json @@ -0,0 +1,41 @@ +{ + "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 diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn old mode 100644 new mode 100755 index 1bcdb155..7190e798 --- 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", + ] } diff --git a/trace_streamer/src/main.cpp b/trace_streamer/src/main.cpp old mode 100644 new mode 100755 index eff838d3..f13e2d20 --- 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; } diff --git a/trace_streamer/src/trace_data/trace_stdtype.h b/trace_streamer/src/trace_data/trace_stdtype.h index fad6b009..61fb8417 100644 --- a/trace_streamer/src/trace_data/trace_stdtype.h +++ b/trace_streamer/src/trace_data/trace_stdtype.h @@ -139,7 +139,7 @@ public: states_.clear(); cpus_.clear(); } - const uint32_t Size() const + uint32_t Size() const { return itids_.size(); } @@ -1822,7 +1822,7 @@ public: names_.emplace_back(name); return ts_.size(); } - const size_t Size() const + size_t Size() const { return ts_.size(); } @@ -1853,7 +1853,7 @@ public: clockIds_.emplace_back(clockId); return dataSourceNames_.size(); } - const size_t Size() const + size_t Size() const { return dataSourceNames_.size(); } @@ -2225,7 +2225,7 @@ public: size_t AppendNew(uint32_t frameRow, uint64_t dur); const std::deque& FrameRows() const; const std::deque& Durs() const; - const size_t Size() const; + size_t Size() const; private: std::deque frameRows_ = {}; -- Gitee From 201b378743d7b102e12762eb3270a40d22a4ad38 Mon Sep 17 00:00:00 2001 From: jichuan Date: Tue, 4 Jul 2023 16:37:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E4=B8=BB=E7=BA=BF=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jichuan --- bundle.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bundle.json b/bundle.json index 7e2f5546..b5f66e46 100755 --- a/bundle.json +++ b/bundle.json @@ -32,10 +32,8 @@ }, "build": { "sub_component": [ - "//developtools/smartperf_host/trace_streamer:trace_streamer" + "//developtools/smartperf_host/trace_streamer:trace_streamer" ] } } -} - - \ No newline at end of file +} \ No newline at end of file -- Gitee