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

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

Issue 151603004: A64: Synchronize with r16587. (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/contexts.cc ('k') | src/cpu-profiler.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 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_CPU_PROFILER_H_ 28 #ifndef V8_CPU_PROFILER_H_
29 #define V8_CPU_PROFILER_H_ 29 #define V8_CPU_PROFILER_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "atomicops.h" 32 #include "atomicops.h"
33 #include "circular-queue.h" 33 #include "circular-queue.h"
34 #include "platform/time.h"
34 #include "sampler.h" 35 #include "sampler.h"
35 #include "unbound-queue.h" 36 #include "unbound-queue.h"
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 // Forward declarations. 41 // Forward declarations.
41 class CodeEntry; 42 class CodeEntry;
42 class CodeMap; 43 class CodeMap;
43 class CompilationInfo; 44 class CompilationInfo;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Tick sample events are filled directly in the buffer of the circular 154 // Tick sample events are filled directly in the buffer of the circular
154 // queue (because the structure is of fixed width, but usually not all 155 // queue (because the structure is of fixed width, but usually not all
155 // stack frame entries are filled.) This method returns a pointer to the 156 // stack frame entries are filled.) This method returns a pointer to the
156 // next record of the buffer. 157 // next record of the buffer.
157 inline TickSample* StartTickSample(); 158 inline TickSample* StartTickSample();
158 inline void FinishTickSample(); 159 inline void FinishTickSample();
159 160
160 private: 161 private:
161 // Called from events processing thread (Run() method.) 162 // Called from events processing thread (Run() method.)
162 bool ProcessCodeEvent(); 163 bool ProcessCodeEvent();
163 bool ProcessTicks();
164 164
165 void ProcessEventsAndDoSample(); 165 enum SampleProcessingResult {
166 OneSampleProcessed,
167 FoundSampleForNextCodeEvent,
168 NoSamplesInQueue
169 };
170 SampleProcessingResult ProcessOneSample();
166 171
167 ProfileGenerator* generator_; 172 ProfileGenerator* generator_;
168 Sampler* sampler_; 173 Sampler* sampler_;
169 bool running_; 174 bool running_;
170 // Sampling period in microseconds. 175 // Sampling period in microseconds.
171 const TimeDelta period_; 176 const TimeDelta period_;
172 UnboundQueue<CodeEventsContainer> events_buffer_; 177 UnboundQueue<CodeEventsContainer> events_buffer_;
173 static const size_t kTickSampleBufferSize = 1 * MB; 178 static const size_t kTickSampleBufferSize = 1 * MB;
174 static const size_t kTickSampleQueueLength = 179 static const size_t kTickSampleQueueLength =
175 kTickSampleBufferSize / sizeof(TickSampleEventRecord); 180 kTickSampleBufferSize / sizeof(TickSampleEventRecord);
(...skipping 20 matching lines...) Expand all
196 public: 201 public:
197 explicit CpuProfiler(Isolate* isolate); 202 explicit CpuProfiler(Isolate* isolate);
198 203
199 CpuProfiler(Isolate* isolate, 204 CpuProfiler(Isolate* isolate,
200 CpuProfilesCollection* test_collection, 205 CpuProfilesCollection* test_collection,
201 ProfileGenerator* test_generator, 206 ProfileGenerator* test_generator,
202 ProfilerEventsProcessor* test_processor); 207 ProfilerEventsProcessor* test_processor);
203 208
204 virtual ~CpuProfiler(); 209 virtual ~CpuProfiler();
205 210
211 void set_sampling_interval(TimeDelta value);
206 void StartProfiling(const char* title, bool record_samples = false); 212 void StartProfiling(const char* title, bool record_samples = false);
207 void StartProfiling(String* title, bool record_samples); 213 void StartProfiling(String* title, bool record_samples);
208 CpuProfile* StopProfiling(const char* title); 214 CpuProfile* StopProfiling(const char* title);
209 CpuProfile* StopProfiling(String* title); 215 CpuProfile* StopProfiling(String* title);
210 int GetProfilesCount(); 216 int GetProfilesCount();
211 CpuProfile* GetProfile(int index); 217 CpuProfile* GetProfile(int index);
212 void DeleteAllProfiles(); 218 void DeleteAllProfiles();
213 void DeleteProfile(CpuProfile* profile); 219 void DeleteProfile(CpuProfile* profile);
214 220
215 // Invoked from stack sampler (thread or signal handler.) 221 // Invoked from stack sampler (thread or signal handler.)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Isolate* isolate() const { return isolate_; } 259 Isolate* isolate() const { return isolate_; }
254 260
255 private: 261 private:
256 void StartProcessorIfNotStarted(); 262 void StartProcessorIfNotStarted();
257 void StopProcessorIfLastProfile(const char* title); 263 void StopProcessorIfLastProfile(const char* title);
258 void StopProcessor(); 264 void StopProcessor();
259 void ResetProfiles(); 265 void ResetProfiles();
260 void LogBuiltins(); 266 void LogBuiltins();
261 267
262 Isolate* isolate_; 268 Isolate* isolate_;
269 TimeDelta sampling_interval_;
263 CpuProfilesCollection* profiles_; 270 CpuProfilesCollection* profiles_;
264 unsigned next_profile_uid_; 271 unsigned next_profile_uid_;
265 ProfileGenerator* generator_; 272 ProfileGenerator* generator_;
266 ProfilerEventsProcessor* processor_; 273 ProfilerEventsProcessor* processor_;
267 bool saved_is_logging_; 274 bool saved_is_logging_;
268 bool is_profiling_; 275 bool is_profiling_;
269 276
270 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 277 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
271 }; 278 };
272 279
273 } } // namespace v8::internal 280 } } // namespace v8::internal
274 281
275 282
276 #endif // V8_CPU_PROFILER_H_ 283 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698