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

Side by Side Diff: statsreport/aggregator.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « statsreport/aggregator.h ('k') | statsreport/aggregator-win32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2006-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15 //
16 // Implementation of helper classes to aggregate the collected in-memory
17 // stats to persistent storage.
18 #include "aggregator.h"
19
20 namespace stats_report {
21
22 bool MetricsAggregator::AggregateMetrics() {
23 if (!StartAggregation())
24 return false;
25
26 MetricIterator it(coll_), end;
27 for (; it != end; ++it) {
28 MetricBase *metric = *it;
29 DCHECK(NULL != metric);
30
31 switch (metric->type()) {
32 case kCountType:
33 Aggregate(metric->AsCount());
34 break;
35 case kTimingType:
36 Aggregate(metric->AsTiming());
37 break;
38 case kIntegerType:
39 Aggregate(metric->AsInteger());
40 break;
41 case kBoolType:
42 Aggregate(metric->AsBool());
43 break;
44 default:
45 DCHECK(false && "Impossible metric type");
46 break;
47 }
48 }
49
50 // done, close up
51 EndAggregation();
52
53 return true;
54 }
55
56 MetricsAggregator::MetricsAggregator() : coll_(g_global_metrics) {
57 DCHECK(coll_.initialized());
58 }
59
60 MetricsAggregator::MetricsAggregator(const MetricCollection &coll)
61 : coll_(coll) {
62 DCHECK(coll_.initialized());
63 }
64
65 MetricsAggregator::~MetricsAggregator() {
66 }
67
68 bool MetricsAggregator::StartAggregation() {
69 // nothing
70 return true;
71 }
72
73 void MetricsAggregator::EndAggregation() {
74 // nothing
75 }
76
77 } // namespace stats_report
OLDNEW
« no previous file with comments | « statsreport/aggregator.h ('k') | statsreport/aggregator-win32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698