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 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // static | 325 // static |
326 void Sampler::HandleJitCodeEvent(const v8::JitCodeEvent* event) { | 326 void Sampler::HandleJitCodeEvent(const v8::JitCodeEvent* event) { |
327 // Called on the sampled V8 thread. | 327 // Called on the sampled V8 thread. |
328 Sampler* sampler = GetInstance(); | 328 Sampler* sampler = GetInstance(); |
329 // The sampler may have already been destroyed. | 329 // The sampler may have already been destroyed. |
330 // That's fine, we're not interested in these events anymore. | 330 // That's fine, we're not interested in these events anymore. |
331 if (!sampler) | 331 if (!sampler) |
332 return; | 332 return; |
333 switch (event->type) { | 333 switch (event->type) { |
334 case v8::JitCodeEvent::CODE_ADDED: | 334 case v8::JitCodeEvent::CODE_ADDED: |
335 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 335 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
336 "JitCodeAdded", TRACE_EVENT_SCOPE_THREAD, "data", | 336 "JitCodeAdded", "data", |
337 JitCodeEventToTraceFormat(event)); | 337 JitCodeEventToTraceFormat(event)); |
338 base::subtle::NoBarrier_AtomicIncrement( | 338 base::subtle::NoBarrier_AtomicIncrement( |
339 &sampler->code_added_events_count_, 1); | 339 &sampler->code_added_events_count_, 1); |
340 break; | 340 break; |
341 | 341 |
342 case v8::JitCodeEvent::CODE_MOVED: | 342 case v8::JitCodeEvent::CODE_MOVED: |
343 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 343 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
344 "JitCodeMoved", TRACE_EVENT_SCOPE_THREAD, "data", | 344 "JitCodeMoved", "data", |
345 JitCodeEventToTraceFormat(event)); | 345 JitCodeEventToTraceFormat(event)); |
346 break; | 346 break; |
347 | 347 |
348 case v8::JitCodeEvent::CODE_REMOVED: | 348 case v8::JitCodeEvent::CODE_REMOVED: |
349 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), | 349 TRACE_EVENT_METADATA1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), |
350 "JitCodeRemoved", TRACE_EVENT_SCOPE_THREAD, "data", | 350 "JitCodeRemoved", "data", |
351 JitCodeEventToTraceFormat(event)); | 351 JitCodeEventToTraceFormat(event)); |
352 break; | 352 break; |
353 | 353 |
354 case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: | 354 case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: |
355 case v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING: | 355 case v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING: |
356 case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: | 356 case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: |
357 break; | 357 break; |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 // static | 361 // static |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 render_thread_sampler_->SetEventsToCollectForTest(code_added_events, | 636 render_thread_sampler_->SetEventsToCollectForTest(code_added_events, |
637 sample_events); | 637 sample_events); |
638 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); | 638 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); |
639 } | 639 } |
640 | 640 |
641 void V8SamplingProfiler::WaitSamplingEventForTesting() { | 641 void V8SamplingProfiler::WaitSamplingEventForTesting() { |
642 waitable_event_for_testing_->Wait(); | 642 waitable_event_for_testing_->Wait(); |
643 } | 643 } |
644 | 644 |
645 } // namespace content | 645 } // namespace content |
OLD | NEW |