OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 "src/profiler/cpu-profiler.h" | 5 #include "src/profiler/cpu-profiler.h" |
6 | 6 |
7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/locked-queue-inl.h" | 10 #include "src/locked-queue-inl.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 293 } |
294 | 294 |
295 void CpuProfiler::CollectSample() { | 295 void CpuProfiler::CollectSample() { |
296 if (processor_) { | 296 if (processor_) { |
297 processor_->AddCurrentStack(isolate_); | 297 processor_->AddCurrentStack(isolate_); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { | 301 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { |
302 if (profiles_->StartProfiling(title, record_samples)) { | 302 if (profiles_->StartProfiling(title, record_samples)) { |
303 TRACE_EVENT0("v8", "CpuProfiler::StartProfiling"); | |
303 StartProcessorIfNotStarted(); | 304 StartProcessorIfNotStarted(); |
304 } | 305 } |
305 } | 306 } |
306 | 307 |
307 | 308 |
308 void CpuProfiler::StartProfiling(String* title, bool record_samples) { | 309 void CpuProfiler::StartProfiling(String* title, bool record_samples) { |
309 StartProfiling(profiles_->GetName(title), record_samples); | 310 StartProfiling(profiles_->GetName(title), record_samples); |
310 isolate_->debug()->feature_tracker()->Track(DebugFeatureTracker::kProfiler); | 311 isolate_->debug()->feature_tracker()->Track(DebugFeatureTracker::kProfiler); |
311 } | 312 } |
312 | 313 |
(...skipping 17 matching lines...) Expand all Loading... | |
330 is_profiling_ = true; | 331 is_profiling_ = true; |
331 isolate_->set_is_profiling(true); | 332 isolate_->set_is_profiling(true); |
332 // Enumerate stuff we already have in the heap. | 333 // Enumerate stuff we already have in the heap. |
333 DCHECK(isolate_->heap()->HasBeenSetUp()); | 334 DCHECK(isolate_->heap()->HasBeenSetUp()); |
334 if (!FLAG_prof_browser_mode) { | 335 if (!FLAG_prof_browser_mode) { |
335 logger->LogCodeObjects(); | 336 logger->LogCodeObjects(); |
336 } | 337 } |
337 logger->LogCompiledFunctions(); | 338 logger->LogCompiledFunctions(); |
338 logger->LogAccessorCallbacks(); | 339 logger->LogAccessorCallbacks(); |
339 LogBuiltins(); | 340 LogBuiltins(); |
340 // Enable stack sampling. | 341 // Enable stack sampling. |
alph
2017/06/19 18:39:47
I suggest to move the event injection point to her
bgirard
2017/06/19 19:04:32
TRACE_EVENT0 will time all the work happening whil
alph
2017/06/19 20:10:03
That makes sense. I thought you wanted to mark a m
| |
341 processor_->AddCurrentStack(isolate_); | 342 processor_->AddCurrentStack(isolate_); |
342 processor_->StartSynchronously(); | 343 processor_->StartSynchronously(); |
343 } | 344 } |
344 | 345 |
345 CpuProfile* CpuProfiler::StopProfiling(const char* title) { | 346 CpuProfile* CpuProfiler::StopProfiling(const char* title) { |
346 if (!is_profiling_) return nullptr; | 347 if (!is_profiling_) return nullptr; |
347 StopProcessorIfLastProfile(title); | 348 StopProcessorIfLastProfile(title); |
348 return profiles_->StopProfiling(title); | 349 return profiles_->StopProfiling(title); |
349 } | 350 } |
350 | 351 |
(...skipping 28 matching lines...) Expand all Loading... | |
379 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 380 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
380 Builtins::Name id = static_cast<Builtins::Name>(i); | 381 Builtins::Name id = static_cast<Builtins::Name>(i); |
381 rec->start = builtins->builtin(id)->address(); | 382 rec->start = builtins->builtin(id)->address(); |
382 rec->builtin_id = id; | 383 rec->builtin_id = id; |
383 processor_->Enqueue(evt_rec); | 384 processor_->Enqueue(evt_rec); |
384 } | 385 } |
385 } | 386 } |
386 | 387 |
387 } // namespace internal | 388 } // namespace internal |
388 } // namespace v8 | 389 } // namespace v8 |
OLD | NEW |