| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/battor_agent/battor_agent.h" | 5 #include "tools/battor_agent/battor_agent.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const uint8_t kBattOrResetTimeSeconds = 5; | 21 const uint8_t kBattOrResetTimeSeconds = 5; |
| 22 | 22 |
| 23 // The maximum number of times to retry when reading a message. | 23 // The maximum number of times to retry when reading a message. |
| 24 const uint8_t kMaxReadAttempts = 20; | 24 const uint8_t kMaxReadAttempts = 20; |
| 25 | 25 |
| 26 // The number of milliseconds to wait before trying to read a message again. | 26 // The number of milliseconds to wait before trying to read a message again. |
| 27 const uint8_t kReadRetryDelayMilliseconds = 1; | 27 const uint8_t kReadRetryDelayMilliseconds = 1; |
| 28 | 28 |
| 29 // The amount of time we need to wait after recording a clock sync marker in | 29 // The amount of time we need to wait after recording a clock sync marker in |
| 30 // order to ensure that the sample we synced to doesn't get thrown out. | 30 // order to ensure that the sample we synced to doesn't get thrown out. |
| 31 const uint8_t kStopTracingClockSyncDelayMilliseconds = 50; | 31 const uint8_t kStopTracingClockSyncDelayMilliseconds = 100; |
| 32 | 32 |
| 33 // Returns true if the specified vector of bytes decodes to a message that is an | 33 // Returns true if the specified vector of bytes decodes to a message that is an |
| 34 // ack for the specified control message type. | 34 // ack for the specified control message type. |
| 35 bool IsAckOfControlCommand(BattOrMessageType message_type, | 35 bool IsAckOfControlCommand(BattOrMessageType message_type, |
| 36 BattOrControlMessageType control_message_type, | 36 BattOrControlMessageType control_message_type, |
| 37 const vector<char>& msg) { | 37 const vector<char>& msg) { |
| 38 if (message_type != BATTOR_MESSAGE_TYPE_CONTROL_ACK) | 38 if (message_type != BATTOR_MESSAGE_TYPE_CONTROL_ACK) |
| 39 return false; | 39 return false; |
| 40 | 40 |
| 41 if (msg.size() != sizeof(BattOrControlMessageAck)) | 41 if (msg.size() != sizeof(BattOrControlMessageAck)) |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 if (clock_sync_marker != clock_sync_markers_.end()) | 530 if (clock_sync_marker != clock_sync_markers_.end()) |
| 531 trace_stream << " <" << clock_sync_marker->second << ">"; | 531 trace_stream << " <" << clock_sync_marker->second << ">"; |
| 532 | 532 |
| 533 trace_stream << std::endl; | 533 trace_stream << std::endl; |
| 534 } | 534 } |
| 535 | 535 |
| 536 return trace_stream.str(); | 536 return trace_stream.str(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace battor | 539 } // namespace battor |
| OLD | NEW |