Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: tools/battor_agent/battor_agent.cc

Issue 2859353003: [BattOr] Reduce StartTracing time by about four seconds.
Patch Set: Fixed test cases Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/battor_agent/battor_agent.cc
diff --git a/tools/battor_agent/battor_agent.cc b/tools/battor_agent/battor_agent.cc
index 6041a8b311794f8ba7254999d95ffb74ed3f1216..16d9aba1742a649d11528da259393c06ab61e75b 100644
--- a/tools/battor_agent/battor_agent.cc
+++ b/tools/battor_agent/battor_agent.cc
@@ -226,6 +226,9 @@ void BattOrAgent::OnBytesSent(bool success) {
case Action::SEND_GIT_HASH_REQUEST:
PerformAction(Action::READ_GIT_HASH);
return;
+ case Action::RESET:
+ CompleteCommand(BATTOR_ERROR_NONE);
+ return;
default:
NOTREACHED();
return;
@@ -352,6 +355,16 @@ void BattOrAgent::OnMessageRead(bool success,
// Cancel the next data frame timeout.
timeout_callback_.Cancel();
CompleteCommand(BATTOR_ERROR_NONE);
+
+ // Proactively reset the BattOr to speed up the next trace.
+ //
+ // Without this proactive reset, the BattOr will take several seconds
+ // to automatically reset the next time that a trace is started. By
+ // proactively resetting the BattOr now, before the trace is printed by
+ // the agent, the reset is parallelized with the final processing of
+ // this trace by the agent. Thus the BattOr will be ready to start
+ // the next trace immediately.
+ PerformAction(Action::RESET);
return;
}
@@ -475,6 +488,10 @@ void BattOrAgent::PerformAction(Action action) {
connection_->ReadMessage(BATTOR_MESSAGE_TYPE_CONTROL_ACK);
return;
+ case Action::RESET:
+ SendControlMessage(BATTOR_CONTROL_MESSAGE_TYPE_RESET, 0, 0);
+ return;
+
case Action::INVALID:
NOTREACHED();
return;

Powered by Google App Engine
This is Rietveld 408576698