From 38cf2aab3ed5e8b4f6811a2505f860209cd3f42c Mon Sep 17 00:00:00 2001 From: "eaugusti@chromium.org" Date: Sat, 9 Jun 2012 00:40:31 +0000 Subject: Representation of metrics for Performance Monitor A small class representing metrics. BUG=130212 Review URL: https://chromiumcodereview.appspot.com/10533030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141333 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/performance_monitor/metric_details.cc | 21 ++++++++++++++ .../browser/performance_monitor/metric_details.h | 25 +++++++++++++++++ chrome/browser/performance_monitor/metric_info.cc | 32 ++++++++++++++++++++++ chrome/browser/performance_monitor/metric_info.h | 27 ++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 chrome/browser/performance_monitor/metric_details.cc create mode 100644 chrome/browser/performance_monitor/metric_details.h create mode 100644 chrome/browser/performance_monitor/metric_info.cc create mode 100644 chrome/browser/performance_monitor/metric_info.h (limited to 'chrome/browser/performance_monitor') diff --git a/chrome/browser/performance_monitor/metric_details.cc b/chrome/browser/performance_monitor/metric_details.cc new file mode 100644 index 0000000..e16e1de --- /dev/null +++ b/chrome/browser/performance_monitor/metric_details.cc @@ -0,0 +1,21 @@ +// Copyright (c) 2012 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. + +#include "chrome/browser/performance_monitor/metric_details.h" + +namespace performance_monitor { + +MetricDetails::MetricDetails() { +} + +MetricDetails::MetricDetails(const std::string& metric_name, + const std::string& metric_description) + : name(metric_name), + description(metric_description) { +} + +MetricDetails::~MetricDetails() { +} + +} // namespace performance_monitor diff --git a/chrome/browser/performance_monitor/metric_details.h b/chrome/browser/performance_monitor/metric_details.h new file mode 100644 index 0000000..3d11b83 --- /dev/null +++ b/chrome/browser/performance_monitor/metric_details.h @@ -0,0 +1,25 @@ +// Copyright (c) 2012 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. + +#ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_DETAILS_H_ +#define CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_DETAILS_H_ +#pragma once + +#include + +namespace performance_monitor { + +struct MetricDetails { + MetricDetails(); + MetricDetails(const std::string& metric_name, + const std::string& metric_description); + ~MetricDetails(); + + std::string name; + std::string description; +}; + +} // namespace performance_monitor + +#endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_DETAILS_H_ diff --git a/chrome/browser/performance_monitor/metric_info.cc b/chrome/browser/performance_monitor/metric_info.cc new file mode 100644 index 0000000..79ed181 --- /dev/null +++ b/chrome/browser/performance_monitor/metric_info.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2012 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. + +#include "chrome/browser/performance_monitor/metric_info.h" + +#include "base/logging.h" +#include "base/string_number_conversions.h" + +namespace performance_monitor { + +MetricInfo::MetricInfo() { + value = 0.0; +} + +MetricInfo::MetricInfo(const base::Time& metric_time, double metric_value) + : time(metric_time), + value(metric_value) { +} + +MetricInfo::MetricInfo(const std::string& metric_time, + const std::string& metric_value) { + int64 conversion = 0; + base::StringToInt64(metric_time, &conversion); + time = base::Time::FromInternalValue(conversion); + CHECK(base::StringToDouble(metric_value, &value)); +} + +MetricInfo::~MetricInfo() { +} + +} // namespace performance_monitor diff --git a/chrome/browser/performance_monitor/metric_info.h b/chrome/browser/performance_monitor/metric_info.h new file mode 100644 index 0000000..953fd2c --- /dev/null +++ b/chrome/browser/performance_monitor/metric_info.h @@ -0,0 +1,27 @@ +// Copyright (c) 2012 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. + +#ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_INFO_H_ +#define CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_INFO_H_ +#pragma once + +#include + +#include "base/time.h" + +namespace performance_monitor { + +struct MetricInfo { + MetricInfo(); + MetricInfo(const base::Time& metric_time, double metric_value); + MetricInfo(const std::string& metric_time, const std::string& metric_value); + ~MetricInfo(); + + base::Time time; + double value; +}; + +} // namespace performance_monitor + +#endif // CHROME_BROWSER_PERFORMANCE_MONITOR_METRIC_INFO_H_ -- cgit v1.1