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

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

Issue 7430007: Merge tcmalloc r111 (perftools v. 1.8) with the chromium/ branch. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // frames, we could skip nothing, but that would increase the 277 // frames, we could skip nothing, but that would increase the
278 // profile size unnecessarily. 278 // profile size unnecessarily.
279 int depth = GetStackTraceWithContext(stack + 1, arraysize(stack) - 1, 279 int depth = GetStackTraceWithContext(stack + 1, arraysize(stack) - 1,
280 2, signal_ucontext); 280 2, signal_ucontext);
281 depth++; // To account for pc value in stack[0]; 281 depth++; // To account for pc value in stack[0];
282 282
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__)) && !defined(__native_client_ _)
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 ProfilerFlush() { 293 extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
294 CpuProfiler::instance_.FlushTable(); 294 CpuProfiler::instance_.FlushTable();
295 } 295 }
296 296
297 extern "C" PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads() { 297 extern "C" PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads() {
(...skipping 11 matching lines...) Expand all
309 309
310 extern "C" PERFTOOLS_DLL_DECL void ProfilerStop() { 310 extern "C" PERFTOOLS_DLL_DECL void ProfilerStop() {
311 CpuProfiler::instance_.Stop(); 311 CpuProfiler::instance_.Stop();
312 } 312 }
313 313
314 extern "C" PERFTOOLS_DLL_DECL void ProfilerGetCurrentState( 314 extern "C" PERFTOOLS_DLL_DECL void ProfilerGetCurrentState(
315 ProfilerState* state) { 315 ProfilerState* state) {
316 CpuProfiler::instance_.GetCurrentState(state); 316 CpuProfiler::instance_.GetCurrentState(state);
317 } 317 }
318 318
319 #else // OS_CYGWIN 319 #else // !defined(OS_CYGWIN) && !defined(__native_client__)
320 320
321 // ITIMER_PROF doesn't work under cygwin. ITIMER_REAL is available, but doesn't 321 // 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 322 // work as well for profiling, and also interferes with alarm(). Because of
323 // these issues, unless a specific need is identified, profiler support is 323 // these issues, unless a specific need is identified, profiler support is
324 // disabled under Cygwin. 324 // disabled under Cygwin.
325 //
326 // Native Client runtime also does not have signals working.
325 extern "C" void ProfilerRegisterThread() { } 327 extern "C" void ProfilerRegisterThread() { }
326 extern "C" void ProfilerFlush() { } 328 extern "C" void ProfilerFlush() { }
327 extern "C" int ProfilingIsEnabledForAllThreads() { return 0; } 329 extern "C" int ProfilingIsEnabledForAllThreads() { return 0; }
328 extern "C" int ProfilerStart(const char* fname) { return 0; } 330 extern "C" int ProfilerStart(const char* fname) { return 0; }
329 extern "C" int ProfilerStartWithOptions(const char *fname, 331 extern "C" int ProfilerStartWithOptions(const char *fname,
330 const ProfilerOptions *options) { 332 const ProfilerOptions *options) {
331 return 0; 333 return 0;
332 } 334 }
333 extern "C" void ProfilerStop() { } 335 extern "C" void ProfilerStop() { }
334 extern "C" void ProfilerGetCurrentState(ProfilerState* state) { 336 extern "C" void ProfilerGetCurrentState(ProfilerState* state) {
335 memset(state, 0, sizeof(*state)); 337 memset(state, 0, sizeof(*state));
336 } 338 }
337 339
338 #endif // OS_CYGWIN 340 #endif // !defined(OS_CYGWIN) && !defined(__native_client__)
339 341
340 // DEPRECATED routines 342 // DEPRECATED routines
341 extern "C" PERFTOOLS_DLL_DECL void ProfilerEnable() { } 343 extern "C" PERFTOOLS_DLL_DECL void ProfilerEnable() { }
342 extern "C" PERFTOOLS_DLL_DECL void ProfilerDisable() { } 344 extern "C" PERFTOOLS_DLL_DECL void ProfilerDisable() { }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698