diff --git a/bundle.json b/bundle.json new file mode 100755 index 0000000000000000000000000000000000000000..b5f66e46323457b17560493f95f56cc2968b73e8 --- /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 diff --git a/trace_streamer/BUILD.gn b/trace_streamer/BUILD.gn old mode 100644 new mode 100755 index 1bcdb155d41f38230b18540775ecfe5f60214f51..7190e798ba3499128ea677810bcdb386b7e60c84 --- 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 eff838d3595c732f54fc3957972a9fec7fa673e2..f13e2d20c3e99ebd8b20a34904be413a6563e8e5 --- 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 fad6b00954c4ca590b17084f1a7e3d18766c11ba..61fb841736591ddd893ab6bdfb7d99417d238117 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_ = {};