#include <string>
#include <vector>
-#include <base/logging.h>
-#include <base/strings.h>
+#include <android-base/logging.h>
+#include <android-base/strings.h>
#include "command.h"
#include "environment.h"
#include "event_fd.h"
#include "event_selection_set.h"
#include "event_type.h"
+#include "scoped_signal_handler.h"
#include "utils.h"
#include "workload.h"
system_wide_collection_(false),
child_inherit_(true) {
signaled = false;
- signal_handler_register_.reset(
- new SignalHandlerRegister({SIGCHLD, SIGINT, SIGTERM}, signal_handler));
+ scoped_signal_handler_.reset(
+ new ScopedSignalHandler({SIGCHLD, SIGINT, SIGTERM}, signal_handler));
}
bool Run(const std::vector<std::string>& args);
std::vector<EventTypeAndModifier> measured_event_types_;
EventSelectionSet event_selection_set_;
- std::unique_ptr<SignalHandlerRegister> signal_handler_register_;
+ std::unique_ptr<ScopedSignalHandler> scoped_signal_handler_;
};
bool StatCommand::Run(const std::vector<std::string>& args) {
+ if (!CheckPerfEventLimit()) {
+ return false;
+ }
+
// 1. Parse options, and use default measured event types if not given.
std::vector<std::string> workload_args;
if (!ParseOptions(args, &workload_args)) {
return true;
}
-__attribute__((constructor)) static void RegisterStatCommand() {
+void RegisterStatCommand() {
RegisterCommand("stat", [] { return std::unique_ptr<Command>(new StatCommand); });
}