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

Side by Side Diff: src/sampler.h

Issue 23011029: Do not start sampler thread when CpuProfiler is active (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 3 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/log.cc ('k') | src/sampler.cc » ('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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // Start and stop sampler. 93 // Start and stop sampler.
94 void Start(); 94 void Start();
95 void Stop(); 95 void Stop();
96 96
97 // Whether the sampling thread should use this Sampler for CPU profiling? 97 // Whether the sampling thread should use this Sampler for CPU profiling?
98 bool IsProfiling() const { 98 bool IsProfiling() const {
99 return NoBarrier_Load(&profiling_) > 0 && 99 return NoBarrier_Load(&profiling_) > 0 &&
100 !NoBarrier_Load(&has_processing_thread_); 100 !NoBarrier_Load(&has_processing_thread_);
101 } 101 }
102 void IncreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, 1); } 102 void IncreaseProfilingDepth();
103 void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } 103 void DecreaseProfilingDepth();
104 104
105 // Whether the sampler is running (that is, consumes resources). 105 // Whether the sampler is running (that is, consumes resources).
106 bool IsActive() const { return NoBarrier_Load(&active_); } 106 bool IsActive() const { return NoBarrier_Load(&active_); }
107 107
108 void DoSample();
108 // If true next sample must be initiated on the profiler event processor 109 // If true next sample must be initiated on the profiler event processor
109 // thread right after latest sample is processed. 110 // thread right after latest sample is processed.
110 static bool CanSampleOnProfilerEventsProcessorThread();
111 void DoSample();
112 void SetHasProcessingThread(bool value) { 111 void SetHasProcessingThread(bool value) {
113 NoBarrier_Store(&has_processing_thread_, value); 112 NoBarrier_Store(&has_processing_thread_, value);
114 } 113 }
115 114
116 // Used in tests to make sure that stack sampling is performed. 115 // Used in tests to make sure that stack sampling is performed.
117 unsigned js_and_external_sample_count() const { 116 unsigned js_and_external_sample_count() const {
118 return js_and_external_sample_count_; 117 return js_and_external_sample_count_;
119 } 118 }
120 void StartCountingSamples() { 119 void StartCountingSamples() {
121 is_counting_samples_ = true; 120 is_counting_samples_ = true;
(...skipping 20 matching lines...) Expand all
142 bool is_counting_samples_; 141 bool is_counting_samples_;
143 // Counts stack samples taken in JS VM state. 142 // Counts stack samples taken in JS VM state.
144 unsigned js_and_external_sample_count_; 143 unsigned js_and_external_sample_count_;
145 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 144 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
146 }; 145 };
147 146
148 147
149 } } // namespace v8::internal 148 } } // namespace v8::internal
150 149
151 #endif // V8_SAMPLER_H_ 150 #endif // V8_SAMPLER_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/sampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698