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

Unified Diff: base/test/perftimer.h

Issue 23985006: base: Split logging functions and PerfTimeLogger out of perftimer.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix visitedlink Created 7 years, 3 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
« no previous file with comments | « base/test/perf_time_logger.cc ('k') | chrome/test/perf/url_parse_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/perftimer.h
diff --git a/base/test/perftimer.h b/base/test/perftimer.h
index 1a26cf5cfec31b05966b732895848f55dcb90154..86ee1260ac13fcec2228a96d455ce60284bb12eb 100644
--- a/base/test/perftimer.h
+++ b/base/test/perftimer.h
@@ -5,8 +5,6 @@
#ifndef BASE_TEST_PERFTIMER_H_
#define BASE_TEST_PERFTIMER_H_
-#include <string>
-
#include "base/basictypes.h"
#include "base/time/time.h"
@@ -14,25 +12,7 @@ namespace base {
class FilePath;
}
-// ----------------------------------------------------------------------
-// Initializes and finalizes the perf log. These functions should be
-// called at the beginning and end (respectively) of running all the
-// performance tests. The init function returns true on success.
-// ----------------------------------------------------------------------
-bool InitPerfLog(const base::FilePath& log_path);
-void FinalizePerfLog();
-
-// ----------------------------------------------------------------------
-// LogPerfResult
-// Writes to the perf result log the given 'value' resulting from the
-// named 'test'. The units are to aid in reading the log by people.
-// ----------------------------------------------------------------------
-void LogPerfResult(const char* test_name, double value, const char* units);
-
-// ----------------------------------------------------------------------
-// PerfTimer
-// A simple wrapper around Now()
-// ----------------------------------------------------------------------
+// A simple wrapper around Now()
class PerfTimer {
public:
PerfTimer() {
@@ -46,40 +26,8 @@ class PerfTimer {
private:
base::TimeTicks begin_;
-};
-
-// ----------------------------------------------------------------------
-// PerfTimeLogger
-// Automates calling LogPerfResult for the common case where you want
-// to measure the time that something took. Call Done() when the test
-// is complete if you do extra work after the test or there are stack
-// objects with potentially expensive constructors. Otherwise, this
-// class with automatically log on destruction.
-// ----------------------------------------------------------------------
-class PerfTimeLogger {
- public:
- explicit PerfTimeLogger(const char* test_name)
- : logged_(false),
- test_name_(test_name) {
- }
-
- ~PerfTimeLogger() {
- if (!logged_)
- Done();
- }
- void Done() {
- // we use a floating-point millisecond value because it is more
- // intuitive than microseconds and we want more precision than
- // integer milliseconds
- LogPerfResult(test_name_.c_str(), timer_.Elapsed().InMillisecondsF(), "ms");
- logged_ = true;
- }
-
- private:
- bool logged_;
- std::string test_name_;
- PerfTimer timer_;
+ DISALLOW_COPY_AND_ASSIGN(PerfTimer);
};
#endif // BASE_TEST_PERFTIMER_H_
« no previous file with comments | « base/test/perf_time_logger.cc ('k') | chrome/test/perf/url_parse_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698