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