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

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

Issue 22849002: Rewrite SamplingCircularQueue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Don't create extra copy of event Created 7 years, 4 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
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 INLINE(bool running()) { return running_; } 149 INLINE(bool running()) { return running_; }
150 void Enqueue(const CodeEventsContainer& event); 150 void Enqueue(const CodeEventsContainer& event);
151 151
152 // Puts current stack into tick sample events buffer. 152 // Puts current stack into tick sample events buffer.
153 void AddCurrentStack(Isolate* isolate); 153 void AddCurrentStack(Isolate* isolate);
154 154
155 // Tick sample events are filled directly in the buffer of the circular 155 // Tick sample events are filled directly in the buffer of the circular
156 // queue (because the structure is of fixed width, but usually not all 156 // queue (because the structure is of fixed width, but usually not all
157 // stack frame entries are filled.) This method returns a pointer to the 157 // stack frame entries are filled.) This method returns a pointer to the
158 // next record of the buffer. 158 // next record of the buffer.
159 INLINE(TickSample* TickSampleEvent()); 159 inline TickSample* StartTickSample();
160 inline void FinishTickSample();
160 161
161 private: 162 private:
162 // Called from events processing thread (Run() method.) 163 // Called from events processing thread (Run() method.)
163 bool ProcessCodeEvent(); 164 bool ProcessCodeEvent();
164 bool ProcessTicks(); 165 bool ProcessTicks();
165 166
166 ProfileGenerator* generator_; 167 ProfileGenerator* generator_;
167 bool running_; 168 bool running_;
168 UnboundQueue<CodeEventsContainer> events_buffer_; 169 UnboundQueue<CodeEventsContainer> events_buffer_;
169 SamplingCircularQueue ticks_buffer_; 170 SamplingCircularQueue ticks_buffer_;
(...skipping 28 matching lines...) Expand all
198 void StartProfiling(const char* title, bool record_samples = false); 199 void StartProfiling(const char* title, bool record_samples = false);
199 void StartProfiling(String* title, bool record_samples); 200 void StartProfiling(String* title, bool record_samples);
200 CpuProfile* StopProfiling(const char* title); 201 CpuProfile* StopProfiling(const char* title);
201 CpuProfile* StopProfiling(String* title); 202 CpuProfile* StopProfiling(String* title);
202 int GetProfilesCount(); 203 int GetProfilesCount();
203 CpuProfile* GetProfile(int index); 204 CpuProfile* GetProfile(int index);
204 void DeleteAllProfiles(); 205 void DeleteAllProfiles();
205 void DeleteProfile(CpuProfile* profile); 206 void DeleteProfile(CpuProfile* profile);
206 207
207 // Invoked from stack sampler (thread or signal handler.) 208 // Invoked from stack sampler (thread or signal handler.)
208 TickSample* TickSampleEvent(); 209 inline TickSample* StartTickSample();
210 inline void FinishTickSample();
209 211
210 // Must be called via PROFILE macro, otherwise will crash when 212 // Must be called via PROFILE macro, otherwise will crash when
211 // profiling is not enabled. 213 // profiling is not enabled.
212 virtual void CallbackEvent(Name* name, Address entry_point); 214 virtual void CallbackEvent(Name* name, Address entry_point);
213 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, 215 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
214 Code* code, const char* comment); 216 Code* code, const char* comment);
215 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, 217 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
216 Code* code, Name* name); 218 Code* code, Name* name);
217 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, 219 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
218 Code* code, 220 Code* code,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 bool need_to_stop_sampler_; 261 bool need_to_stop_sampler_;
260 bool is_profiling_; 262 bool is_profiling_;
261 263
262 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 264 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
263 }; 265 };
264 266
265 } } // namespace v8::internal 267 } } // namespace v8::internal
266 268
267 269
268 #endif // V8_CPU_PROFILER_H_ 270 #endif // V8_CPU_PROFILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698