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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 // This will be set to 'true' if we exit cleanly. | 610 // This will be set to 'true' if we exit cleanly. |
611 pref->SetBoolean(prefs::kStabilityExitedCleanly, false); | 611 pref->SetBoolean(prefs::kStabilityExitedCleanly, false); |
612 | 612 |
613 if (!pref->GetBoolean(prefs::kStabilitySessionEndCompleted)) { | 613 if (!pref->GetBoolean(prefs::kStabilitySessionEndCompleted)) { |
614 IncrementPrefValue(prefs::kStabilityIncompleteSessionEndCount); | 614 IncrementPrefValue(prefs::kStabilityIncompleteSessionEndCount); |
615 } | 615 } |
616 // This is marked false when we get a WM_ENDSESSION. | 616 // This is marked false when we get a WM_ENDSESSION. |
617 pref->SetBoolean(prefs::kStabilitySessionEndCompleted, true); | 617 pref->SetBoolean(prefs::kStabilitySessionEndCompleted, true); |
618 | 618 |
619 int64 last_start_time = | 619 int64 last_start_time = |
620 StringToInt64(pref->GetString(prefs::kStabilityLaunchTimeSec)); | 620 StringToInt64(WideToUTF16Hack(pref->GetString( |
621 prefs::kStabilityLaunchTimeSec))); | |
621 int64 last_end_time = | 622 int64 last_end_time = |
622 StringToInt64(pref->GetString(prefs::kStabilityLastTimestampSec)); | 623 StringToInt64(WideToUTF16Hack(pref->GetString( |
brettw
2009/02/27 23:45:15
See previous comment.
| |
624 prefs::kStabilityLastTimestampSec))); | |
623 int64 uptime = | 625 int64 uptime = |
624 StringToInt64(pref->GetString(prefs::kStabilityUptimeSec)); | 626 StringToInt64(WideToUTF16Hack(pref->GetString( |
627 prefs::kStabilityUptimeSec))); | |
625 | 628 |
626 if (last_start_time && last_end_time) { | 629 if (last_start_time && last_end_time) { |
627 // TODO(JAR): Exclude sleep time. ... which must be gathered in UI loop. | 630 // TODO(JAR): Exclude sleep time. ... which must be gathered in UI loop. |
628 uptime += last_end_time - last_start_time; | 631 uptime += last_end_time - last_start_time; |
629 pref->SetString(prefs::kStabilityUptimeSec, Int64ToWString(uptime)); | 632 pref->SetString(prefs::kStabilityUptimeSec, Int64ToWString(uptime)); |
630 } | 633 } |
631 pref->SetString(prefs::kStabilityLaunchTimeSec, | 634 pref->SetString(prefs::kStabilityLaunchTimeSec, |
632 Int64ToWString(Time::Now().ToTimeT())); | 635 Int64ToWString(Time::Now().ToTimeT())); |
633 | 636 |
634 // Save profile metrics. | 637 // Save profile metrics. |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1836 L"." + key; | 1839 L"." + key; |
1837 prof_prefs->SetInteger(pref_key.c_str(), value); | 1840 prof_prefs->SetInteger(pref_key.c_str(), value); |
1838 } | 1841 } |
1839 | 1842 |
1840 static bool IsSingleThreaded() { | 1843 static bool IsSingleThreaded() { |
1841 static PlatformThreadId thread_id = 0; | 1844 static PlatformThreadId thread_id = 0; |
1842 if (!thread_id) | 1845 if (!thread_id) |
1843 thread_id = PlatformThread::CurrentId(); | 1846 thread_id = PlatformThread::CurrentId(); |
1844 return PlatformThread::CurrentId() == thread_id; | 1847 return PlatformThread::CurrentId() == thread_id; |
1845 } | 1848 } |
OLD | NEW |