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

Side by Side Diff: chrome/browser/browser_shutdown.cc

Issue 28046: Use string for Histogram names since these are all ASCII anyway wide-characte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/chrome_plugin_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/browser_shutdown.h" 5 #include "chrome/browser/browser_shutdown.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 ShutdownType type = 183 ShutdownType type =
184 static_cast<ShutdownType>(prefs->GetInteger(prefs::kShutdownType)); 184 static_cast<ShutdownType>(prefs->GetInteger(prefs::kShutdownType));
185 int num_procs = prefs->GetInteger(prefs::kShutdownNumProcesses); 185 int num_procs = prefs->GetInteger(prefs::kShutdownNumProcesses);
186 int num_procs_slow = prefs->GetInteger(prefs::kShutdownNumProcessesSlow); 186 int num_procs_slow = prefs->GetInteger(prefs::kShutdownNumProcessesSlow);
187 // clear the prefs immediately so we don't pick them up on a future run 187 // clear the prefs immediately so we don't pick them up on a future run
188 prefs->SetInteger(prefs::kShutdownType, NOT_VALID); 188 prefs->SetInteger(prefs::kShutdownType, NOT_VALID);
189 prefs->SetInteger(prefs::kShutdownNumProcesses, 0); 189 prefs->SetInteger(prefs::kShutdownNumProcesses, 0);
190 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 0); 190 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 0);
191 191
192 if (type > NOT_VALID && shutdown_ms > 0 && num_procs > 0) { 192 if (type > NOT_VALID && shutdown_ms > 0 && num_procs > 0) {
193 const wchar_t *time_fmt = L"Shutdown.%ls.time"; 193 const char *time_fmt = "Shutdown.%s.time";
194 const wchar_t *time_per_fmt = L"Shutdown.%ls.time_per_process"; 194 const char *time_per_fmt = "Shutdown.%s.time_per_process";
195 std::wstring time; 195 std::string time;
196 std::wstring time_per; 196 std::string time_per;
197 if (type == WINDOW_CLOSE) { 197 if (type == WINDOW_CLOSE) {
198 time = StringPrintf(time_fmt, L"window_close"); 198 time = StringPrintf(time_fmt, "window_close");
199 time_per = StringPrintf(time_per_fmt, L"window_close"); 199 time_per = StringPrintf(time_per_fmt, "window_close");
200 } else if (type == BROWSER_EXIT) { 200 } else if (type == BROWSER_EXIT) {
201 time = StringPrintf(time_fmt, L"browser_exit"); 201 time = StringPrintf(time_fmt, "browser_exit");
202 time_per = StringPrintf(time_per_fmt, L"browser_exit"); 202 time_per = StringPrintf(time_per_fmt, "browser_exit");
203 } else if (type == END_SESSION) { 203 } else if (type == END_SESSION) {
204 time = StringPrintf(time_fmt, L"end_session"); 204 time = StringPrintf(time_fmt, "end_session");
205 time_per = StringPrintf(time_per_fmt, L"end_session"); 205 time_per = StringPrintf(time_per_fmt, "end_session");
206 } else { 206 } else {
207 NOTREACHED(); 207 NOTREACHED();
208 } 208 }
209 if (time.length()) { 209 if (time.length()) {
210 // TODO(erikkay): change these to UMA histograms after a bit more testing. 210 // TODO(erikkay): change these to UMA histograms after a bit more testing.
211 UMA_HISTOGRAM_TIMES(time.c_str(), 211 UMA_HISTOGRAM_TIMES(time.c_str(),
212 TimeDelta::FromMilliseconds(shutdown_ms)); 212 TimeDelta::FromMilliseconds(shutdown_ms));
213 UMA_HISTOGRAM_TIMES(time_per.c_str(), 213 UMA_HISTOGRAM_TIMES(time_per.c_str(),
214 TimeDelta::FromMilliseconds(shutdown_ms / num_procs)); 214 TimeDelta::FromMilliseconds(shutdown_ms / num_procs));
215 UMA_HISTOGRAM_COUNTS_100(L"Shutdown.renderers.total", num_procs); 215 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.total", num_procs);
216 UMA_HISTOGRAM_COUNTS_100(L"Shutdown.renderers.slow", num_procs_slow); 216 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.slow", num_procs_slow);
217 } 217 }
218 } 218 }
219 } 219 }
220 220
221 } // namespace browser_shutdown 221 } // namespace browser_shutdown
OLDNEW
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/chrome_plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698