Revert "Revert "init: warn slow action"" am: 8b1d526a72 am: 3567c7c9d9

am: 67396253f2

Change-Id: I13ed33265460b8355b11a84f70cfb291ba6ed5cf
This commit is contained in:
Wei Wang 2016-11-17 04:10:52 +00:00 committed by android-build-merger
commit 68a66a3e31

View file

@ -118,14 +118,16 @@ void Action::ExecuteCommand(const Command& command) const {
Timer t;
int result = command.InvokeFunc();
// TODO: this should probably be changed to "if (failed || took a long time)"...
if (android::base::GetMinimumLogSeverity() <= android::base::DEBUG) {
double duration_ms = t.duration() * 1000;
// Any action longer than 50ms will be warned to user as slow operation
if (duration_ms > 50.0 ||
android::base::GetMinimumLogSeverity() <= android::base::DEBUG) {
std::string trigger_name = BuildTriggersString();
std::string cmd_str = command.BuildCommandString();
std::string source = command.BuildSourceString();
LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << source
<< " returned " << result << " took " << t.duration() << "s";
<< " returned " << result << " took " << duration_ms << "ms.";
}
}