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

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

Issue 19724007: Logger: introduce abstract interface for CodeEvent listeners. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed. rebaselined. 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
« no previous file with comments | « no previous file | src/log.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 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 do { \ 177 do { \
178 Isolate* cpu_profiler_isolate = (IsolateGetter); \ 178 Isolate* cpu_profiler_isolate = (IsolateGetter); \
179 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \ 179 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \
180 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ 180 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \
181 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \ 181 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \
182 logger->Call; \ 182 logger->Call; \
183 } \ 183 } \
184 } while (false) 184 } while (false)
185 185
186 186
187 class CpuProfiler { 187 class CpuProfiler : public CodeEventListener {
188 public: 188 public:
189 explicit CpuProfiler(Isolate* isolate); 189 explicit CpuProfiler(Isolate* isolate);
190 190
191 CpuProfiler(Isolate* isolate, 191 CpuProfiler(Isolate* isolate,
192 CpuProfilesCollection* test_collection, 192 CpuProfilesCollection* test_collection,
193 ProfileGenerator* test_generator, 193 ProfileGenerator* test_generator,
194 ProfilerEventsProcessor* test_processor); 194 ProfilerEventsProcessor* test_processor);
195 195
196 ~CpuProfiler(); 196 virtual ~CpuProfiler();
197 197
198 void StartProfiling(const char* title, bool record_samples = false); 198 void StartProfiling(const char* title, bool record_samples = false);
199 void StartProfiling(String* title, bool record_samples); 199 void StartProfiling(String* title, bool record_samples);
200 CpuProfile* StopProfiling(const char* title); 200 CpuProfile* StopProfiling(const char* title);
201 CpuProfile* StopProfiling(String* title); 201 CpuProfile* StopProfiling(String* title);
202 int GetProfilesCount(); 202 int GetProfilesCount();
203 CpuProfile* GetProfile(int index); 203 CpuProfile* GetProfile(int index);
204 void DeleteAllProfiles(); 204 void DeleteAllProfiles();
205 void DeleteProfile(CpuProfile* profile); 205 void DeleteProfile(CpuProfile* profile);
206 206
207 // Invoked from stack sampler (thread or signal handler.) 207 // Invoked from stack sampler (thread or signal handler.)
208 TickSample* TickSampleEvent(); 208 TickSample* TickSampleEvent();
209 209
210 // Must be called via PROFILE macro, otherwise will crash when 210 // Must be called via PROFILE macro, otherwise will crash when
211 // profiling is not enabled. 211 // profiling is not enabled.
212 void CallbackEvent(Name* name, Address entry_point); 212 virtual void CallbackEvent(Name* name, Address entry_point);
213 void CodeCreateEvent(Logger::LogEventsAndTags tag, 213 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
214 Code* code, const char* comment); 214 Code* code, const char* comment);
215 void CodeCreateEvent(Logger::LogEventsAndTags tag, 215 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
216 Code* code, Name* name); 216 Code* code, Name* name);
217 void CodeCreateEvent(Logger::LogEventsAndTags tag, 217 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
218 Code* code, 218 Code* code,
219 SharedFunctionInfo* shared, 219 SharedFunctionInfo* shared,
220 CompilationInfo* info, 220 CompilationInfo* info,
221 Name* name); 221 Name* name);
222 void CodeCreateEvent(Logger::LogEventsAndTags tag, 222 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
223 Code* code, 223 Code* code,
224 SharedFunctionInfo* shared, 224 SharedFunctionInfo* shared,
225 CompilationInfo* info, 225 CompilationInfo* info,
226 Name* source, int line); 226 Name* source, int line);
227 void CodeCreateEvent(Logger::LogEventsAndTags tag, 227 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag,
228 Code* code, int args_count); 228 Code* code, int args_count);
229 void CodeMovingGCEvent() {} 229 virtual void CodeMovingGCEvent() {}
230 void CodeMoveEvent(Address from, Address to); 230 virtual void CodeMoveEvent(Address from, Address to);
231 void CodeDeleteEvent(Address from); 231 virtual void CodeDeleteEvent(Address from);
232 void GetterCallbackEvent(Name* name, Address entry_point); 232 virtual void GetterCallbackEvent(Name* name, Address entry_point);
233 void RegExpCodeCreateEvent(Code* code, String* source); 233 virtual void RegExpCodeCreateEvent(Code* code, String* source);
234 void SetterCallbackEvent(Name* name, Address entry_point); 234 virtual void SetterCallbackEvent(Name* name, Address entry_point);
235 void SharedFunctionInfoMoveEvent(Address from, Address to); 235 virtual void SharedFunctionInfoMoveEvent(Address from, Address to);
236 236
237 INLINE(bool is_profiling() const) { return is_profiling_; } 237 INLINE(bool is_profiling() const) { return is_profiling_; }
238 bool* is_profiling_address() { 238 bool* is_profiling_address() {
239 return &is_profiling_; 239 return &is_profiling_;
240 } 240 }
241 241
242 ProfileGenerator* generator() const { return generator_; } 242 ProfileGenerator* generator() const { return generator_; }
243 ProfilerEventsProcessor* processor() const { return processor_; } 243 ProfilerEventsProcessor* processor() const { return processor_; }
244 244
245 private: 245 private:
(...skipping 13 matching lines...) Expand all
259 bool is_profiling_; 259 bool is_profiling_;
260 260
261 private: 261 private:
262 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 262 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
263 }; 263 };
264 264
265 } } // namespace v8::internal 265 } } // namespace v8::internal
266 266
267 267
268 #endif // V8_CPU_PROFILER_H_ 268 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698