mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2025-02-17 06:39:21 +00:00
删除隔离宏
Signed-off-by: yuanye <yuanye64@huawei.com>
This commit is contained in:
parent
bfa6653b40
commit
a4603bedab
39
BUILD.gn
39
BUILD.gn
@ -116,6 +116,7 @@ config("hiperf_inner_config") {
|
|||||||
|
|
||||||
sources_platform_common = [
|
sources_platform_common = [
|
||||||
"./src/command.cpp",
|
"./src/command.cpp",
|
||||||
|
"./src/command_reporter.cpp",
|
||||||
"./src/dwarf_encoding.cpp",
|
"./src/dwarf_encoding.cpp",
|
||||||
"./src/ipc_utilities.cpp",
|
"./src/ipc_utilities.cpp",
|
||||||
"./src/option.cpp",
|
"./src/option.cpp",
|
||||||
@ -189,32 +190,6 @@ if (is_ohos && hiperf_use_syspara) {
|
|||||||
common_configs += [ ":hiperf_syspara_config" ]
|
common_configs += [ ":hiperf_syspara_config" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
ohos_source_set("hiperf_enable_hisysevent") {
|
|
||||||
part_name = "hiperf"
|
|
||||||
subsystem_name = "developtools"
|
|
||||||
use_exceptions = true
|
|
||||||
public_deps = common_deps
|
|
||||||
public_configs = common_configs
|
|
||||||
|
|
||||||
sources = [ "./src/command_reporter.cpp" ]
|
|
||||||
external_deps = [
|
|
||||||
"hisysevent:libhisysevent",
|
|
||||||
"c_utils:utils",
|
|
||||||
"hilog:libhilog",
|
|
||||||
]
|
|
||||||
defines = [ "ENABLE_HISYSEVENT" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
ohos_source_set("hiperf_disable_hisysevent") {
|
|
||||||
part_name = "hiperf"
|
|
||||||
subsystem_name = "developtools"
|
|
||||||
use_exceptions = true
|
|
||||||
public_deps = common_deps
|
|
||||||
public_configs = common_configs
|
|
||||||
|
|
||||||
sources = [ "./src/command_reporter.cpp" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
ohos_source_set("hiperf_platform_common") {
|
ohos_source_set("hiperf_platform_common") {
|
||||||
part_name = "hiperf"
|
part_name = "hiperf"
|
||||||
subsystem_name = "developtools"
|
subsystem_name = "developtools"
|
||||||
@ -228,6 +203,7 @@ ohos_source_set("hiperf_platform_common") {
|
|||||||
"c_utils:utils",
|
"c_utils:utils",
|
||||||
"faultloggerd:libunwinder_static",
|
"faultloggerd:libunwinder_static",
|
||||||
"hilog:libhilog",
|
"hilog:libhilog",
|
||||||
|
"hisysevent:libhisysevent",
|
||||||
"init:libbegetutil",
|
"init:libbegetutil",
|
||||||
"ipc:ipc_core",
|
"ipc:ipc_core",
|
||||||
"samgr:samgr_proxy",
|
"samgr:samgr_proxy",
|
||||||
@ -410,7 +386,6 @@ ohos_executable("hiperf") {
|
|||||||
":hiperf_etc",
|
":hiperf_etc",
|
||||||
":hiperf_platform_common",
|
":hiperf_platform_common",
|
||||||
":hiperf_platform_linux",
|
":hiperf_platform_linux",
|
||||||
":hiperf_enable_hisysevent",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if (hiperf_target_static) {
|
if (hiperf_target_static) {
|
||||||
@ -434,10 +409,7 @@ ohos_executable("hiperf") {
|
|||||||
|
|
||||||
ohos_executable("hiperf_host") {
|
ohos_executable("hiperf_host") {
|
||||||
sources = [ "./src/main.cpp" ]
|
sources = [ "./src/main.cpp" ]
|
||||||
deps = [
|
deps = [ ":hiperf_platform_common" ]
|
||||||
":hiperf_platform_common",
|
|
||||||
":hiperf_disable_hisysevent"
|
|
||||||
]
|
|
||||||
|
|
||||||
external_deps = [
|
external_deps = [
|
||||||
"bounds_checking_function:libsec_shared",
|
"bounds_checking_function:libsec_shared",
|
||||||
@ -497,10 +469,7 @@ ohos_source_set("hiperf_platform_host") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ohos_shared_library("hiperf_host_lib") {
|
ohos_shared_library("hiperf_host_lib") {
|
||||||
public_deps = [
|
public_deps = [ ":hiperf_platform_host" ]
|
||||||
":hiperf_platform_host",
|
|
||||||
":hiperf_disable_hisysevent"
|
|
||||||
]
|
|
||||||
output_name = "hiperf_report"
|
output_name = "hiperf_report"
|
||||||
|
|
||||||
ldflags = [ "-static-libstdc++" ]
|
ldflags = [ "-static-libstdc++" ]
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#define COMMAND_REPORTER_H_
|
#define COMMAND_REPORTER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <gtest/gtest_prod.h>
|
||||||
|
|
||||||
namespace OHOS::Developtools::HiPerf {
|
namespace OHOS::Developtools::HiPerf {
|
||||||
|
|
||||||
@ -34,12 +35,19 @@ public:
|
|||||||
std::string errorMessage_ = "";
|
std::string errorMessage_ = "";
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isReported = false;
|
bool isReported_ = false;
|
||||||
|
|
||||||
CommandReporter(const CommandReporter&) = delete;
|
CommandReporter(const CommandReporter&) = delete;
|
||||||
CommandReporter& operator=(const CommandReporter&) = delete;
|
CommandReporter& operator=(const CommandReporter&) = delete;
|
||||||
CommandReporter(CommandReporter&&) = delete;
|
CommandReporter(CommandReporter&&) = delete;
|
||||||
CommandReporter& operator=(CommandReporter&&) = delete;
|
CommandReporter& operator=(CommandReporter&&) = delete;
|
||||||
|
|
||||||
|
FRIEND_TEST(SubCommandRecordTest, ReportSampleAll);
|
||||||
|
FRIEND_TEST(SubCommandRecordTest, ReportSamplePid);
|
||||||
|
FRIEND_TEST(SubCommandRecordTest, ReportSampleApp);
|
||||||
|
FRIEND_TEST(SubCommandStatTest, ReportSampleAll);
|
||||||
|
FRIEND_TEST(SubCommandStatTest, ReportSamplePid);
|
||||||
|
FRIEND_TEST(SubCommandStatTest, ReportSampleApp);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OHOS::Developtools::HiPerf
|
} // namespace OHOS::Developtools::HiPerf
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "command_reporter.h"
|
#include "command_reporter.h"
|
||||||
|
|
||||||
#ifdef ENABLE_HISYSEVENT
|
#if defined(is_ohos) && is_ohos
|
||||||
#include "hiperf_hilog.h"
|
#include "hiperf_hilog.h"
|
||||||
#include "hisysevent.h"
|
#include "hisysevent.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -25,7 +25,7 @@ namespace OHOS::Developtools::HiPerf {
|
|||||||
|
|
||||||
CommandReporter::CommandReporter(const std::string& fullArgument) : subCommand_(fullArgument)
|
CommandReporter::CommandReporter(const std::string& fullArgument) : subCommand_(fullArgument)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HISYSEVENT
|
#if defined(is_ohos) && is_ohos
|
||||||
caller_ = GetProcessName(getppid());
|
caller_ = GetProcessName(getppid());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -37,8 +37,8 @@ CommandReporter::~CommandReporter()
|
|||||||
|
|
||||||
void CommandReporter::ReportCommand()
|
void CommandReporter::ReportCommand()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HISYSEVENT
|
#if defined(is_ohos) && is_ohos
|
||||||
if (isReported) {
|
if (isReported_) {
|
||||||
HIPERF_HILOGD(MODULE_DEFAULT, "command has been reported");
|
HIPERF_HILOGD(MODULE_DEFAULT, "command has been reported");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ void CommandReporter::ReportCommand()
|
|||||||
HIPERF_HILOGE(MODULE_DEFAULT, "hisysevent report failed, err:%{public}d", ret);
|
HIPERF_HILOGE(MODULE_DEFAULT, "hisysevent report failed, err:%{public}d", ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
isReported = true;
|
isReported_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace OHOS::Developtools::HiPerf
|
} // namespace OHOS::Developtools::HiPerf
|
||||||
|
@ -67,7 +67,6 @@ common_deps = [
|
|||||||
"${hiperf_path}/:hiperf_platform_common",
|
"${hiperf_path}/:hiperf_platform_common",
|
||||||
"${hiperf_path}/:hiperf_platform_host",
|
"${hiperf_path}/:hiperf_platform_host",
|
||||||
"${hiperf_path}/:hiperf_platform_linux",
|
"${hiperf_path}/:hiperf_platform_linux",
|
||||||
"${hiperf_path}/:hiperf_disable_hisysevent",
|
|
||||||
"${hiperf_path}/interfaces/innerkits/native:hiperf_client_static",
|
"${hiperf_path}/interfaces/innerkits/native:hiperf_client_static",
|
||||||
"//third_party/googletest:gmock_main",
|
"//third_party/googletest:gmock_main",
|
||||||
"//third_party/googletest:gtest_main",
|
"//third_party/googletest:gtest_main",
|
||||||
@ -121,7 +120,6 @@ fuzz_deps = [
|
|||||||
"${hiperf_path}/:hiperf_platform_common",
|
"${hiperf_path}/:hiperf_platform_common",
|
||||||
"${hiperf_path}/:hiperf_platform_host",
|
"${hiperf_path}/:hiperf_platform_host",
|
||||||
"${hiperf_path}/:hiperf_platform_linux",
|
"${hiperf_path}/:hiperf_platform_linux",
|
||||||
"${hiperf_path}/:hiperf_disable_hisysevent",
|
|
||||||
"${hiperf_path}/interfaces/innerkits/native:hiperf_client_static",
|
"${hiperf_path}/interfaces/innerkits/native:hiperf_client_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1592,6 +1592,7 @@ HWTEST_F(SubCommandRecordTest, ReportSampleAll, TestSize.Level1)
|
|||||||
command.targetSystemWide_ = true;
|
command.targetSystemWide_ = true;
|
||||||
|
|
||||||
CommandReporter reporter("record");
|
CommandReporter reporter("record");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "ALL");
|
EXPECT_EQ(reporter.targetProcess_, "ALL");
|
||||||
}
|
}
|
||||||
@ -1607,6 +1608,7 @@ HWTEST_F(SubCommandRecordTest, ReportSamplePid, TestSize.Level1)
|
|||||||
command.selectPids_ = {1, 2, 3};
|
command.selectPids_ = {1, 2, 3};
|
||||||
|
|
||||||
CommandReporter reporter("record");
|
CommandReporter reporter("record");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "1,2,3");
|
EXPECT_EQ(reporter.targetProcess_, "1,2,3");
|
||||||
}
|
}
|
||||||
@ -1622,6 +1624,7 @@ HWTEST_F(SubCommandRecordTest, ReportSampleApp, TestSize.Level1)
|
|||||||
command.appPackage_ = "com.test.app";
|
command.appPackage_ = "com.test.app";
|
||||||
|
|
||||||
CommandReporter reporter("record");
|
CommandReporter reporter("record");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "com.test.app");
|
EXPECT_EQ(reporter.targetProcess_, "com.test.app");
|
||||||
}
|
}
|
||||||
|
@ -2270,6 +2270,7 @@ HWTEST_F(SubCommandStatTest, ReportSampleAll, TestSize.Level1)
|
|||||||
command.targetSystemWide_ = true;
|
command.targetSystemWide_ = true;
|
||||||
|
|
||||||
CommandReporter reporter("stat");
|
CommandReporter reporter("stat");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "ALL");
|
EXPECT_EQ(reporter.targetProcess_, "ALL");
|
||||||
}
|
}
|
||||||
@ -2285,6 +2286,7 @@ HWTEST_F(SubCommandStatTest, ReportSamplePid, TestSize.Level1)
|
|||||||
command.selectPids_ = {1, 2, 3};
|
command.selectPids_ = {1, 2, 3};
|
||||||
|
|
||||||
CommandReporter reporter("stat");
|
CommandReporter reporter("stat");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "1,2,3");
|
EXPECT_EQ(reporter.targetProcess_, "1,2,3");
|
||||||
}
|
}
|
||||||
@ -2300,6 +2302,7 @@ HWTEST_F(SubCommandStatTest, ReportSampleApp, TestSize.Level1)
|
|||||||
command.appPackage_ = "com.test.app";
|
command.appPackage_ = "com.test.app";
|
||||||
|
|
||||||
CommandReporter reporter("stat");
|
CommandReporter reporter("stat");
|
||||||
|
reporter.isReported_ = true;
|
||||||
command.AddReportArgs(reporter);
|
command.AddReportArgs(reporter);
|
||||||
EXPECT_EQ(reporter.targetProcess_, "com.test.app");
|
EXPECT_EQ(reporter.targetProcess_, "com.test.app");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user