diff --git a/BUILD.gn b/BUILD.gn index d0e4d285e6305573c2ec2e587a4a91c2c4dc434f..881a18057c77812443fdcd2149283c9664ad9477 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -62,6 +62,7 @@ ohos_static_library("appspawn_server") { "//utils/native/base:utils", ] external_deps = [ + "bytrace_standard:bytrace_core", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 8e7b6ebd222c908af7b35b79e33ff2cf3dfaed8a..e934a5f6fe604f1b34ee9bcd5fd92bdbf7437b8d 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -27,7 +27,10 @@ ohos_static_library("appspawn_socket_client") { include_dirs = [ "${appspawn_path}/include" ] public_configs = [ ":exported_header_files" ] deps = [ "//utils/native/base:utils" ] - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "bytrace_standard:bytrace_core", + "hiviewdfx_hilog_native:libhilog", + ] subsystem_name = "${subsystem_name}" part_name = "${part_name}" diff --git a/src/appspawn_msg_peer.cpp b/src/appspawn_msg_peer.cpp index 57e3826bb6ce7ebaa6c2d50298b62bb0c0fb502f..0ffd1fa514bb2a46a734f93561427c9eb1da7843 100644 --- a/src/appspawn_msg_peer.cpp +++ b/src/appspawn_msg_peer.cpp @@ -17,6 +17,7 @@ #include +#include "bytrace.h" #include "hilog/log.h" #include "securec.h" @@ -48,6 +49,7 @@ int AppSpawnMsgPeer::GetConnectFd() const int AppSpawnMsgPeer::Response(pid_t pid) { + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); if ((socket_ == nullptr) || (connectFd_ < 0)) { HiLog::Error(LABEL, "Invalid socket params: connectFd %d", connectFd_); return -1; diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index 38ccf1e4f6302be67dfb68f9007080e5288a5ac7..f76db44023d2e95c07a399526a0d0dfe540fa712 100644 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -23,6 +23,7 @@ #include #include +#include "bytrace.h" #include "errors.h" #include "hilog/log.h" #include "main_thread.h" @@ -126,6 +127,7 @@ AppSpawnServer::AppSpawnServer(const std::string &socketName) void AppSpawnServer::MsgPeer(int connectFd) { + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); char err_string[ERR_STRING_SZ]; std::unique_ptr msgPeer = std::make_unique(socket_, connectFd); if (msgPeer == nullptr || msgPeer->MsgPeer() != 0) { @@ -152,6 +154,7 @@ void AppSpawnServer::ConnectionPeer() continue; } + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); mut_.lock(); // Ensure that mutex in SaveConnection is unlocked before being forked socket_->SaveConnection(connectFd); mut_.unlock(); @@ -188,6 +191,7 @@ bool AppSpawnServer::ServerMain(char *longProcName, int64_t longProcNameLen) dataCond_.wait(lock, [this] { return !this->appQueue_.empty(); }); std::unique_ptr msg = std::move(appQueue_.front()); appQueue_.pop(); + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); int connectFd = msg->GetConnectFd(); ClientSocket::AppProperty *appProperty = msg->GetMsg(); if (!CheckAppProperty(appProperty)) { @@ -212,6 +216,7 @@ bool AppSpawnServer::ServerMain(char *longProcName, int64_t longProcNameLen) msg->Response(-errno); continue; } else if (pid == 0) { + BYTRACE_NAME(BYTRACE_TAG_APP, "fork MainThread"); SpecialHandle(appProperty); SetAppProcProperty(connectFd, appProperty, longProcName, longProcNameLen, fd); _exit(0); diff --git a/src/socket/client_socket.cpp b/src/socket/client_socket.cpp index c39a0c95d3bbba2e21526a58fdc155ded6989000..52a8bed191e9301789540671d70fa988640db51d 100644 --- a/src/socket/client_socket.cpp +++ b/src/socket/client_socket.cpp @@ -19,6 +19,7 @@ #include #include +#include "bytrace.h" #include "hilog/log.h" #include "securec.h" @@ -58,6 +59,7 @@ void ClientSocket::CloseClient() int ClientSocket::ConnectSocket(int connectFd) { + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); char err_string[ERR_STRING_SZ]; if (connectFd < 0) { HiLog::Error(LABEL, "Client: Invalid socket fd: %d", connectFd); @@ -92,11 +94,13 @@ int ClientSocket::ConnectSocket() int ClientSocket::WriteSocketMessage(const void *buf, int len) { + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); return WriteSocketMessage(socketFd_, buf, len); } int ClientSocket::ReadSocketMessage(void *buf, int len) { + BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__); return ReadSocketMessage(socketFd_, buf, len); } } // namespace AppSpawn diff --git a/test/unittest/app_spawn_msg_peer_test/BUILD.gn b/test/unittest/app_spawn_msg_peer_test/BUILD.gn index 525b7f05b2d753dbc9e4078a42c966ec12efcbf2..857f40edd4b84e6384a684ba1be38d04aa5deabb 100644 --- a/test/unittest/app_spawn_msg_peer_test/BUILD.gn +++ b/test/unittest/app_spawn_msg_peer_test/BUILD.gn @@ -29,7 +29,10 @@ ohos_unittest("AppSpawnMsgPeerTest") { deps = [ "${appspawn_path}/test:appspawn_test_source" ] - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "bytrace_standard:bytrace_core", + "hiviewdfx_hilog_native:libhilog", + ] } group("unittest") { diff --git a/test/unittest/app_spawn_server_test/BUILD.gn b/test/unittest/app_spawn_server_test/BUILD.gn index 4ac518e25e6d114c3e04ca51f64b02b7469f0caf..9734cae021ebaa90b1ae57071d6a30cdbec982dc 100755 --- a/test/unittest/app_spawn_server_test/BUILD.gn +++ b/test/unittest/app_spawn_server_test/BUILD.gn @@ -34,6 +34,7 @@ ohos_unittest("AppSpawnServerOverrideTest") { deps = [ "${appspawn_path}/test:appspawn_test_source" ] external_deps = [ + "bytrace_standard:bytrace_core", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] @@ -59,6 +60,7 @@ ohos_unittest("AppSpawnServerMockTest") { deps = [ "${appspawn_path}/test:appspawn_test_source" ] external_deps = [ + "bytrace_standard:bytrace_core", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/test/unittest/client_socket_test/BUILD.gn b/test/unittest/client_socket_test/BUILD.gn index 3b52e5af28713f05308e74c321669712456e2ddb..42e733d9fd26f4dfc7fca4520da7c57f53c67863 100644 --- a/test/unittest/client_socket_test/BUILD.gn +++ b/test/unittest/client_socket_test/BUILD.gn @@ -30,7 +30,10 @@ ohos_unittest("ClientSocketTest") { deps = [ "${appspawn_path}/test:appspawn_test_source" ] - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "bytrace_standard:bytrace_core", + "hiviewdfx_hilog_native:libhilog", + ] } group("unittest") {