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

Side by Side Diff: src/cpu-profiler.cc

Issue 23115005: Use signals for cpu profiling on Mac OS X (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 3 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 | « no previous file | src/sampler.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 if (processor_ == NULL) { 429 if (processor_ == NULL) {
430 Logger* logger = isolate_->logger(); 430 Logger* logger = isolate_->logger();
431 // Disable logging when using the new implementation. 431 // Disable logging when using the new implementation.
432 saved_logging_nesting_ = logger->logging_nesting_; 432 saved_logging_nesting_ = logger->logging_nesting_;
433 logger->logging_nesting_ = 0; 433 logger->logging_nesting_ = 0;
434 generator_ = new ProfileGenerator(profiles_); 434 generator_ = new ProfileGenerator(profiles_);
435 Sampler* sampler = logger->sampler(); 435 Sampler* sampler = logger->sampler();
436 processor_ = new ProfilerEventsProcessor( 436 processor_ = new ProfilerEventsProcessor(
437 generator_, sampler, FLAG_cpu_profiler_sampling_interval); 437 generator_, sampler, FLAG_cpu_profiler_sampling_interval);
438 is_profiling_ = true; 438 is_profiling_ = true;
439 processor_->StartSynchronously();
440 // Enumerate stuff we already have in the heap. 439 // Enumerate stuff we already have in the heap.
441 ASSERT(isolate_->heap()->HasBeenSetUp()); 440 ASSERT(isolate_->heap()->HasBeenSetUp());
442 if (!FLAG_prof_browser_mode) { 441 if (!FLAG_prof_browser_mode) {
443 logger->LogCodeObjects(); 442 logger->LogCodeObjects();
444 } 443 }
445 logger->LogCompiledFunctions(); 444 logger->LogCompiledFunctions();
446 logger->LogAccessorCallbacks(); 445 logger->LogAccessorCallbacks();
447 LogBuiltins(); 446 LogBuiltins();
448 // Enable stack sampling. 447 // Enable stack sampling.
449 if (Sampler::CanSampleOnProfilerEventsProcessorThread()) { 448 if (Sampler::CanSampleOnProfilerEventsProcessorThread()) {
450 sampler->SetHasProcessingThread(true); 449 sampler->SetHasProcessingThread(true);
451 } 450 }
452 sampler->IncreaseProfilingDepth(); 451 sampler->IncreaseProfilingDepth();
453 if (!sampler->IsActive()) { 452 if (!sampler->IsActive()) {
454 sampler->Start(); 453 sampler->Start();
455 need_to_stop_sampler_ = true; 454 need_to_stop_sampler_ = true;
456 } 455 }
456 processor_->StartSynchronously();
457 } 457 }
458 } 458 }
459 459
460 460
461 CpuProfile* CpuProfiler::StopProfiling(const char* title) { 461 CpuProfile* CpuProfiler::StopProfiling(const char* title) {
462 if (!is_profiling_) return NULL; 462 if (!is_profiling_) return NULL;
463 StopProcessorIfLastProfile(title); 463 StopProcessorIfLastProfile(title);
464 CpuProfile* result = profiles_->StopProfiling(title); 464 CpuProfile* result = profiles_->StopProfiling(title);
465 if (result != NULL) { 465 if (result != NULL) {
466 result->Print(); 466 result->Print();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
512 Builtins::Name id = static_cast<Builtins::Name>(i); 512 Builtins::Name id = static_cast<Builtins::Name>(i);
513 rec->start = builtins->builtin(id)->address(); 513 rec->start = builtins->builtin(id)->address();
514 rec->builtin_id = id; 514 rec->builtin_id = id;
515 processor_->Enqueue(evt_rec); 515 processor_->Enqueue(evt_rec);
516 } 516 }
517 } 517 }
518 518
519 519
520 } } // namespace v8::internal 520 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/sampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698