Fix a crash in the LegacyRenderWidgetHostHWND destruction code path which occurs...
[chromium-blink-merge.git] / base / test / perf_time_logger.cc
blobc05ba51b7d84d70df2e590e27b7b6fa39d42fb61
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/test/perf_time_logger.h"
7 #include "base/test/perf_log.h"
9 namespace base {
11 PerfTimeLogger::PerfTimeLogger(const char* test_name)
12 : logged_(false), test_name_(test_name) {}
14 PerfTimeLogger::~PerfTimeLogger() {
15 if (!logged_)
16 Done();
19 void PerfTimeLogger::Done() {
20 // we use a floating-point millisecond value because it is more
21 // intuitive than microseconds and we want more precision than
22 // integer milliseconds
23 LogPerfResult(test_name_.c_str(), timer_.Elapsed().InMillisecondsF(), "ms");
24 logged_ = true;
27 } // namespace base