| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H_ |
| 6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H_ | 6 #define CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/tracked_objects.h" | 10 #include "base/tracked_objects.h" |
| 11 #include "chrome/browser/performance_monitor/database.h" |
| 11 #include "chrome/browser/performance_monitor/event.h" | 12 #include "chrome/browser/performance_monitor/event.h" |
| 12 #include "chrome/browser/performance_monitor/metric_info.h" | 13 #include "chrome/browser/performance_monitor/metric.h" |
| 13 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 14 | 15 |
| 15 namespace performance_monitor { | 16 namespace performance_monitor { |
| 16 namespace util { | 17 namespace util { |
| 17 | 18 |
| 18 // Metric data can be either dense or sporadic, so AggregateMetric() normalizes | 19 // Metric data can be either dense or sporadic, so AggregateMetric() normalizes |
| 19 // the metric data in time. |metric_infos| must be sorted in increasing time. | 20 // the metric data in time. |metrics| must be sorted in increasing time. |
| 20 // Put concisely, AggregateMetric() does sample rate conversion from irregular | 21 // Put concisely, AggregateMetric() does sample rate conversion from irregular |
| 21 // metric data points to a sample period of |resolution| beginning at |start|. | 22 // metric data points to a sample period of |resolution| beginning at |start|. |
| 22 // Each sampling window starts and ends at an integer multiple away from | 23 // Each sampling window starts and ends at an integer multiple away from |
| 23 // |start| and data points are omitted if there are no points to resample. | 24 // |start| and data points are omitted if there are no points to resample. |
| 24 std::vector<MetricInfo> AggregateMetric( | 25 Database::MetricVector AggregateMetric(const Database::MetricVector& metrics, |
| 25 const std::vector<MetricInfo>& metric_infos, | 26 const base::Time& start, |
| 26 const base::Time& start, | 27 const base::TimeDelta& resolution); |
| 27 const base::TimeDelta& resolution); | |
| 28 | 28 |
| 29 // Posts |request| to the performance monitor database's sequenced thread. On | 29 // Posts |request| to the performance monitor database's sequenced thread. On |
| 30 // completion |reply| is posted to the thread that called | 30 // completion |reply| is posted to the thread that called |
| 31 // PostTaskToDatabaseThreadAndReply. | 31 // PostTaskToDatabaseThreadAndReply. |
| 32 bool PostTaskToDatabaseThreadAndReply( | 32 bool PostTaskToDatabaseThreadAndReply( |
| 33 const tracked_objects::Location& from_here, | 33 const tracked_objects::Location& from_here, |
| 34 const base::Closure& request, | 34 const base::Closure& request, |
| 35 const base::Closure& reply); | 35 const base::Closure& reply); |
| 36 | 36 |
| 37 // These are a collection of methods designed to create an event to store the | 37 // These are a collection of methods designed to create an event to store the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 const std::string& profile_name); | 57 const std::string& profile_name); |
| 58 | 58 |
| 59 scoped_ptr<Event> CreateChromeUpdateEvent(const base::Time& time, | 59 scoped_ptr<Event> CreateChromeUpdateEvent(const base::Time& time, |
| 60 const std::string& previous_version, | 60 const std::string& previous_version, |
| 61 const std::string& current_version); | 61 const std::string& current_version); |
| 62 | 62 |
| 63 } // namespace util | 63 } // namespace util |
| 64 } // namespace performance_monitor | 64 } // namespace performance_monitor |
| 65 | 65 |
| 66 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H__ | 66 #endif // CHROME_BROWSER_PERFORMANCE_MONITOR_UTIL_H__ |
| OLD | NEW |