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

Side by Side Diff: src/profile-generator.cc

Issue 117353002: Delete several deprecated methods on v8::CpuProfiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Deleted deprecated methods Created 7 years 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/profile-generator.h ('k') | test/cctest/cctest.gyp » ('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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 callback->AfterChildTraversed(parent.node, current.node); 345 callback->AfterChildTraversed(parent.node, current.node);
346 parent.next_child(); 346 parent.next_child();
347 } 347 }
348 // Remove child from the stack. 348 // Remove child from the stack.
349 stack.RemoveLast(); 349 stack.RemoveLast();
350 } 350 }
351 } 351 }
352 } 352 }
353 353
354 354
355 CpuProfile::CpuProfile(const char* title, unsigned uid, bool record_samples) 355 CpuProfile::CpuProfile(const char* title, bool record_samples)
356 : title_(title), 356 : title_(title),
357 uid_(uid),
358 record_samples_(record_samples), 357 record_samples_(record_samples),
359 start_time_(Time::NowFromSystemTime()) { 358 start_time_(Time::NowFromSystemTime()) {
360 timer_.Start(); 359 timer_.Start();
361 } 360 }
362 361
363 362
364 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) { 363 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
365 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); 364 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path);
366 if (record_samples_) samples_.Add(top_frame_node); 365 if (record_samples_) samples_.Add(top_frame_node);
367 } 366 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } 478 }
480 479
481 480
482 CpuProfilesCollection::~CpuProfilesCollection() { 481 CpuProfilesCollection::~CpuProfilesCollection() {
483 finished_profiles_.Iterate(DeleteCpuProfile); 482 finished_profiles_.Iterate(DeleteCpuProfile);
484 current_profiles_.Iterate(DeleteCpuProfile); 483 current_profiles_.Iterate(DeleteCpuProfile);
485 code_entries_.Iterate(DeleteCodeEntry); 484 code_entries_.Iterate(DeleteCodeEntry);
486 } 485 }
487 486
488 487
489 bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid, 488 bool CpuProfilesCollection::StartProfiling(const char* title,
490 bool record_samples) { 489 bool record_samples) {
491 ASSERT(uid > 0); 490 ASSERT(uid > 0);
492 current_profiles_semaphore_.Wait(); 491 current_profiles_semaphore_.Wait();
493 if (current_profiles_.length() >= kMaxSimultaneousProfiles) { 492 if (current_profiles_.length() >= kMaxSimultaneousProfiles) {
494 current_profiles_semaphore_.Signal(); 493 current_profiles_semaphore_.Signal();
495 return false; 494 return false;
496 } 495 }
497 for (int i = 0; i < current_profiles_.length(); ++i) { 496 for (int i = 0; i < current_profiles_.length(); ++i) {
498 if (strcmp(current_profiles_[i]->title(), title) == 0) { 497 if (strcmp(current_profiles_[i]->title(), title) == 0) {
499 // Ignore attempts to start profile with the same title. 498 // Ignore attempts to start profile with the same title.
500 current_profiles_semaphore_.Signal(); 499 current_profiles_semaphore_.Signal();
501 return false; 500 return false;
502 } 501 }
503 } 502 }
504 current_profiles_.Add(new CpuProfile(title, uid, record_samples)); 503 current_profiles_.Add(new CpuProfile(title, record_samples));
505 current_profiles_semaphore_.Signal(); 504 current_profiles_semaphore_.Signal();
506 return true; 505 return true;
507 } 506 }
508 507
509 508
510 CpuProfile* CpuProfilesCollection::StopProfiling(const char* title) { 509 CpuProfile* CpuProfilesCollection::StopProfiling(const char* title) {
511 const int title_len = StrLength(title); 510 const int title_len = StrLength(title);
512 CpuProfile* profile = NULL; 511 CpuProfile* profile = NULL;
513 current_profiles_semaphore_.Wait(); 512 current_profiles_semaphore_.Wait();
514 for (int i = current_profiles_.length() - 1; i >= 0; --i) { 513 for (int i = current_profiles_.length() - 1; i >= 0; --i) {
(...skipping 15 matching lines...) Expand all
530 // Called from VM thread, and only it can mutate the list, 529 // Called from VM thread, and only it can mutate the list,
531 // so no locking is needed here. 530 // so no locking is needed here.
532 if (current_profiles_.length() != 1) return false; 531 if (current_profiles_.length() != 1) return false;
533 return StrLength(title) == 0 532 return StrLength(title) == 0
534 || strcmp(current_profiles_[0]->title(), title) == 0; 533 || strcmp(current_profiles_[0]->title(), title) == 0;
535 } 534 }
536 535
537 536
538 void CpuProfilesCollection::RemoveProfile(CpuProfile* profile) { 537 void CpuProfilesCollection::RemoveProfile(CpuProfile* profile) {
539 // Called from VM thread for a completed profile. 538 // Called from VM thread for a completed profile.
540 unsigned uid = profile->uid();
541 for (int i = 0; i < finished_profiles_.length(); i++) { 539 for (int i = 0; i < finished_profiles_.length(); i++) {
542 if (uid == finished_profiles_[i]->uid()) { 540 if (profile == finished_profiles_[i]) {
543 finished_profiles_.Remove(i); 541 finished_profiles_.Remove(i);
544 return; 542 return;
545 } 543 }
546 } 544 }
547 UNREACHABLE(); 545 UNREACHABLE();
548 } 546 }
549 547
550 548
551 void CpuProfilesCollection::AddPathToCurrentProfiles( 549 void CpuProfilesCollection::AddPathToCurrentProfiles(
552 const Vector<CodeEntry*>& path) { 550 const Vector<CodeEntry*>& path) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 case OTHER: 692 case OTHER:
695 case EXTERNAL: 693 case EXTERNAL:
696 return program_entry_; 694 return program_entry_;
697 case IDLE: 695 case IDLE:
698 return idle_entry_; 696 return idle_entry_;
699 default: return NULL; 697 default: return NULL;
700 } 698 }
701 } 699 }
702 700
703 } } // namespace v8::internal 701 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698