diff options
author | Yabin Cui <yabinc@google.com> | 2016-02-25 20:36:03 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-02-25 20:36:03 +0000 |
commit | 9e0f649ea94cce48df7bfca238fecac1ed1dac98 (patch) | |
tree | b38e801e291ddc6dd63c076bf0dbf92814cb0ccd | |
parent | ec2bf27cb962e55cfa25116ba5880ecb19910a07 (diff) | |
parent | ff7465c896ab90c162cbcf2b141c4cdd79bf437f (diff) | |
download | extras-9e0f649ea94cce48df7bfca238fecac1ed1dac98.tar.gz |
Merge "simpleperf: fix mac build."
-rw-r--r-- | simpleperf/Android.mk | 21 | ||||
-rw-r--r-- | simpleperf/cmd_dumprecord.cpp | 2 | ||||
-rw-r--r-- | simpleperf/cmd_help.cpp | 2 | ||||
-rw-r--r-- | simpleperf/cmd_list.cpp | 2 | ||||
-rw-r--r-- | simpleperf/cmd_record.cpp | 2 | ||||
-rw-r--r-- | simpleperf/cmd_report.cpp | 2 | ||||
-rw-r--r-- | simpleperf/cmd_stat.cpp | 2 | ||||
-rw-r--r-- | simpleperf/command.cpp | 23 |
8 files changed, 36 insertions, 20 deletions
diff --git a/simpleperf/Android.mk b/simpleperf/Android.mk index e6cfae34..3bd1a63a 100644 --- a/simpleperf/Android.mk +++ b/simpleperf/Android.mk @@ -182,8 +182,7 @@ LOCAL_MODULE_TAGS := debug LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) LOCAL_SRC_FILES := main.cpp -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf -LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target) +LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target) LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target) LOCAL_MULTILIB := first include $(BUILD_EXECUTABLE) @@ -194,8 +193,7 @@ LOCAL_CLANG := true LOCAL_MODULE := simpleperf_static LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) LOCAL_SRC_FILES := main.cpp -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf_static -LOCAL_STATIC_LIBRARIES := $(static_simpleperf_static_libraries_target) +LOCAL_STATIC_LIBRARIES := libsimpleperf_static $(static_simpleperf_static_libraries_target) LOCAL_MULTILIB := first LOCAL_FORCE_STATIC_EXECUTABLE := true include $(LLVM_DEVICE_BUILD_MK) @@ -210,8 +208,7 @@ LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin) LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) LOCAL_SRC_FILES := main.cpp -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf -LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host) +LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin) LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux) LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows) @@ -249,8 +246,7 @@ LOCAL_SRC_FILES := \ $(simpleperf_unit_test_src_files) \ $(simpleperf_unit_test_src_files_linux) \ -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf -LOCAL_STATIC_LIBRARIES += $(simpleperf_static_libraries_target) +LOCAL_STATIC_LIBRARIES += libsimpleperf $(simpleperf_static_libraries_target) LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target) LOCAL_MULTILIB := first include $(BUILD_NATIVE_TEST) @@ -265,8 +261,7 @@ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows) LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files) LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux) -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf -LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host) +LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin) LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux) LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows) @@ -286,9 +281,8 @@ LOCAL_CLANG := true LOCAL_MODULE := simpleperf_cpu_hotplug_test LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files) -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf +LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target) LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target) -LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target) LOCAL_MULTILIB := first include $(BUILD_NATIVE_TEST) @@ -300,8 +294,7 @@ LOCAL_MODULE_HOST_OS := linux LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux) LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files) -LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf -LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host) +LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host) LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux) LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) LOCAL_MULTILIB := first diff --git a/simpleperf/cmd_dumprecord.cpp b/simpleperf/cmd_dumprecord.cpp index c6af5528..13f40d4c 100644 --- a/simpleperf/cmd_dumprecord.cpp +++ b/simpleperf/cmd_dumprecord.cpp @@ -207,6 +207,6 @@ void DumpRecordCommand::DumpFeatureSection() { } } -__attribute__((constructor)) static void RegisterDumpRecordCommand() { +void RegisterDumpRecordCommand() { RegisterCommand("dump", [] { return std::unique_ptr<Command>(new DumpRecordCommand); }); } diff --git a/simpleperf/cmd_help.cpp b/simpleperf/cmd_help.cpp index 93a90ee1..0bb62311 100644 --- a/simpleperf/cmd_help.cpp +++ b/simpleperf/cmd_help.cpp @@ -73,6 +73,6 @@ void HelpCommand::PrintLongHelpForOneCommand(const Command& command) { printf("%s\n", command.LongHelpString().c_str()); } -__attribute__((constructor)) static void RegisterHelpCommand() { +void RegisterHelpCommand() { RegisterCommand("help", [] { return std::unique_ptr<Command>(new HelpCommand); }); } diff --git a/simpleperf/cmd_list.cpp b/simpleperf/cmd_list.cpp index 01ac048c..b6bf817c 100644 --- a/simpleperf/cmd_list.cpp +++ b/simpleperf/cmd_list.cpp @@ -82,6 +82,6 @@ bool ListCommand::Run(const std::vector<std::string>& args) { return true; } -__attribute__((constructor)) static void RegisterListCommand() { +void RegisterListCommand() { RegisterCommand("list", [] { return std::unique_ptr<Command>(new ListCommand); }); } diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp index b913f111..f0a7ceaf 100644 --- a/simpleperf/cmd_record.cpp +++ b/simpleperf/cmd_record.cpp @@ -844,6 +844,6 @@ void RecordCommand::CollectHitFileInfo(Record* record) { } } -__attribute__((constructor)) static void RegisterRecordCommand() { +void RegisterRecordCommand() { RegisterCommand("record", [] { return std::unique_ptr<Command>(new RecordCommand()); }); } diff --git a/simpleperf/cmd_report.cpp b/simpleperf/cmd_report.cpp index 9fbf82ef..b9821605 100644 --- a/simpleperf/cmd_report.cpp +++ b/simpleperf/cmd_report.cpp @@ -773,6 +773,6 @@ void ReportCommand::PrintCallGraphEntry(size_t depth, std::string prefix, } } -__attribute__((constructor)) static void RegisterReportCommand() { +void RegisterReportCommand() { RegisterCommand("report", [] { return std::unique_ptr<Command>(new ReportCommand()); }); } diff --git a/simpleperf/cmd_stat.cpp b/simpleperf/cmd_stat.cpp index 76ed145f..228b4edc 100644 --- a/simpleperf/cmd_stat.cpp +++ b/simpleperf/cmd_stat.cpp @@ -411,6 +411,6 @@ bool StatCommand::ShowCounters(const std::vector<CountersInfo>& counters, double return true; } -__attribute__((constructor)) static void RegisterStatCommand() { +void RegisterStatCommand() { RegisterCommand("stat", [] { return std::unique_ptr<Command>(new StatCommand); }); } diff --git a/simpleperf/command.cpp b/simpleperf/command.cpp index d4cfd659..34166531 100644 --- a/simpleperf/command.cpp +++ b/simpleperf/command.cpp @@ -68,3 +68,26 @@ const std::vector<std::string> GetAllCommandNames() { } return names; } + +extern void RegisterDumpRecordCommand(); +extern void RegisterHelpCommand(); +extern void RegisterListCommand(); +extern void RegisterRecordCommand(); +extern void RegisterReportCommand(); +extern void RegisterStatCommand(); + +class CommandRegister { + public: + CommandRegister() { + RegisterDumpRecordCommand(); + RegisterHelpCommand(); + RegisterReportCommand(); +#if defined(__linux__) + RegisterListCommand(); + RegisterRecordCommand(); + RegisterStatCommand(); +#endif + } +}; + +CommandRegister command_register; |