diff --git a/README.md b/README.md
index 03b4588..cf7ef53 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ ByTrace is a tool for you to trace processes and monitor performance. It encapsu
## Directory Structure
```
-/developtools/bytrace_standard
+/developtools/bytrace
├── bin # ByTrace code
│ └── include # Header files
│ └── src # Source files
diff --git a/README_zh.md b/README_zh.md
index f90da15..bc9d2c0 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -20,7 +20,7 @@ bytrace是开发人员用于追踪进程轨迹、查看性能的一种工具,
## 目录
```
-/developtools/bytrace_standard
+/developtools/bytrace
├── bin # bytrace组件代码目录
│ └── include # 头文件目录
│ └── src # 源文件目录
diff --git a/bin/BUILD.gn b/bin/BUILD.gn
index f43dfb4..52e9cd3 100644
--- a/bin/BUILD.gn
+++ b/bin/BUILD.gn
@@ -12,34 +12,13 @@
# limitations under the License.
import("//build/ohos.gni")
-import("//developtools/bytrace_standard/bytrace.gni")
-
-config("bytrace_lib_inner_config") {
- visibility = [ ":*" ]
- include_dirs = [ "${innerkits_path}/native/include" ]
-}
-
-ohos_static_library("bytrace_inner") {
- sources = [ "./src/bytrace_impl.cpp" ]
- public_configs = [ ":bytrace_lib_inner_config" ]
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "startup_l2:syspara",
- "startup_l2:syspara_watchagent",
-
- #"distributedschedule:samgr_standard"
- ]
-
- subsystem_name = "developtools"
- part_name = "bytrace_standard"
-}
+import("//developtools/bytrace/bytrace.gni")
config("bytrace_osal_inner_config") {
visibility = [ ":*" ]
include_dirs = [
"./include",
- "${innerkits_path}/native/include",
+ "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter",
]
}
@@ -52,7 +31,7 @@ ohos_static_library("bytrace_osal_inner") {
]
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
ohos_executable("bytrace") {
@@ -61,33 +40,37 @@ ohos_executable("bytrace") {
deps = [
":bytrace_osal_inner",
- "${innerkits_path}/native:bytrace_core",
"//third_party/zlib:libz",
"//utils/native/base:utils",
]
+
+ external_deps = [ "hitrace_native:hitrace_meter" ]
+
include_dirs = [
"${bytrace_path}/bin/include",
- "${innerkits_path}/include",
+ "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter",
"//utils/native/base/include",
"//third_party/zlib",
]
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
ohos_prebuilt_etc("bytrace.cfg") {
source = "./config/bytrace.cfg"
relative_install_dir = "init"
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
ohos_executable("bytrace_example") {
sources = [ "example/bytrace_example.cpp" ]
- deps = [ "${innerkits_path}/native:bytrace_core" ]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ external_deps = [
+ "hitrace_native:hitrace_meter",
+ "hiviewdfx_hilog_native:libhilog",
+ ]
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
group("bytrace_target") {
diff --git a/bin/example/bytrace_example.cpp b/bin/example/bytrace_example.cpp
index db75767..77e55b7 100644
--- a/bin/example/bytrace_example.cpp
+++ b/bin/example/bytrace_example.cpp
@@ -18,7 +18,7 @@
#include
#include
-#include "bytrace.h"
+#include "hitrace_meter.h"
using namespace std;
namespace {
diff --git a/bin/src/bytrace_cmd.cpp b/bin/src/bytrace_cmd.cpp
index 1ce870e..381efb5 100644
--- a/bin/src/bytrace_cmd.cpp
+++ b/bin/src/bytrace_cmd.cpp
@@ -30,7 +30,7 @@
#include
#include
#include
-#include "bytrace.h"
+#include "hitrace_meter.h"
#include "bytrace_osal.h"
#include "securec.h"
diff --git a/bin/src/bytrace_impl.cpp b/bin/src/bytrace_impl.cpp
deleted file mode 100644
index 2f68d0d..0000000
--- a/bin/src/bytrace_impl.cpp
+++ /dev/null
@@ -1,239 +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.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "bytrace.h"
-#include "hilog/log.h"
-#include "parameter.h"
-#include "parameters.h"
-
-using namespace std;
-using namespace OHOS::HiviewDFX;
-
-#define EXPECTANTLY(exp) (__builtin_expect(!!(exp), true))
-#define UNEXPECTANTLY(exp) (__builtin_expect(!!(exp), false))
-
-namespace {
-int g_markerFd = -1;
-std::once_flag g_onceFlag;
-
-std::atomic g_isBytraceInit(false);
-std::atomic g_tagsProperty(BYTRACE_TAG_NOT_READY);
-
-const std::string KEY_TRACE_TAG = "debug.bytrace.tags.enableflags";
-const std::string KEY_APP_NUMBER = "debug.bytrace.app_number";
-const std::string KEY_RO_DEBUGGABLE = "ro.debuggable";
-
-constexpr int NAME_MAX_SIZE = 1000;
-static std::vector g_markTypes = {"B", "E", "S", "F", "C"};
-enum MarkerType { MARKER_BEGIN, MARKER_END, MARKER_ASYNC_BEGIN, MARKER_ASYNC_END, MARKER_INT, MARKER_MAX };
-
-constexpr uint64_t BYTRACE_TAG = 0xd03301;
-constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, BYTRACE_TAG, "BytraceCore"};
-
-static void ParameterChange(const char* key, const char* value, void* context)
-{
- HiLog::Info(LABEL, "Trace param %{public}s change notified", key);
- UpdateTraceLabel();
-}
-
-bool IsAppValid()
-{
- // Judge if application-level tracing is enabled.
- if (OHOS::system::GetBoolParameter(KEY_RO_DEBUGGABLE, 0)) {
- std::ifstream fs;
- fs.open("/proc/self/cmdline");
- if (!fs.is_open()) {
- fprintf(stderr, "IsAppValid, open /proc/self/cmdline failed.\n");
- return false;
- }
-
- std::string lineStr;
- std::getline(fs, lineStr);
- std::string keyPrefix = "debug.bytrace.app_";
- int nums = OHOS::system::GetIntParameter(KEY_APP_NUMBER, 0);
- for (int i = 0; i < nums; i++) {
- std::string keyStr = keyPrefix + std::to_string(i);
- std::string val = OHOS::system::GetParameter(keyStr, "");
- if (val == "*" || val == lineStr) {
- fs.close();
- return true;
- }
- }
- }
- return false;
-}
-
-uint64_t GetSysParamTags()
-{
- // Get the system parameters of KEY_TRACE_TAG.
- uint64_t tags = OHOS::system::GetUintParameter(KEY_TRACE_TAG, 0);
- if (tags == 0) {
- return 0;
- }
-
- IsAppValid();
- return (tags | BYTRACE_TAG_ALWAYS) & BYTRACE_TAG_VALID_MASK;
-}
-
-// open file "trace_marker".
-void OpenTraceMarkerFile()
-{
- const std::string debugFile = "/sys/kernel/debug/tracing/trace_marker";
- const std::string traceFile = "/sys/kernel/tracing/trace_marker";
- g_markerFd = open(debugFile.c_str(), O_WRONLY | O_CLOEXEC);
- if (g_markerFd == -1) {
- g_markerFd = open(traceFile.c_str(), O_WRONLY | O_CLOEXEC);
- if (g_markerFd == -1) {
- HiLog::Error(LABEL, "open trace file %{public}s failed: %{public}d", traceFile.c_str(), errno);
- g_tagsProperty = 0;
- return;
- }
- }
- g_tagsProperty = GetSysParamTags();
- if (g_tagsProperty == 0 || (g_tagsProperty & BYTRACE_TAG_VALID_MASK) == BYTRACE_TAG_ALWAYS) {
- HiLog::Info(LABEL, "Get trace param value zero firstly");
- }
-
- if (WatchParameter(KEY_TRACE_TAG.c_str(), ParameterChange, nullptr) != 0) {
- HiLog::Error(LABEL, "WatchParameter %{public}s failed", KEY_TRACE_TAG.c_str());
- return;
- }
- g_isBytraceInit = true;
-}
-}; // namespace
-
-void AddBytraceMarker(MarkerType type, uint64_t tag, const std::string& name, const std::string& value)
-{
- if (UNEXPECTANTLY(!g_isBytraceInit)) {
- std::call_once(g_onceFlag, OpenTraceMarkerFile);
- }
- if (UNEXPECTANTLY(g_tagsProperty & tag)) {
- // record fomart: "type|pid|name value".
- std::string record = g_markTypes[type] + "|";
- record += std::to_string(getpid()) + "|";
- record += (name.size() < NAME_MAX_SIZE) ? name : name.substr(0, NAME_MAX_SIZE);
- record += " " + value;
- if (write(g_markerFd, record.c_str(), record.size()) < 0) {
- HiLog::Error(LABEL, "write trace_marker failed, %{public}d", errno);
- }
- }
-}
-
-void UpdateTraceLabel()
-{
- if (!g_isBytraceInit) {
- HiLog::Info(LABEL, "trace param notified value delay to acquire");
- return;
- }
- g_tagsProperty = GetSysParamTags();
- uint64_t val = g_tagsProperty;
- if (val == 0 || (val & BYTRACE_TAG_VALID_MASK) == BYTRACE_TAG_ALWAYS) {
- HiLog::Info(LABEL, "Get trace param notified value zero");
- } else {
- HiLog::Info(LABEL, "Get trace param notified value 0x%{public}" PRIx64, val);
- }
-}
-
-void StartTrace(uint64_t label, const string& value, float limit)
-{
- string traceName = "H:" + value;
- AddBytraceMarker(MARKER_BEGIN, label, traceName, "");
-}
-
-void StartTraceDebug(uint64_t label, const string& value, float limit)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- string traceName = "H:" + value + GetHiTraceInfo();
- AddBytraceMarker(MARKER_BEGIN, label, traceName, "");
-#endif
-}
-
-void FinishTrace(uint64_t label)
-{
- AddBytraceMarker(MARKER_END, label, "", "");
-}
-
-void FinishTraceDebug(uint64_t label)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- AddBytraceMarker(MARKER_END, label, "", "");
-#endif
-}
-
-void StartAsyncTrace(uint64_t label, const string& value, int32_t taskId, float limit)
-{
- string traceName = "H:" + value;
- AddBytraceMarker(MARKER_ASYNC_BEGIN, label, traceName, std::to_string(taskId));
-}
-
-void StartAsyncTraceDebug(uint64_t label, const string& value, int32_t taskId, float limit)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- string traceName = "H:" + value;
- AddBytraceMarker(MARKER_ASYNC_BEGIN, label, traceName, std::to_string(taskId));
-#endif
-}
-
-void FinishAsyncTrace(uint64_t label, const string& value, int32_t taskId)
-{
- string traceName = "H:" + value;
- AddBytraceMarker(MARKER_ASYNC_END, label, traceName, std::to_string(taskId));
-}
-
-void FinishAsyncTraceDebug(uint64_t label, const string& value, int32_t taskId)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- string traceName = "H:" + value;
- AddBytraceMarker(MARKER_ASYNC_END, label, traceName, std::to_string(taskId));
-#endif
-}
-
-void MiddleTrace(uint64_t label, const string& beforeValue, const std::string& afterValue)
-{
- string traceName = "H:" + afterValue;
- AddBytraceMarker(MARKER_END, label, "", "");
- AddBytraceMarker(MARKER_BEGIN, label, traceName, "");
-}
-
-void MiddleTraceDebug(uint64_t label, const string& beforeValue, const std::string& afterValue)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- string traceName = "H:" + afterValue + GetTraceInfo();
- AddBytraceMarker(MARKER_END, label, "", "");
- AddBytraceMarker(MARKER_BEGIN, label, traceName, "");
-#endif
-}
-
-void CountTrace(uint64_t label, const string& name, int64_t count)
-{
- string traceName = "H:" + name;
- AddBytraceMarker(MARKER_INT, label, traceName, std::to_string(count));
-}
-
-void CountTraceDebug(uint64_t label, const string& name, int64_t count)
-{
-#if (TRACE_LEVEL >= DEBUG_LEVEL)
- string traceName = "H:" + name;
- AddBytraceMarker(MARKER_INT, label, traceName, std::to_string(count));
-#endif
-}
diff --git a/bin/src/bytrace_osal.cpp b/bin/src/bytrace_osal.cpp
index 1789f07..06b2050 100644
--- a/bin/src/bytrace_osal.cpp
+++ b/bin/src/bytrace_osal.cpp
@@ -14,7 +14,7 @@
*/
#include "bytrace_osal.h"
-#include "bytrace.h"
+#include "hitrace_meter.h"
#include "parameters.h"
namespace OHOS {
diff --git a/bin/test/BUILD.gn b/bin/test/BUILD.gn
index 7ceae89..e2e45cd 100644
--- a/bin/test/BUILD.gn
+++ b/bin/test/BUILD.gn
@@ -9,12 +9,12 @@
# 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.
+# limitations under the License.
import("//build/test.gni")
-import("//developtools/bytrace_standard/bytrace.gni")
+import("//developtools/bytrace/bytrace.gni")
-module_output_path = "bytrace_standard/bytrace"
+module_output_path = "bytrace/bytrace"
config("module_private_config") {
visibility = [ ":*" ]
@@ -25,10 +25,10 @@ ohos_unittest("BytraceNDKTest") {
sources = [ "unittest/common/native/bytrace_ndk_test.cpp" ]
deps = [
"${bytrace_path}/bin:bytrace_osal_inner",
- "${innerkits_path}/native:bytrace_core",
"//third_party/googletest:gtest_main",
]
external_deps = [
+ "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"startup_l2:syspara",
]
diff --git a/bin/test/unittest/common/native/bytrace_ndk_test.cpp b/bin/test/unittest/common/native/bytrace_ndk_test.cpp
index 6e5c519..0e53fd3 100644
--- a/bin/test/unittest/common/native/bytrace_ndk_test.cpp
+++ b/bin/test/unittest/common/native/bytrace_ndk_test.cpp
@@ -19,7 +19,7 @@
#include
#include
#include
-#include "bytrace.h"
+#include "hitrace_meter.h"
#include "bytrace_osal.h"
#include "parameters.h"
diff --git a/bundle.json b/bundle.json
index 8f81d8a..a78ba13 100644
--- a/bundle.json
+++ b/bundle.json
@@ -1,16 +1,16 @@
{
- "name": "@ohos/bytrace_standard",
+ "name": "@ohos/bytrace",
"description": "A tool to trace processes and monitor performance",
"version": "3.1",
"license": "Apache License 2.0",
"publishAs": "code-segment",
"segment": {
- "destPath": "developtools/bytrace_standard"
+ "destPath": "developtools/bytrace"
},
"dirs": {},
"scripts": {},
"component": {
- "name": "bytrace_standard",
+ "name": "bytrace",
"subsystem": "developtools",
"adapted_system_type": [
"standard"
@@ -31,25 +31,14 @@
},
"build": {
"sub_component": [
- "//developtools/bytrace_standard/interfaces/innerkits/native:bytrace_core",
- "//developtools/bytrace_standard/bin:bytrace_target",
- "//developtools/bytrace_standard/bin:bytrace.cfg",
- "//developtools/bytrace_standard/interfaces/kits:jsapi_kits_target"
+ "//developtools/bytrace/bin:bytrace_target",
+ "//developtools/bytrace/bin:bytrace.cfg",
+ "//developtools/bytrace/interfaces/kits:jsapi_kits_target"
],
"inner_kits": [
- {
- "type": "so",
- "name": "//developtools/bytrace_standard/interfaces/innerkits/native:bytrace_core",
- "header": {
- "header_files": [
- "bytrace.h"
- ],
- "header_base": "//developtools/bytrace_standard/interfaces/innerkits/native/include"
- }
- }
],
"test": [
- "//developtools/bytrace_standard/bin/test:unittest"
+ "//developtools/bytrace/bin/test:unittest"
]
}
}
diff --git a/bytrace.gni b/bytrace.gni
index c91cf8b..ac56d81 100644
--- a/bytrace.gni
+++ b/bytrace.gni
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-bytrace_path = "//developtools/bytrace_standard"
+bytrace_path = "//developtools/bytrace"
innerkits_path = "${bytrace_path}/interfaces/innerkits"
diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn
deleted file mode 100644
index 53974fe..0000000
--- a/interfaces/innerkits/BUILD.gn
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2021-2022 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")
-
-group("innerkits_target") {
- deps = [ "native:bytrace_core" ]
-}
diff --git a/interfaces/innerkits/native/BUILD.gn b/interfaces/innerkits/native/BUILD.gn
deleted file mode 100644
index 943b31e..0000000
--- a/interfaces/innerkits/native/BUILD.gn
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2021-2022 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")
-import("//developtools/bytrace_standard/bytrace.gni")
-
-config("bytrace_config") {
- visibility = [ ":*" ]
- include_dirs = [ "include" ]
-}
-
-ohos_shared_library("bytrace_core") {
- public_configs = [ ":bytrace_config" ]
- deps = [ "${bytrace_path}/bin:bytrace_inner" ]
- subsystem_name = "developtools"
- part_name = "bytrace_standard"
-}
diff --git a/interfaces/innerkits/native/include/bytrace.h b/interfaces/innerkits/native/include/bytrace.h
deleted file mode 100644
index 24a028d..0000000
--- a/interfaces/innerkits/native/include/bytrace.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2021-2022 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.
- */
-
-#ifndef INTERFACES_INNERKITS_NATIVE_INCLUDE_BYTRACE_H
-#define INTERFACES_INNERKITS_NATIVE_INCLUDE_BYTRACE_H
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-constexpr uint64_t BYTRACE_TAG_NEVER = 0; // This tag is never enabled.
-constexpr uint64_t BYTRACE_TAG_ALWAYS = (1ULL << 0); // This tag is always enabled.
-constexpr uint64_t BYTRACE_TAG_OHOS = (1ULL << 30); // OHOS generic tag.
-constexpr uint64_t BYTRACE_TAG_ABILITY_MANAGER = (1ULL << 31); // Ability Manager tag.
-constexpr uint64_t BYTRACE_TAG_ZCAMERA = (1ULL << 32); // Camera module tag.
-constexpr uint64_t BYTRACE_TAG_ZMEDIA = (1ULL << 33); // Media module tag.
-constexpr uint64_t BYTRACE_TAG_ZIMAGE = (1ULL << 34); // Image module tag.
-constexpr uint64_t BYTRACE_TAG_ZAUDIO = (1ULL << 35); // Audio module tag.
-constexpr uint64_t BYTRACE_TAG_DISTRIBUTEDDATA = (1ULL << 36); // Distributeddata manager module tag.
-constexpr uint64_t BYTRACE_TAG_MDFS = (1ULL << 37); // Mobile distributed file system tag.
-constexpr uint64_t BYTRACE_TAG_GRAPHIC_AGP = (1ULL << 38); // Graphic module tag.
-constexpr uint64_t BYTRACE_TAG_ACE = (1ULL << 39); // ACE development framework tag.
-constexpr uint64_t BYTRACE_TAG_NOTIFICATION = (1ULL << 40); // Notification module tag.
-constexpr uint64_t BYTRACE_TAG_MISC = (1ULL << 41); // Notification module tag.
-constexpr uint64_t BYTRACE_TAG_MULTIMODALINPUT = (1ULL << 42); // Multi modal module tag.
-constexpr uint64_t BYTRACE_TAG_SENSORS = (1ULL << 43); // Sensors mudule tag.
-constexpr uint64_t BYTRACE_TAG_MSDP = (1ULL << 44); // Multimodal Sensor Data Platform module tag.
-constexpr uint64_t BYTRACE_TAG_DSOFTBUS = (1ULL << 45); // Distributed Softbus tag.
-constexpr uint64_t BYTRACE_TAG_RPC = (1ULL << 46); // RPC and IPC tag.
-constexpr uint64_t BYTRACE_TAG_ARK = (1ULL << 47); // ARK tag.
-constexpr uint64_t BYTRACE_TAG_WINDOW_MANAGER = (1ULL << 48); // window manager tag.
-constexpr uint64_t BYTRACE_TAG_APP = (1ULL << 62); // App tag.
-
-constexpr uint64_t BYTRACE_TAG_LAST = BYTRACE_TAG_APP;
-constexpr uint64_t BYTRACE_TAG_NOT_READY = (1ULL << 63); // Reserved for initialization.
-constexpr uint64_t BYTRACE_TAG_VALID_MASK = ((BYTRACE_TAG_LAST - 1) | BYTRACE_TAG_LAST);
-
-#ifndef BYTRACE_TAG
-#define BYTRACE_TAG BYTRACE_TAG_NEVER
-#elif BYTRACE_TAG > BYTRACE_TAG_VALID_MASK
-#error BYTRACE_TAG must be defined to be one of the tags defined in bytrace.h
-#elif BYTRACE_TAG < BYTRACE_TAG_OHOS
-#error BYTRACE_TAG must be defined to be one of the tags defined in bytrace.h
-#endif
-
-#define RELEASE_LEVEL 0X01
-#define DEBUG_LEVEL 0X02
-
-#ifndef TRACE_LEVEL
-#define TRACE_LEVEL RELEASE
-#endif
-
-#define TOKENPASTE(x, y) x ## y
-#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
-#define BYTRACE_NAME(TAG, fmt, ...) ByTraceScoped TOKENPASTE2(tracer, __LINE__)(TAG, fmt, ##__VA_ARGS__)
-#define BYTRACE(TAG) BYTRACE_NAME(TAG, __func__)
-
-/**
- * Update trace label when your process has started.
- */
-void UpdateTraceLabel();
-
-/**
- * Track the beginning of a context.
- */
-void StartTrace(uint64_t label, const std::string& value, float limit = -1);
-void StartTraceDebug(uint64_t label, const std::string& value, float limit = -1);
-/**
- * Track the end of a context.
- */
-void FinishTrace(uint64_t label);
-void FinishTraceDebug(uint64_t label);
-/**
- * Track the beginning of an asynchronous event.
- */
-void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1);
-void StartAsyncTraceDebug(uint64_t label, const std::string& value, int32_t taskId, float limit = -1);
-
-/**
- * Track the end of an asynchronous event.
- */
-void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId);
-void FinishAsyncTraceDebug(uint64_t label, const std::string& value, int32_t taskId);
-
-/**
- * Track the middle of a context. Match the previous function of StartTrace before it.
- */
-void MiddleTrace(uint64_t label, const std::string& beforeValue, const std::string& afterValue);
-void MiddleTraceDebug(uint64_t label, const std::string& beforeValue, const std::string& afterValue);
-
-/**
- * Track the 64-bit integer counter value.
- */
-void CountTrace(uint64_t label, const std::string& name, int64_t count);
-void CountTraceDebug(uint64_t label, const std::string& name, int64_t count);
-
-class ByTraceScoped {
-public:
- inline ByTraceScoped(uint64_t tag, const std::string &value) : mTag(tag)
- {
- StartTrace(mTag, value);
- }
-
- inline ~ByTraceScoped()
- {
- FinishTrace(mTag);
- }
-private:
- uint64_t mTag;
-};
-#ifdef __cplusplus
-}
-#endif
-#endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_BYTRACE_H
diff --git a/interfaces/kits/BUILD.gn b/interfaces/kits/BUILD.gn
index 05d1b57..4200e0f 100644
--- a/interfaces/kits/BUILD.gn
+++ b/interfaces/kits/BUILD.gn
@@ -16,8 +16,8 @@ import("//build/ohos.gni")
group("jsapi_kits_target") {
if (support_jsapi) {
deps = [
- "//developtools/bytrace_standard/interfaces/kits/js/napi:bytrace",
- "//developtools/bytrace_standard/interfaces/kits/js/napi:hitracemeter_napi",
+ "//developtools/bytrace/interfaces/kits/js/napi:bytrace",
+ "//developtools/bytrace/interfaces/kits/js/napi:hitracemeter_napi",
]
}
}
diff --git a/interfaces/kits/js/napi/BUILD.gn b/interfaces/kits/js/napi/BUILD.gn
index 82c2eb4..2ae7512 100644
--- a/interfaces/kits/js/napi/BUILD.gn
+++ b/interfaces/kits/js/napi/BUILD.gn
@@ -12,23 +12,23 @@
# limitations under the License.
import("//build/ohos.gni")
-import("//developtools/bytrace_standard/bytrace.gni")
+import("//developtools/bytrace/bytrace.gni")
ohos_shared_library("bytrace") {
sources = [
"bytrace.cpp",
"bytrace_napi_common.cpp",
]
- deps = [
- "${innerkits_path}/native:bytrace_core",
- "//foundation/arkui/napi:ace_napi",
+ deps = [ "//foundation/arkui/napi:ace_napi" ]
+ external_deps = [
+ "hitrace_native:hitrace_meter",
+ "hiviewdfx_hilog_native:libhilog",
]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
relative_install_dir = "module"
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
ohos_shared_library("hitracemeter_napi") {
@@ -36,14 +36,14 @@ ohos_shared_library("hitracemeter_napi") {
"bytrace_napi_common.cpp",
"hitracemeter.cpp",
]
- deps = [
- "${innerkits_path}/native:bytrace_core",
- "//foundation/arkui/napi:ace_napi",
+ deps = [ "//foundation/arkui/napi:ace_napi" ]
+ external_deps = [
+ "hitrace_native:hitrace_meter",
+ "hiviewdfx_hilog_native:libhilog",
]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
relative_install_dir = "module"
subsystem_name = "developtools"
- part_name = "bytrace_standard"
+ part_name = "bytrace"
}
diff --git a/interfaces/kits/js/napi/bytrace_napi_common.cpp b/interfaces/kits/js/napi/bytrace_napi_common.cpp
index 8434e6c..ae24dcc 100644
--- a/interfaces/kits/js/napi/bytrace_napi_common.cpp
+++ b/interfaces/kits/js/napi/bytrace_napi_common.cpp
@@ -19,7 +19,7 @@
#include
#include "napi/native_api.h"
#include "napi/native_node_api.h"
-#include "bytrace.h"
+#include "hitrace_meter.h"
#include "bytrace_napi_common.h"
using namespace OHOS::HiviewDFX;