OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/metrics_helpers.h" | 5 #include "chrome/common/metrics_helpers.h" |
6 | 6 |
7 #if defined(USE_SYSTEM_LIBBZ2) | 7 #if defined(USE_SYSTEM_LIBBZ2) |
8 #include <bzlib.h> | 8 #include <bzlib.h> |
9 #else | 9 #else |
10 #include "third_party/bzip2/bzlib.h" | 10 #include "third_party/bzip2/bzlib.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (!integral_build_time) { | 370 if (!integral_build_time) { |
371 Time time; | 371 Time time; |
372 const char* kDateTime = __DATE__ " " __TIME__ " GMT"; | 372 const char* kDateTime = __DATE__ " " __TIME__ " GMT"; |
373 bool result = Time::FromString(ASCIIToWide(kDateTime).c_str(), &time); | 373 bool result = Time::FromString(ASCIIToWide(kDateTime).c_str(), &time); |
374 DCHECK(result); | 374 DCHECK(result); |
375 integral_build_time = static_cast<int64>(time.ToTimeT()); | 375 integral_build_time = static_cast<int64>(time.ToTimeT()); |
376 } | 376 } |
377 return integral_build_time; | 377 return integral_build_time; |
378 } | 378 } |
379 | 379 |
| 380 MetricsLog* MetricsLogBase::AsMetricsLog() { |
| 381 return NULL; |
| 382 } |
| 383 |
380 // TODO(JAR): A The following should really be part of the histogram class. | 384 // TODO(JAR): A The following should really be part of the histogram class. |
381 // Internal state is being needlessly exposed, and it would be hard to reuse | 385 // Internal state is being needlessly exposed, and it would be hard to reuse |
382 // this code. If we moved this into the Histogram class, then we could use | 386 // this code. If we moved this into the Histogram class, then we could use |
383 // the same infrastructure for logging StatsCounters, RatesCounters, etc. | 387 // the same infrastructure for logging StatsCounters, RatesCounters, etc. |
384 void MetricsLogBase::RecordHistogramDelta( | 388 void MetricsLogBase::RecordHistogramDelta( |
385 const Histogram& histogram, | 389 const Histogram& histogram, |
386 const Histogram::SampleSet& snapshot) { | 390 const Histogram::SampleSet& snapshot) { |
387 DCHECK(!locked_); | 391 DCHECK(!locked_); |
388 DCHECK_NE(0, snapshot.TotalCount()); | 392 DCHECK_NE(0, snapshot.TotalCount()); |
389 snapshot.CheckSize(histogram); | 393 snapshot.CheckSize(histogram); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 snapshot.Subtract(*already_logged); | 570 snapshot.Subtract(*already_logged); |
567 } | 571 } |
568 | 572 |
569 // Snapshot now contains only a delta to what we've already_logged. | 573 // Snapshot now contains only a delta to what we've already_logged. |
570 if (snapshot.redundant_count() > 0) { | 574 if (snapshot.redundant_count() > 0) { |
571 TransmitHistogramDelta(histogram, snapshot); | 575 TransmitHistogramDelta(histogram, snapshot); |
572 // Add new data into our running total. | 576 // Add new data into our running total. |
573 already_logged->Add(snapshot); | 577 already_logged->Add(snapshot); |
574 } | 578 } |
575 } | 579 } |
OLD | NEW |