Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/devtools/v8_sampling_profiler.h" | 5 #include "content/renderer/devtools/v8_sampling_profiler.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #define USE_SIGNALS | 9 #define USE_SIGNALS |
| 10 #endif | 10 #endif |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 // static | 320 // static |
| 321 void Sampler::HandleJitCodeEvent(const v8::JitCodeEvent* event) { | 321 void Sampler::HandleJitCodeEvent(const v8::JitCodeEvent* event) { |
| 322 // Called on the sampled V8 thread. | 322 // Called on the sampled V8 thread. |
| 323 Sampler* sampler = GetInstance(); | 323 Sampler* sampler = GetInstance(); |
| 324 // The sampler may have already been destroyed. | 324 // The sampler may have already been destroyed. |
| 325 // That's fine, we're not interested in these events anymore. | 325 // That's fine, we're not interested in these events anymore. |
| 326 if (!sampler) | 326 if (!sampler) |
| 327 return; | 327 return; |
| 328 switch (event->type) { | 328 switch (event->type) { |
| 329 case v8::JitCodeEvent::CODE_ADDED: | 329 case v8::JitCodeEvent::CODE_ADDED: |
| 330 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 330 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
| 331 "JitCodeAdded", TRACE_EVENT_SCOPE_THREAD, "data", | 331 "JitCodeAdded", TRACE_EVENT_SCOPE_THREAD, "data", |
|
dsinclair
2015/06/30 18:14:17
What does SCOPE_THREAD mean for a metadata event?
alph
2015/07/01 12:28:08
Not really needed, but I thought it might be usefu
| |
| 332 JitCodeEventToTraceFormat(event)); | 332 JitCodeEventToTraceFormat(event)); |
| 333 base::subtle::NoBarrier_AtomicIncrement( | 333 base::subtle::NoBarrier_AtomicIncrement( |
| 334 &sampler->code_added_events_count_, 1); | 334 &sampler->code_added_events_count_, 1); |
| 335 break; | 335 break; |
| 336 | 336 |
| 337 case v8::JitCodeEvent::CODE_MOVED: | 337 case v8::JitCodeEvent::CODE_MOVED: |
| 338 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 338 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
| 339 "JitCodeMoved", TRACE_EVENT_SCOPE_THREAD, "data", | 339 "JitCodeMoved", TRACE_EVENT_SCOPE_THREAD, "data", |
| 340 JitCodeEventToTraceFormat(event)); | 340 JitCodeEventToTraceFormat(event)); |
| 341 break; | 341 break; |
| 342 | 342 |
| 343 case v8::JitCodeEvent::CODE_REMOVED: | 343 case v8::JitCodeEvent::CODE_REMOVED: |
| 344 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 344 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
| 345 "JitCodeRemoved", TRACE_EVENT_SCOPE_THREAD, "data", | 345 "JitCodeRemoved", TRACE_EVENT_SCOPE_THREAD, "data", |
| 346 JitCodeEventToTraceFormat(event)); | 346 JitCodeEventToTraceFormat(event)); |
| 347 break; | 347 break; |
| 348 | 348 |
| 349 case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: | 349 case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: |
| 350 case v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING: | 350 case v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING: |
| 351 case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: | 351 case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: |
| 352 break; | 352 break; |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 // static | 356 // static |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 render_thread_sampler_->SetEventsToCollectForTest(code_added_events, | 631 render_thread_sampler_->SetEventsToCollectForTest(code_added_events, |
| 632 sample_events); | 632 sample_events); |
| 633 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); | 633 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void V8SamplingProfiler::WaitSamplingEventForTesting() { | 636 void V8SamplingProfiler::WaitSamplingEventForTesting() { |
| 637 waitable_event_for_testing_->Wait(); | 637 waitable_event_for_testing_->Wait(); |
| 638 } | 638 } |
| 639 | 639 |
| 640 } // namespace blink | 640 } // namespace blink |
| OLD | NEW |