| 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 // This file provides a thin binary wrapper around the BattOr Agent | 5 // This file provides a thin binary wrapper around the BattOr Agent |
| 6 // library. This binary wrapper provides a means for non-C++ tracing | 6 // library. This binary wrapper provides a means for non-C++ tracing |
| 7 // controllers, such as Telemetry and Android Systrace, to issue high-level | 7 // controllers, such as Telemetry and Android Systrace, to issue high-level |
| 8 // tracing commands to the BattOr.. | 8 // tracing commands to the BattOr.. |
| 9 | 9 |
| 10 #include <stdint.h> |
| 11 |
| 10 #include <iostream> | 12 #include <iostream> |
| 11 | 13 |
| 12 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
| 13 #include "base/bind.h" | 15 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 15 #include "base/location.h" | 17 #include "base/location.h" |
| 16 #include "base/logging.h" | 18 #include "base/logging.h" |
| 17 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 18 #include "tools/battor_agent/battor_agent.h" | 20 #include "tools/battor_agent/battor_agent.h" |
| 19 #include "tools/battor_agent/battor_error.h" | 21 #include "tools/battor_agent/battor_error.h" |
| 20 | 22 |
| 21 using std::endl; | 23 using std::endl; |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 const char kIoThreadName[] = "BattOr IO Thread"; | 27 const char kIoThreadName[] = "BattOr IO Thread"; |
| 26 const char kFileThreadName[] = "BattOr File Thread"; | 28 const char kFileThreadName[] = "BattOr File Thread"; |
| 27 const char kUiThreadName[] = "BattOr UI Thread"; | 29 const char kUiThreadName[] = "BattOr UI Thread"; |
| 28 const int32 kBattOrCommandTimeoutSeconds = 10; | 30 const int32_t kBattOrCommandTimeoutSeconds = 10; |
| 29 | 31 |
| 30 void PrintUsage() { | 32 void PrintUsage() { |
| 31 std::cout << "Usage: battor_agent <command> <arguments>" << endl | 33 std::cout << "Usage: battor_agent <command> <arguments>" << endl |
| 32 << endl | 34 << endl |
| 33 << "Commands:" << endl | 35 << "Commands:" << endl |
| 34 << endl | 36 << endl |
| 35 << " StartTracing <path>" << endl | 37 << " StartTracing <path>" << endl |
| 36 << " StopTracing <path>" << endl | 38 << " StopTracing <path>" << endl |
| 37 << " SupportsExplicitClockSync" << endl | 39 << " SupportsExplicitClockSync" << endl |
| 38 << " RecordClockSyncMarker <path> <marker>" << endl | 40 << " RecordClockSyncMarker <path> <marker>" << endl |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 scoped_ptr<BattOrAgent> agent_; | 208 scoped_ptr<BattOrAgent> agent_; |
| 207 }; | 209 }; |
| 208 | 210 |
| 209 } // namespace battor | 211 } // namespace battor |
| 210 | 212 |
| 211 int main(int argc, char* argv[]) { | 213 int main(int argc, char* argv[]) { |
| 212 base::AtExitManager exit_manager; | 214 base::AtExitManager exit_manager; |
| 213 battor::BattOrAgentBin bin; | 215 battor::BattOrAgentBin bin; |
| 214 return bin.Run(argc, argv); | 216 return bin.Run(argc, argv); |
| 215 } | 217 } |
| OLD | NEW |