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

Side by Side Diff: src/sampler.cc

Issue 148883002: Synchronize with r15594. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/sampler.h ('k') | src/stub-cache.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 void Sampler::TearDown() { 678 void Sampler::TearDown() {
679 SamplerThread::TearDown(); 679 SamplerThread::TearDown();
680 } 680 }
681 681
682 682
683 Sampler::Sampler(Isolate* isolate, int interval) 683 Sampler::Sampler(Isolate* isolate, int interval)
684 : isolate_(isolate), 684 : isolate_(isolate),
685 interval_(interval), 685 interval_(interval),
686 profiling_(false), 686 profiling_(false),
687 active_(false), 687 active_(false),
688 samples_taken_(0) { 688 is_counting_samples_(false),
689 js_and_external_sample_count_(0) {
689 data_ = new PlatformData; 690 data_ = new PlatformData;
690 } 691 }
691 692
692 693
693 Sampler::~Sampler() { 694 Sampler::~Sampler() {
694 ASSERT(!IsActive()); 695 ASSERT(!IsActive());
695 delete data_; 696 delete data_;
696 } 697 }
697 698
698 699
699 void Sampler::Start() { 700 void Sampler::Start() {
700 ASSERT(!IsActive()); 701 ASSERT(!IsActive());
701 SetActive(true); 702 SetActive(true);
702 SamplerThread::AddActiveSampler(this); 703 SamplerThread::AddActiveSampler(this);
703 } 704 }
704 705
705 706
706 void Sampler::Stop() { 707 void Sampler::Stop() {
707 ASSERT(IsActive()); 708 ASSERT(IsActive());
708 SamplerThread::RemoveActiveSampler(this); 709 SamplerThread::RemoveActiveSampler(this);
709 SetActive(false); 710 SetActive(false);
710 } 711 }
711 712
712 713
713 void Sampler::SampleStack(const RegisterState& state) { 714 void Sampler::SampleStack(const RegisterState& state) {
714 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent(); 715 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent();
715 TickSample sample_obj; 716 TickSample sample_obj;
716 if (sample == NULL) sample = &sample_obj; 717 if (sample == NULL) sample = &sample_obj;
717 sample->Init(isolate_, state); 718 sample->Init(isolate_, state);
718 if (++samples_taken_ < 0) samples_taken_ = 0; 719 if (is_counting_samples_) {
720 if (sample->state == JS || sample->state == EXTERNAL) {
721 ++js_and_external_sample_count_;
722 }
723 }
719 Tick(sample); 724 Tick(sample);
720 } 725 }
721 726
722 } } // namespace v8::internal 727 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/sampler.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698