OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| 6 #define CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| 7 |
| 8 #include <list> |
| 9 #include <map> |
| 10 #include <set> |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/basictypes.h" |
| 15 #include "base/histogram.h" |
| 16 #include "base/process.h" |
| 17 #include "base/scoped_ptr.h" |
| 18 #include "base/task.h" |
| 19 |
| 20 class RendererHistogramSnapshots { |
| 21 public: |
| 22 RendererHistogramSnapshots(); |
| 23 |
| 24 ~RendererHistogramSnapshots() {} |
| 25 |
| 26 // Send the histogram data. |
| 27 void SendHistograms(); |
| 28 |
| 29 // Maintain a map of histogram names to the sample stats we've sent. |
| 30 typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; |
| 31 typedef std::vector<std::string> HistogramPickledList; |
| 32 |
| 33 private: |
| 34 // Extract snapshot data and then send it off the the Browser process. |
| 35 // Send only a delta to what we have already sent. |
| 36 void UploadAllHistrograms(); |
| 37 void UploadHistrogram(const Histogram& histogram, |
| 38 HistogramPickledList* histograms); |
| 39 void UploadHistogramDelta(const Histogram& histogram, |
| 40 const Histogram::SampleSet& snapshot, |
| 41 HistogramPickledList* histograms); |
| 42 |
| 43 ScopedRunnableMethodFactory<RendererHistogramSnapshots> |
| 44 renderer_histogram_snapshots_factory_; |
| 45 |
| 46 // For histograms, record what we've already logged (as a sample for each |
| 47 // histogram) so that we can send only the delta with the next log. |
| 48 LoggedSampleMap logged_samples_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(RendererHistogramSnapshots); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_RENDERER_HISTOGRAM_SNAPSHOTS_H_ |
| 54 |
OLD | NEW |