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

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

Issue 2084017: Version 2.2.11... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 7 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/compiler.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 23 matching lines...) Expand all
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 // Forward declarations. 38 // Forward declarations.
39 class CodeEntry; 39 class CodeEntry;
40 class CodeMap; 40 class CodeMap;
41 class CpuProfile; 41 class CpuProfile;
42 class CpuProfilesCollection; 42 class CpuProfilesCollection;
43 class ProfileGenerator; 43 class ProfileGenerator;
44 44 class TokenEnumerator;
45 45
46 #define CODE_EVENTS_TYPE_LIST(V) \ 46 #define CODE_EVENTS_TYPE_LIST(V) \
47 V(CODE_CREATION, CodeCreateEventRecord) \ 47 V(CODE_CREATION, CodeCreateEventRecord) \
48 V(CODE_MOVE, CodeMoveEventRecord) \ 48 V(CODE_MOVE, CodeMoveEventRecord) \
49 V(CODE_DELETE, CodeDeleteEventRecord) \ 49 V(CODE_DELETE, CodeDeleteEventRecord) \
50 V(CODE_ALIAS, CodeAliasEventRecord) 50 V(CODE_ALIAS, CodeAliasEventRecord)
51 51
52 52
53 class CodeEventRecord { 53 class CodeEventRecord {
54 public: 54 public:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 class CodeDeleteEventRecord : public CodeEventRecord { 87 class CodeDeleteEventRecord : public CodeEventRecord {
88 public: 88 public:
89 Address start; 89 Address start;
90 90
91 INLINE(void UpdateCodeMap(CodeMap* code_map)); 91 INLINE(void UpdateCodeMap(CodeMap* code_map));
92 }; 92 };
93 93
94 94
95 class CodeAliasEventRecord : public CodeEventRecord { 95 class CodeAliasEventRecord : public CodeEventRecord {
96 public: 96 public:
97 Address alias;
98 Address start; 97 Address start;
98 CodeEntry* entry;
99 Address code_start;
99 100
100 INLINE(void UpdateCodeMap(CodeMap* code_map)); 101 INLINE(void UpdateCodeMap(CodeMap* code_map));
101 }; 102 };
102 103
103 104
104 class TickSampleEventRecord BASE_EMBEDDED { 105 class TickSampleEventRecord BASE_EMBEDDED {
105 public: 106 public:
106 // The first machine word of a TickSampleEventRecord must not ever 107 // The first machine word of a TickSampleEventRecord must not ever
107 // become equal to SamplingCircularQueue::kClear. As both order and 108 // become equal to SamplingCircularQueue::kClear. As both order and
108 // TickSample's first field are not reliable in this sense (order 109 // TickSample's first field are not reliable in this sense (order
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 String* resource_name, int line_number, 145 String* resource_name, int line_number,
145 Address start, unsigned size); 146 Address start, unsigned size);
146 void CodeCreateEvent(Logger::LogEventsAndTags tag, 147 void CodeCreateEvent(Logger::LogEventsAndTags tag,
147 const char* name, 148 const char* name,
148 Address start, unsigned size); 149 Address start, unsigned size);
149 void CodeCreateEvent(Logger::LogEventsAndTags tag, 150 void CodeCreateEvent(Logger::LogEventsAndTags tag,
150 int args_count, 151 int args_count,
151 Address start, unsigned size); 152 Address start, unsigned size);
152 void CodeMoveEvent(Address from, Address to); 153 void CodeMoveEvent(Address from, Address to);
153 void CodeDeleteEvent(Address from); 154 void CodeDeleteEvent(Address from);
154 void FunctionCreateEvent(Address alias, Address start); 155 void FunctionCreateEvent(Address alias, Address start, int security_token_id);
155 void FunctionMoveEvent(Address from, Address to); 156 void FunctionMoveEvent(Address from, Address to);
156 void FunctionDeleteEvent(Address from); 157 void FunctionDeleteEvent(Address from);
157 void RegExpCodeCreateEvent(Logger::LogEventsAndTags tag, 158 void RegExpCodeCreateEvent(Logger::LogEventsAndTags tag,
158 const char* prefix, String* name, 159 const char* prefix, String* name,
159 Address start, unsigned size); 160 Address start, unsigned size);
160 161
161 // Tick sample events are filled directly in the buffer of the circular 162 // Tick sample events are filled directly in the buffer of the circular
162 // queue (because the structure is of fixed width, but usually not all 163 // queue (because the structure is of fixed width, but usually not all
163 // stack frame entries are filled.) This method returns a pointer to the 164 // stack frame entries are filled.) This method returns a pointer to the
164 // next record of the buffer. 165 // next record of the buffer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 206
206 class CpuProfiler { 207 class CpuProfiler {
207 public: 208 public:
208 static void Setup(); 209 static void Setup();
209 static void TearDown(); 210 static void TearDown();
210 211
211 #ifdef ENABLE_LOGGING_AND_PROFILING 212 #ifdef ENABLE_LOGGING_AND_PROFILING
212 static void StartProfiling(const char* title); 213 static void StartProfiling(const char* title);
213 static void StartProfiling(String* title); 214 static void StartProfiling(String* title);
214 static CpuProfile* StopProfiling(const char* title); 215 static CpuProfile* StopProfiling(const char* title);
215 static CpuProfile* StopProfiling(String* title); 216 static CpuProfile* StopProfiling(Object* security_token, String* title);
216 static int GetProfilesCount(); 217 static int GetProfilesCount();
217 static CpuProfile* GetProfile(int index); 218 static CpuProfile* GetProfile(Object* security_token, int index);
218 static CpuProfile* FindProfile(unsigned uid); 219 static CpuProfile* FindProfile(Object* security_token, unsigned uid);
219 220
220 // Invoked from stack sampler (thread or signal handler.) 221 // Invoked from stack sampler (thread or signal handler.)
221 static TickSample* TickSampleEvent(); 222 static TickSample* TickSampleEvent();
222 223
223 // Must be called via PROFILE macro, otherwise will crash when 224 // Must be called via PROFILE macro, otherwise will crash when
224 // profiling is not enabled. 225 // profiling is not enabled.
225 static void CallbackEvent(String* name, Address entry_point); 226 static void CallbackEvent(String* name, Address entry_point);
226 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 227 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
227 Code* code, const char* comment); 228 Code* code, const char* comment);
228 static void CodeCreateEvent(Logger::LogEventsAndTags tag, 229 static void CodeCreateEvent(Logger::LogEventsAndTags tag,
(...skipping 16 matching lines...) Expand all
245 return singleton_ != NULL && singleton_->processor_ != NULL; 246 return singleton_ != NULL && singleton_->processor_ != NULL;
246 } 247 }
247 248
248 private: 249 private:
249 CpuProfiler(); 250 CpuProfiler();
250 ~CpuProfiler(); 251 ~CpuProfiler();
251 void StartCollectingProfile(const char* title); 252 void StartCollectingProfile(const char* title);
252 void StartCollectingProfile(String* title); 253 void StartCollectingProfile(String* title);
253 void StartProcessorIfNotStarted(); 254 void StartProcessorIfNotStarted();
254 CpuProfile* StopCollectingProfile(const char* title); 255 CpuProfile* StopCollectingProfile(const char* title);
255 CpuProfile* StopCollectingProfile(String* title); 256 CpuProfile* StopCollectingProfile(Object* security_token, String* title);
256 void StopProcessorIfLastProfile(); 257 void StopProcessorIfLastProfile();
257 258
258 CpuProfilesCollection* profiles_; 259 CpuProfilesCollection* profiles_;
259 unsigned next_profile_uid_; 260 unsigned next_profile_uid_;
261 TokenEnumerator* token_enumerator_;
260 ProfileGenerator* generator_; 262 ProfileGenerator* generator_;
261 ProfilerEventsProcessor* processor_; 263 ProfilerEventsProcessor* processor_;
262 int saved_logging_nesting_; 264 int saved_logging_nesting_;
263 265
264 static CpuProfiler* singleton_; 266 static CpuProfiler* singleton_;
265 267
266 #else 268 #else
267 static INLINE(bool is_profiling()) { return false; } 269 static INLINE(bool is_profiling()) { return false; }
268 #endif // ENABLE_LOGGING_AND_PROFILING 270 #endif // ENABLE_LOGGING_AND_PROFILING
269 271
270 private: 272 private:
271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 273 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
272 }; 274 };
273 275
274 } } // namespace v8::internal 276 } } // namespace v8::internal
275 277
276 278
277 #endif // V8_CPU_PROFILER_H_ 279 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698