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 #include "base/metrics/histogram_base.h" | 5 #include "base/metrics/histogram_base.h" |
6 | 6 |
7 #include <climits> | 7 #include <climits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/histogram_samples.h" | 13 #include "base/metrics/histogram_samples.h" |
14 #include "base/metrics/sparse_histogram.h" | 14 #include "base/metrics/sparse_histogram.h" |
15 #include "base/pickle.h" | 15 #include "base/pickle.h" |
| 16 #include "base/process_util.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 | 20 |
20 std::string HistogramTypeToString(HistogramType type) { | 21 std::string HistogramTypeToString(HistogramType type) { |
21 switch(type) { | 22 switch(type) { |
22 case HISTOGRAM: | 23 case HISTOGRAM: |
23 return "HISTOGRAM"; | 24 return "HISTOGRAM"; |
24 case LINEAR_HISTOGRAM: | 25 case LINEAR_HISTOGRAM: |
25 return "LINEAR_HISTOGRAM"; | 26 return "LINEAR_HISTOGRAM"; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); | 113 scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); |
113 GetParameters(parameters.get()); | 114 GetParameters(parameters.get()); |
114 | 115 |
115 JSONStringValueSerializer serializer(output); | 116 JSONStringValueSerializer serializer(output); |
116 DictionaryValue root; | 117 DictionaryValue root; |
117 root.SetString("name", histogram_name()); | 118 root.SetString("name", histogram_name()); |
118 root.SetInteger("count", count); | 119 root.SetInteger("count", count); |
119 root.SetInteger("flags", flags()); | 120 root.SetInteger("flags", flags()); |
120 root.Set("params", parameters.release()); | 121 root.Set("params", parameters.release()); |
121 root.Set("buckets", buckets.release()); | 122 root.Set("buckets", buckets.release()); |
| 123 root.SetInteger("pid", GetCurrentProcId()); |
122 serializer.Serialize(root); | 124 serializer.Serialize(root); |
123 } | 125 } |
124 | 126 |
125 } // namespace base | 127 } // namespace base |
OLD | NEW |