| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 #include "../include/v8-profiler.h" | 38 #include "../include/v8-profiler.h" |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 static const int kTickSamplesBufferChunkSize = 64 * KB; | 43 static const int kTickSamplesBufferChunkSize = 64 * KB; |
| 44 static const int kTickSamplesBufferChunksCount = 16; | 44 static const int kTickSamplesBufferChunksCount = 16; |
| 45 static const int kProfilerStackSize = 64 * KB; | 45 static const int kProfilerStackSize = 64 * KB; |
| 46 | 46 |
| 47 | 47 |
| 48 ProfilerEventsProcessor::ProfilerEventsProcessor( | 48 ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) |
| 49 ProfileGenerator* generator, CpuProfilesCollection* profiles) | |
| 50 : Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)), | 49 : Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)), |
| 51 generator_(generator), | 50 generator_(generator), |
| 52 running_(true), | 51 running_(true), |
| 53 ticks_buffer_(sizeof(TickSampleEventRecord), | 52 ticks_buffer_(sizeof(TickSampleEventRecord), |
| 54 kTickSamplesBufferChunkSize, | 53 kTickSamplesBufferChunkSize, |
| 55 kTickSamplesBufferChunksCount), | 54 kTickSamplesBufferChunksCount), |
| 56 enqueue_order_(0) { | 55 enqueue_order_(0) { |
| 57 } | 56 } |
| 58 | 57 |
| 59 | 58 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 StartProfiling(profiles_->GetName(title), record_samples); | 427 StartProfiling(profiles_->GetName(title), record_samples); |
| 429 } | 428 } |
| 430 | 429 |
| 431 | 430 |
| 432 void CpuProfiler::StartProcessorIfNotStarted() { | 431 void CpuProfiler::StartProcessorIfNotStarted() { |
| 433 if (processor_ == NULL) { | 432 if (processor_ == NULL) { |
| 434 // Disable logging when using the new implementation. | 433 // Disable logging when using the new implementation. |
| 435 saved_logging_nesting_ = isolate_->logger()->logging_nesting_; | 434 saved_logging_nesting_ = isolate_->logger()->logging_nesting_; |
| 436 isolate_->logger()->logging_nesting_ = 0; | 435 isolate_->logger()->logging_nesting_ = 0; |
| 437 generator_ = new ProfileGenerator(profiles_); | 436 generator_ = new ProfileGenerator(profiles_); |
| 438 processor_ = new ProfilerEventsProcessor(generator_, profiles_); | 437 processor_ = new ProfilerEventsProcessor(generator_); |
| 439 is_profiling_ = true; | 438 is_profiling_ = true; |
| 440 processor_->StartSynchronously(); | 439 processor_->StartSynchronously(); |
| 441 // Enumerate stuff we already have in the heap. | 440 // Enumerate stuff we already have in the heap. |
| 442 if (isolate_->heap()->HasBeenSetUp()) { | 441 if (isolate_->heap()->HasBeenSetUp()) { |
| 443 if (!FLAG_prof_browser_mode) { | 442 if (!FLAG_prof_browser_mode) { |
| 444 isolate_->logger()->LogCodeObjects(); | 443 isolate_->logger()->LogCodeObjects(); |
| 445 } | 444 } |
| 446 isolate_->logger()->LogCompiledFunctions(); | 445 isolate_->logger()->LogCompiledFunctions(); |
| 447 isolate_->logger()->LogAccessorCallbacks(); | 446 isolate_->logger()->LogAccessorCallbacks(); |
| 448 } | 447 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 processor_->Join(); | 499 processor_->Join(); |
| 501 delete processor_; | 500 delete processor_; |
| 502 delete generator_; | 501 delete generator_; |
| 503 processor_ = NULL; | 502 processor_ = NULL; |
| 504 generator_ = NULL; | 503 generator_ = NULL; |
| 505 logger->logging_nesting_ = saved_logging_nesting_; | 504 logger->logging_nesting_ = saved_logging_nesting_; |
| 506 } | 505 } |
| 507 | 506 |
| 508 | 507 |
| 509 } } // namespace v8::internal | 508 } } // namespace v8::internal |
| OLD | NEW |