diff options
author | eaugusti@chromium.org <eaugusti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-09 00:40:31 +0000 |
---|---|---|
committer | eaugusti@chromium.org <eaugusti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-09 00:40:31 +0000 |
commit | 38cf2aab3ed5e8b4f6811a2505f860209cd3f42c (patch) | |
tree | 734ea0b65eeb72aebd1f702cb3ade9d1fd156163 /chrome/browser/performance_monitor | |
parent | c27de87ecbbe57d891711c9eca26e9bbe9ae0d96 (diff) | |
download | chromium_src-38cf2aab3ed5e8b4f6811a2505f860209cd3f42c.zip chromium_src-38cf2aab3ed5e8b4f6811a2505f860209cd3f42c.tar.gz chromium_src-38cf2aab3ed5e8b4f6811a2505f860209cd3f42c.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/performance_monitor')
-rw-r--r-- | chrome/browser/performance_monitor/metric_details.cc | 21 | ||||
-rw-r--r-- | chrome/browser/performance_monitor/metric_details.h | 25 | ||||
-rw-r--r-- | chrome/browser/performance_monitor/metric_info.cc | 32 | ||||
-rw-r--r-- | chrome/browser/performance_monitor/metric_info.h | 27 |
4 files changed, 105 insertions, 0 deletions
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 <string> + +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 <string> + +#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_ |