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

Unified Diff: base/histogram.cc

Issue 3119022: Header cleanup in base.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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
Index: base/histogram.cc
===================================================================
--- base/histogram.cc (revision 56291)
+++ base/histogram.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,7 @@
#include "base/lock.h"
#include "base/logging.h"
#include "base/pickle.h"
-#include "base/string_util.h"
+#include "base/stringprintf.h"
using base::TimeDelta;
@@ -340,10 +340,10 @@
void Histogram::WriteAsciiHeader(const SampleSet& snapshot,
Count sample_count,
std::string* output) const {
- StringAppendF(output,
- "Histogram: %s recorded %d samples",
- histogram_name().c_str(),
- sample_count);
+ base::StringAppendF(output,
+ "Histogram: %s recorded %d samples",
+ histogram_name().c_str(),
+ sample_count);
if (0 == sample_count) {
DCHECK_EQ(snapshot.sum(), 0);
} else {
@@ -352,12 +352,13 @@
- average * average;
double standard_deviation = sqrt(variance);
- StringAppendF(output,
- ", average = %.1f, standard deviation = %.1f",
- average, standard_deviation);
+ base::StringAppendF(output,
+ ", average = %.1f, standard deviation = %.1f",
+ average, standard_deviation);
}
if (flags_ & ~kHexRangePrintingFlag )
- StringAppendF(output, " (flags = 0x%x)", flags_ & ~kHexRangePrintingFlag);
+ base::StringAppendF(output, " (flags = 0x%x)",
+ flags_ & ~kHexRangePrintingFlag);
}
void Histogram::WriteAsciiBucketContext(const int64 past,
@@ -369,22 +370,22 @@
WriteAsciiBucketValue(current, scaled_sum, output);
if (0 < i) {
double percentage = past / scaled_sum;
- StringAppendF(output, " {%3.1f%%}", percentage);
+ base::StringAppendF(output, " {%3.1f%%}", percentage);
}
}
const std::string Histogram::GetAsciiBucketRange(size_t i) const {
std::string result;
if (kHexRangePrintingFlag & flags_)
- StringAppendF(&result, "%#x", ranges(i));
+ base::StringAppendF(&result, "%#x", ranges(i));
else
- StringAppendF(&result, "%d", ranges(i));
+ base::StringAppendF(&result, "%d", ranges(i));
return result;
}
void Histogram::WriteAsciiBucketValue(Count current, double scaled_sum,
std::string* output) const {
- StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
+ base::StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
}
void Histogram::WriteAsciiBucketGraph(double current_size, double max_size,
@@ -854,10 +855,12 @@
std::string* output) {
if (!histograms_)
return;
- if (query.length())
- StringAppendF(output, "Collections of histograms for %s\n", query.c_str());
- else
+ if (query.length()) {
+ base::StringAppendF(output, "Collections of histograms for %s\n",
+ query.c_str());
+ } else {
output->append("Collections of all histograms\n");
+ }
Histograms snapshot;
GetSnapshot(query, &snapshot);
« no previous file with comments | « base/file_util_win.cc ('k') | base/histogram_unittest.cc » ('j') | base/logging.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698