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

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

Issue 18058008: CPUProfiler: Improve line numbers support in profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }; 147 };
148 148
149 149
150 // This class implements both the profile events processor thread and 150 // This class implements both the profile events processor thread and
151 // methods called by event producers: VM and stack sampler threads. 151 // methods called by event producers: VM and stack sampler threads.
152 class ProfilerEventsProcessor : public Thread { 152 class ProfilerEventsProcessor : public Thread {
153 public: 153 public:
154 explicit ProfilerEventsProcessor(ProfileGenerator* generator); 154 explicit ProfilerEventsProcessor(ProfileGenerator* generator);
155 virtual ~ProfilerEventsProcessor() {} 155 virtual ~ProfilerEventsProcessor() {}
156 156
157 // Processes all code events and starts the thread.
158 void Start();
yurys 2013/07/05 13:10:00 There is already non-virtual method Start in Threa
loislo 2013/07/05 13:15:37 reverted
159
157 // Thread control. 160 // Thread control.
158 virtual void Run(); 161 virtual void Run();
159 inline void Stop() { running_ = false; } 162 void Stop();
160 INLINE(bool running()) { return running_; } 163 INLINE(bool running()) { return running_; }
161 void Enqueue(const CodeEventsContainer& event); 164 void Enqueue(const CodeEventsContainer& event);
162 165
163 // Puts current stack into tick sample events buffer. 166 // Puts current stack into tick sample events buffer.
164 void AddCurrentStack(Isolate* isolate); 167 void AddCurrentStack(Isolate* isolate);
165 168
166 // Tick sample events are filled directly in the buffer of the circular 169 // Tick sample events are filled directly in the buffer of the circular
167 // queue (because the structure is of fixed width, but usually not all 170 // queue (because the structure is of fixed width, but usually not all
168 // stack frame entries are filled.) This method returns a pointer to the 171 // stack frame entries are filled.) This method returns a pointer to the
169 // next record of the buffer. 172 // next record of the buffer.
170 INLINE(TickSample* TickSampleEvent()); 173 INLINE(TickSample* TickSampleEvent());
171 174
172 private: 175 private:
173 // Called from events processing thread (Run() method.) 176 // Called from events processing thread (Run() method.)
174 bool ProcessCodeEvent(unsigned* dequeue_order); 177 bool ProcessCodeEvent();
175 bool ProcessTicks(unsigned dequeue_order); 178 bool ProcessTicks();
176 179
177 ProfileGenerator* generator_; 180 ProfileGenerator* generator_;
178 bool running_; 181 bool running_;
179 UnboundQueue<CodeEventsContainer> events_buffer_; 182 UnboundQueue<CodeEventsContainer> events_buffer_;
180 SamplingCircularQueue ticks_buffer_; 183 SamplingCircularQueue ticks_buffer_;
181 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; 184 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_;
182 unsigned enqueue_order_; 185 unsigned last_recorded_code_event_id_;
yurys 2013/07/05 13:10:00 last_code_event_id_
loislo 2013/07/05 13:15:37 Done.
186 unsigned last_processed_code_event_id_;
183 }; 187 };
184 188
185 189
186 #define PROFILE(IsolateGetter, Call) \ 190 #define PROFILE(IsolateGetter, Call) \
187 do { \ 191 do { \
188 Isolate* cpu_profiler_isolate = (IsolateGetter); \ 192 Isolate* cpu_profiler_isolate = (IsolateGetter); \
189 LOG_CODE_EVENT(cpu_profiler_isolate, Call); \ 193 LOG_CODE_EVENT(cpu_profiler_isolate, Call); \
190 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ 194 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \
191 if (cpu_profiler->is_profiling()) { \ 195 if (cpu_profiler->is_profiling()) { \
192 cpu_profiler->Call; \ 196 cpu_profiler->Call; \
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void GetterCallbackEvent(Name* name, Address entry_point); 248 void GetterCallbackEvent(Name* name, Address entry_point);
245 void RegExpCodeCreateEvent(Code* code, String* source); 249 void RegExpCodeCreateEvent(Code* code, String* source);
246 void SetterCallbackEvent(Name* name, Address entry_point); 250 void SetterCallbackEvent(Name* name, Address entry_point);
247 void SharedFunctionInfoMoveEvent(Address from, Address to); 251 void SharedFunctionInfoMoveEvent(Address from, Address to);
248 252
249 INLINE(bool is_profiling() const) { return is_profiling_; } 253 INLINE(bool is_profiling() const) { return is_profiling_; }
250 bool* is_profiling_address() { 254 bool* is_profiling_address() {
251 return &is_profiling_; 255 return &is_profiling_;
252 } 256 }
253 257
258 ProfileGenerator* generator() const { return generator_; }
259 ProfilerEventsProcessor* processor() const { return processor_; }
260
254 private: 261 private:
255 void StartProcessorIfNotStarted(); 262 void StartProcessorIfNotStarted();
256 void StopProcessorIfLastProfile(const char* title); 263 void StopProcessorIfLastProfile(const char* title);
257 void StopProcessor(); 264 void StopProcessor();
258 void ResetProfiles(); 265 void ResetProfiles();
259 void LogBuiltins(); 266 void LogBuiltins();
260 267
261 Isolate* isolate_; 268 Isolate* isolate_;
262 CpuProfilesCollection* profiles_; 269 CpuProfilesCollection* profiles_;
263 unsigned next_profile_uid_; 270 unsigned next_profile_uid_;
264 TokenEnumerator* token_enumerator_; 271 TokenEnumerator* token_enumerator_;
265 ProfileGenerator* generator_; 272 ProfileGenerator* generator_;
266 ProfilerEventsProcessor* processor_; 273 ProfilerEventsProcessor* processor_;
267 int saved_logging_nesting_; 274 int saved_logging_nesting_;
268 bool need_to_stop_sampler_; 275 bool need_to_stop_sampler_;
269 bool is_profiling_; 276 bool is_profiling_;
270 277
271 private: 278 private:
272 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 279 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
273 }; 280 };
274 281
275 } } // namespace v8::internal 282 } } // namespace v8::internal
276 283
277 284
278 #endif // V8_CPU_PROFILER_H_ 285 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/cpu-profiler.cc » ('j') | src/cpu-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698