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

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

Issue 13454002: Allow recording individual samples in addition to the aggregated CPU profiles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 8 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 | « src/cpu-profiler.h ('k') | src/profile-generator.h » ('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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 // Process remaining tick events. 254 // Process remaining tick events.
255 ticks_buffer_.FlushResidualRecords(); 255 ticks_buffer_.FlushResidualRecords();
256 // Perform processing until we have tick events, skip remaining code events. 256 // Perform processing until we have tick events, skip remaining code events.
257 while (ProcessTicks(dequeue_order) && ProcessCodeEvent(&dequeue_order)) { } 257 while (ProcessTicks(dequeue_order) && ProcessCodeEvent(&dequeue_order)) { }
258 } 258 }
259 259
260 260
261 void CpuProfiler::StartProfiling(const char* title) { 261 void CpuProfiler::StartProfiling(const char* title) {
262 ASSERT(Isolate::Current()->cpu_profiler() != NULL); 262 ASSERT(Isolate::Current()->cpu_profiler() != NULL);
263 Isolate::Current()->cpu_profiler()->StartCollectingProfile(title); 263 Isolate::Current()->cpu_profiler()->StartCollectingProfile(title, false);
264 } 264 }
265 265
266 266
267 void CpuProfiler::StartProfiling(String* title) { 267 void CpuProfiler::StartProfiling(String* title, bool record_samples) {
268 ASSERT(Isolate::Current()->cpu_profiler() != NULL); 268 ASSERT(Isolate::Current()->cpu_profiler() != NULL);
269 Isolate::Current()->cpu_profiler()->StartCollectingProfile(title); 269 Isolate::Current()->cpu_profiler()->StartCollectingProfile(
270 title, record_samples);
270 } 271 }
271 272
272 273
273 CpuProfile* CpuProfiler::StopProfiling(const char* title) { 274 CpuProfile* CpuProfiler::StopProfiling(const char* title) {
274 Isolate* isolate = Isolate::Current(); 275 Isolate* isolate = Isolate::Current();
275 return is_profiling(isolate) ? 276 return is_profiling(isolate) ?
276 isolate->cpu_profiler()->StopCollectingProfile(title) : NULL; 277 isolate->cpu_profiler()->StopCollectingProfile(title) : NULL;
277 } 278 }
278 279
279 280
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 delete token_enumerator_; 462 delete token_enumerator_;
462 delete profiles_; 463 delete profiles_;
463 } 464 }
464 465
465 466
466 void CpuProfiler::ResetProfiles() { 467 void CpuProfiler::ResetProfiles() {
467 delete profiles_; 468 delete profiles_;
468 profiles_ = new CpuProfilesCollection(); 469 profiles_ = new CpuProfilesCollection();
469 } 470 }
470 471
471 void CpuProfiler::StartCollectingProfile(const char* title) { 472 void CpuProfiler::StartCollectingProfile(const char* title,
472 if (profiles_->StartProfiling(title, next_profile_uid_++)) { 473 bool record_samples) {
474 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) {
473 StartProcessorIfNotStarted(); 475 StartProcessorIfNotStarted();
474 } 476 }
475 processor_->AddCurrentStack(); 477 processor_->AddCurrentStack();
476 } 478 }
477 479
478 480
479 void CpuProfiler::StartCollectingProfile(String* title) { 481 void CpuProfiler::StartCollectingProfile(String* title, bool record_samples) {
480 StartCollectingProfile(profiles_->GetName(title)); 482 StartCollectingProfile(profiles_->GetName(title), record_samples);
481 } 483 }
482 484
483 485
484 void CpuProfiler::StartProcessorIfNotStarted() { 486 void CpuProfiler::StartProcessorIfNotStarted() {
485 if (processor_ == NULL) { 487 if (processor_ == NULL) {
486 Isolate* isolate = Isolate::Current(); 488 Isolate* isolate = Isolate::Current();
487 489
488 // Disable logging when using the new implementation. 490 // Disable logging when using the new implementation.
489 saved_logging_nesting_ = isolate->logger()->logging_nesting_; 491 saved_logging_nesting_ = isolate->logger()->logging_nesting_;
490 isolate->logger()->logging_nesting_ = 0; 492 isolate->logger()->logging_nesting_ = 0;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 574
573 void CpuProfiler::TearDown() { 575 void CpuProfiler::TearDown() {
574 Isolate* isolate = Isolate::Current(); 576 Isolate* isolate = Isolate::Current();
575 if (isolate->cpu_profiler() != NULL) { 577 if (isolate->cpu_profiler() != NULL) {
576 delete isolate->cpu_profiler(); 578 delete isolate->cpu_profiler();
577 } 579 }
578 isolate->set_cpu_profiler(NULL); 580 isolate->set_cpu_profiler(NULL);
579 } 581 }
580 582
581 } } // namespace v8::internal 583 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698