OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 | 6 |
7 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
8 // Description of the life cycle of a instance of MetricsService. | 8 // Description of the life cycle of a instance of MetricsService. |
9 // | 9 // |
10 // OVERVIEW | 10 // OVERVIEW |
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 RecordCurrentState(pref); | 1748 RecordCurrentState(pref); |
1749 } | 1749 } |
1750 | 1750 |
1751 void MetricsService::RecordCurrentState(PrefService* pref) { | 1751 void MetricsService::RecordCurrentState(PrefService* pref) { |
1752 pref->SetString(prefs::kStabilityLastTimestampSec, | 1752 pref->SetString(prefs::kStabilityLastTimestampSec, |
1753 Int64ToWString(Time::Now().ToTimeT())); | 1753 Int64ToWString(Time::Now().ToTimeT())); |
1754 | 1754 |
1755 RecordPluginChanges(pref); | 1755 RecordPluginChanges(pref); |
1756 } | 1756 } |
1757 | 1757 |
| 1758 void MetricsService::CollectRendererHistograms() { |
| 1759 for (RenderProcessHost::iterator it = RenderProcessHost::begin(); |
| 1760 it != RenderProcessHost::end(); ++it) { |
| 1761 it->second->Send(new ViewMsg_GetRendererHistograms()); |
| 1762 } |
| 1763 } |
| 1764 |
1758 void MetricsService::RecordCurrentHistograms() { | 1765 void MetricsService::RecordCurrentHistograms() { |
1759 DCHECK(current_log_); | 1766 DCHECK(current_log_); |
1760 | 1767 |
| 1768 CollectRendererHistograms(); |
| 1769 |
| 1770 // TODO(raman): Delay the metrics collection activities until we get all the |
| 1771 // updates from the renderers, or we time out (1 second? 3 seconds?). |
| 1772 |
1761 StatisticsRecorder::Histograms histograms; | 1773 StatisticsRecorder::Histograms histograms; |
1762 StatisticsRecorder::GetHistograms(&histograms); | 1774 StatisticsRecorder::GetHistograms(&histograms); |
1763 for (StatisticsRecorder::Histograms::iterator it = histograms.begin(); | 1775 for (StatisticsRecorder::Histograms::iterator it = histograms.begin(); |
1764 histograms.end() != it; | 1776 histograms.end() != it; |
1765 ++it) { | 1777 ++it) { |
1766 if ((*it)->flags() & kUmaTargetedHistogramFlag) | 1778 if ((*it)->flags() & kUmaTargetedHistogramFlag) |
1767 // TODO(petersont): Only record historgrams if they are not precluded by | 1779 // TODO(petersont): Only record historgrams if they are not precluded by |
1768 // the UMA response data. | 1780 // the UMA response data. |
1769 // Bug http://code.google.com/p/chromium/issues/detail?id=2739. | 1781 // Bug http://code.google.com/p/chromium/issues/detail?id=2739. |
1770 RecordHistogram(**it); | 1782 RecordHistogram(**it); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 L"." + key; | 1836 L"." + key; |
1825 prof_prefs->SetInteger(pref_key.c_str(), value); | 1837 prof_prefs->SetInteger(pref_key.c_str(), value); |
1826 } | 1838 } |
1827 | 1839 |
1828 static bool IsSingleThreaded() { | 1840 static bool IsSingleThreaded() { |
1829 static PlatformThreadId thread_id = 0; | 1841 static PlatformThreadId thread_id = 0; |
1830 if (!thread_id) | 1842 if (!thread_id) |
1831 thread_id = PlatformThread::CurrentId(); | 1843 thread_id = PlatformThread::CurrentId(); |
1832 return PlatformThread::CurrentId() == thread_id; | 1844 return PlatformThread::CurrentId() == thread_id; |
1833 } | 1845 } |
OLD | NEW |