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

Side by Side Diff: third_party/tcmalloc/chromium/src/profiler.cc

Issue 9416072: Fix gperftools to not arm the profiling timer by default. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 instance->collector_.Add(depth, stack); 283 instance->collector_.Add(depth, stack);
284 } 284 }
285 } 285 }
286 286
287 #if !(defined(__CYGWIN__) || defined(__CYGWIN32__)) 287 #if !(defined(__CYGWIN__) || defined(__CYGWIN32__))
288 288
289 extern "C" PERFTOOLS_DLL_DECL void ProfilerRegisterThread() { 289 extern "C" PERFTOOLS_DLL_DECL void ProfilerRegisterThread() {
290 ProfileHandlerRegisterThread(); 290 ProfileHandlerRegisterThread();
291 } 291 }
292 292
293 extern "C" PERFTOOLS_DLL_DECL void ProfilerUnregisterThread() {
294 ProfileHandlerUnregisterThread();
295 }
296
293 extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() { 297 extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
294 CpuProfiler::instance_.FlushTable(); 298 CpuProfiler::instance_.FlushTable();
295 } 299 }
296 300
297 extern "C" PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads() { 301 extern "C" PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads() {
298 return CpuProfiler::instance_.Enabled(); 302 return CpuProfiler::instance_.Enabled();
299 } 303 }
300 304
301 extern "C" PERFTOOLS_DLL_DECL int ProfilerStart(const char* fname) { 305 extern "C" PERFTOOLS_DLL_DECL int ProfilerStart(const char* fname) {
302 return CpuProfiler::instance_.Start(fname, NULL); 306 return CpuProfiler::instance_.Start(fname, NULL);
(...skipping 13 matching lines...) Expand all
316 CpuProfiler::instance_.GetCurrentState(state); 320 CpuProfiler::instance_.GetCurrentState(state);
317 } 321 }
318 322
319 #else // OS_CYGWIN 323 #else // OS_CYGWIN
320 324
321 // ITIMER_PROF doesn't work under cygwin. ITIMER_REAL is available, but doesn't 325 // ITIMER_PROF doesn't work under cygwin. ITIMER_REAL is available, but doesn't
322 // work as well for profiling, and also interferes with alarm(). Because of 326 // work as well for profiling, and also interferes with alarm(). Because of
323 // these issues, unless a specific need is identified, profiler support is 327 // these issues, unless a specific need is identified, profiler support is
324 // disabled under Cygwin. 328 // disabled under Cygwin.
325 extern "C" void ProfilerRegisterThread() { } 329 extern "C" void ProfilerRegisterThread() { }
330 extern "C" void ProfilerUnregisterThread() { }
326 extern "C" void ProfilerFlush() { } 331 extern "C" void ProfilerFlush() { }
327 extern "C" int ProfilingIsEnabledForAllThreads() { return 0; } 332 extern "C" int ProfilingIsEnabledForAllThreads() { return 0; }
328 extern "C" int ProfilerStart(const char* fname) { return 0; } 333 extern "C" int ProfilerStart(const char* fname) { return 0; }
329 extern "C" int ProfilerStartWithOptions(const char *fname, 334 extern "C" int ProfilerStartWithOptions(const char *fname,
330 const ProfilerOptions *options) { 335 const ProfilerOptions *options) {
331 return 0; 336 return 0;
332 } 337 }
333 extern "C" void ProfilerStop() { } 338 extern "C" void ProfilerStop() { }
334 extern "C" void ProfilerGetCurrentState(ProfilerState* state) { 339 extern "C" void ProfilerGetCurrentState(ProfilerState* state) {
335 memset(state, 0, sizeof(*state)); 340 memset(state, 0, sizeof(*state));
336 } 341 }
337 342
338 #endif // OS_CYGWIN 343 #endif // OS_CYGWIN
339 344
340 // DEPRECATED routines 345 // DEPRECATED routines
341 extern "C" PERFTOOLS_DLL_DECL void ProfilerEnable() { } 346 extern "C" PERFTOOLS_DLL_DECL void ProfilerEnable() { }
342 extern "C" PERFTOOLS_DLL_DECL void ProfilerDisable() { } 347 extern "C" PERFTOOLS_DLL_DECL void ProfilerDisable() { }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698