diff options
author | Bertrand Simonnet <bsimonnet@google.com> | 2015-12-04 17:13:43 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-12-04 17:13:43 +0000 |
commit | 6615319a152dce01702388ff046395353683ded5 (patch) | |
tree | 0bb055e036d28c3b4563addc36fd9406ea5dc9c1 /metricsd/metricsd_main.cc | |
parent | c4e40acff4abbe67c6a920e4715ce646c19f3fed (diff) | |
parent | e9bc902cbcc890c18966f2ab498770b8461e3ef9 (diff) | |
download | core-6615319a152dce01702388ff046395353683ded5.tar.gz core-6615319a152dce01702388ff046395353683ded5.tar.bz2 core-6615319a152dce01702388ff046395353683ded5.zip |
Merge "metricsd: Log over binder." am: c5e921fe52
am: e9bc902cbc
* commit 'e9bc902cbcc890c18966f2ab498770b8461e3ef9':
metricsd: Log over binder.
Diffstat (limited to 'metricsd/metricsd_main.cc')
-rw-r--r-- | metricsd/metricsd_main.cc | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/metricsd/metricsd_main.cc b/metricsd/metricsd_main.cc index eee8a94aa..f460268c7 100644 --- a/metricsd/metricsd_main.cc +++ b/metricsd/metricsd_main.cc @@ -14,34 +14,34 @@ * limitations under the License. */ +#include <thread> + #include <base/at_exit.h> #include <base/command_line.h> #include <base/files/file_path.h> #include <base/logging.h> +#include <base/metrics/statistics_recorder.h> #include <base/strings/string_util.h> #include <base/time/time.h> #include <brillo/flag_helper.h> #include <brillo/syslog_logging.h> #include "constants.h" +#include "uploader/bn_metricsd_impl.h" +#include "uploader/crash_counters.h" #include "uploader/upload_service.h" - int main(int argc, char** argv) { DEFINE_bool(foreground, false, "Don't daemonize"); // Upload the metrics once and exit. (used for testing) - DEFINE_bool(uploader_test, - false, - "run the uploader once and exit"); + DEFINE_bool(uploader_test, false, "run the uploader once and exit"); // Upload Service flags. - DEFINE_int32(upload_interval_secs, - 1800, + DEFINE_int32(upload_interval_secs, 1800, "Interval at which metrics_daemon sends the metrics. (needs " "-uploader)"); - DEFINE_string(server, - metrics::kMetricsServer, + DEFINE_string(server, metrics::kMetricsServer, "Server to upload the metrics to. (needs -uploader)"); DEFINE_string(private_directory, metrics::kMetricsdDirectory, "Path to the private directory used by metricsd " @@ -56,8 +56,8 @@ int main(int argc, char** argv) { brillo::FlagHelper::Init(argc, argv, "Brillo metrics daemon."); - int logging_location = (FLAGS_foreground ? brillo::kLogToStderr - : brillo::kLogToSyslog); + int logging_location = + (FLAGS_foreground ? brillo::kLogToStderr : brillo::kLogToSyslog); if (FLAGS_logtosyslog) logging_location = brillo::kLogToSyslog; @@ -76,10 +76,18 @@ int main(int argc, char** argv) { return errno; } - UploadService service( + std::shared_ptr<CrashCounters> counters(new CrashCounters); + + UploadService upload_service( FLAGS_server, base::TimeDelta::FromSeconds(FLAGS_upload_interval_secs), base::FilePath(FLAGS_private_directory), - base::FilePath(FLAGS_shared_directory)); + base::FilePath(FLAGS_shared_directory), counters); + + base::StatisticsRecorder::Initialize(); + + // Create and start the binder thread. + BnMetricsdImpl binder_service(counters); + std::thread binder_thread(&BnMetricsdImpl::Run, &binder_service); - service.Run(); + upload_service.Run(); } |