Implement simpleperf stat subcommand.
Also add some simple unit-tests.
Change-Id: Ic30a2d4a879e028a8c82babbaf82e322fc49a838
diff --git a/simpleperf/main.cpp b/simpleperf/main.cpp
index 017e495..1f7c7da 100644
--- a/simpleperf/main.cpp
+++ b/simpleperf/main.cpp
@@ -39,12 +39,12 @@
LOG(ERROR) << "malformed command line: unknown command " << args[0];
return 1;
}
+ std::string command_name = args[0];
args.erase(args.begin());
+
+ LOG(DEBUG) << "command '" << command_name << "' starts running";
bool result = command->Run(args);
- if (result == true) {
- LOG(DEBUG) << "run command " << args[0] << " successfully";
- } else {
- LOG(DEBUG) << "run command " << args[0] << "unsuccessfully";
- }
+ LOG(DEBUG) << "command '" << command_name << "' "
+ << (result ? "finished successfully" : "failed");
return result ? 0 : 1;
}