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

Unified Diff: tools/battor_agent/battor_connection_impl.cc

Issue 2233893002: [battor agent] Don't log all bytes received when reading sample frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/battor_agent/battor_connection_impl.cc
diff --git a/tools/battor_agent/battor_connection_impl.cc b/tools/battor_agent/battor_connection_impl.cc
index cf33c2ab97b18e1359f077f192117aae2840b6b5..849637bf8dde71fedc214c68684084137b17aa9c 100644
--- a/tools/battor_agent/battor_connection_impl.cc
+++ b/tools/battor_agent/battor_connection_impl.cc
@@ -228,9 +228,17 @@ void BattOrConnectionImpl::OnBytesRead(int bytes_read,
return;
}
- LogSerial(StringPrintf(
- "%d more bytes read: %s.", bytes_read,
- CharArrayToString(pending_read_buffer_->data(), bytes_read).c_str()));
+ if (pending_read_message_type_ == BATTOR_MESSAGE_TYPE_SAMPLES) {
+ // If we're reading samples, don't log every byte that we receive. This
+ // exacerbates a problem on Mac wherein we can't process sample frames
+ // quickly enough to prevent the serial buffer from overflowing, causing us
+ // to drop frames.
+ LogSerial(StringPrintf("%d more bytes read.", bytes_read));
+ } else {
+ LogSerial(StringPrintf(
+ "%d more bytes read: %s.", bytes_read,
+ CharArrayToString(pending_read_buffer_->data(), bytes_read).c_str()));
+ }
already_read_buffer_.insert(already_read_buffer_.end(),
pending_read_buffer_->data(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698