| OLD | NEW |
| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 bool running_; | 190 bool running_; |
| 191 UnboundQueue<CodeEventsContainer> events_buffer_; | 191 UnboundQueue<CodeEventsContainer> events_buffer_; |
| 192 SamplingCircularQueue ticks_buffer_; | 192 SamplingCircularQueue ticks_buffer_; |
| 193 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; | 193 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
| 194 unsigned enqueue_order_; | 194 unsigned enqueue_order_; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 } } // namespace v8::internal | 197 } } // namespace v8::internal |
| 198 | 198 |
| 199 | 199 |
| 200 #define PROFILE(isolate, Call) \ | 200 #define PROFILE(isolate, Call) \ |
| 201 LOG(isolate, Call); \ | 201 LOG(isolate, Call); \ |
| 202 do { \ | 202 do { \ |
| 203 if (v8::internal::CpuProfiler::is_profiling()) { \ | 203 if (v8::internal::CpuProfiler::is_profiling(isolate)) { \ |
| 204 v8::internal::CpuProfiler::Call; \ | 204 v8::internal::CpuProfiler::Call; \ |
| 205 } \ | 205 } \ |
| 206 } while (false) | 206 } while (false) |
| 207 #else | 207 #else |
| 208 #define PROFILE(isolate, Call) LOG(isolate, Call) | 208 #define PROFILE(isolate, Call) LOG(isolate, Call) |
| 209 #endif // ENABLE_LOGGING_AND_PROFILING | 209 #endif // ENABLE_LOGGING_AND_PROFILING |
| 210 | 210 |
| 211 | 211 |
| 212 namespace v8 { | 212 namespace v8 { |
| 213 namespace internal { | 213 namespace internal { |
| 214 | 214 |
| 215 | 215 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 static void CodeMovingGCEvent() {} | 254 static void CodeMovingGCEvent() {} |
| 255 static void CodeMoveEvent(Address from, Address to); | 255 static void CodeMoveEvent(Address from, Address to); |
| 256 static void CodeDeleteEvent(Address from); | 256 static void CodeDeleteEvent(Address from); |
| 257 static void GetterCallbackEvent(String* name, Address entry_point); | 257 static void GetterCallbackEvent(String* name, Address entry_point); |
| 258 static void RegExpCodeCreateEvent(Code* code, String* source); | 258 static void RegExpCodeCreateEvent(Code* code, String* source); |
| 259 static void SetterCallbackEvent(String* name, Address entry_point); | 259 static void SetterCallbackEvent(String* name, Address entry_point); |
| 260 static void SharedFunctionInfoMoveEvent(Address from, Address to); | 260 static void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 261 | 261 |
| 262 // TODO(isolates): this doesn't have to use atomics anymore. | 262 // TODO(isolates): this doesn't have to use atomics anymore. |
| 263 | 263 |
| 264 static INLINE(bool is_profiling()) { | |
| 265 return is_profiling(Isolate::Current()); | |
| 266 } | |
| 267 | |
| 268 static INLINE(bool is_profiling(Isolate* isolate)) { | 264 static INLINE(bool is_profiling(Isolate* isolate)) { |
| 269 CpuProfiler* profiler = isolate->cpu_profiler(); | 265 CpuProfiler* profiler = isolate->cpu_profiler(); |
| 270 return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_); | 266 return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_); |
| 271 } | 267 } |
| 272 | 268 |
| 273 private: | 269 private: |
| 274 CpuProfiler(); | 270 CpuProfiler(); |
| 275 ~CpuProfiler(); | 271 ~CpuProfiler(); |
| 276 void StartCollectingProfile(const char* title); | 272 void StartCollectingProfile(const char* title); |
| 277 void StartCollectingProfile(String* title); | 273 void StartCollectingProfile(String* title); |
| 278 void StartProcessorIfNotStarted(); | 274 void StartProcessorIfNotStarted(); |
| 279 CpuProfile* StopCollectingProfile(const char* title); | 275 CpuProfile* StopCollectingProfile(const char* title); |
| 280 CpuProfile* StopCollectingProfile(Object* security_token, String* title); | 276 CpuProfile* StopCollectingProfile(Object* security_token, String* title); |
| 281 void StopProcessorIfLastProfile(const char* title); | 277 void StopProcessorIfLastProfile(const char* title); |
| 282 void StopProcessor(); | 278 void StopProcessor(); |
| 283 void ResetProfiles(); | 279 void ResetProfiles(); |
| 284 | 280 |
| 285 CpuProfilesCollection* profiles_; | 281 CpuProfilesCollection* profiles_; |
| 286 unsigned next_profile_uid_; | 282 unsigned next_profile_uid_; |
| 287 TokenEnumerator* token_enumerator_; | 283 TokenEnumerator* token_enumerator_; |
| 288 ProfileGenerator* generator_; | 284 ProfileGenerator* generator_; |
| 289 ProfilerEventsProcessor* processor_; | 285 ProfilerEventsProcessor* processor_; |
| 290 int saved_logging_nesting_; | 286 int saved_logging_nesting_; |
| 291 bool need_to_stop_sampler_; | 287 bool need_to_stop_sampler_; |
| 292 Atomic32 is_profiling_; | 288 Atomic32 is_profiling_; |
| 293 | 289 |
| 294 #else | 290 #else |
| 295 static INLINE(bool is_profiling()) { return false; } | 291 static INLINE(bool is_profiling(Isolate* isolate)) { return false; } |
| 296 #endif // ENABLE_LOGGING_AND_PROFILING | 292 #endif // ENABLE_LOGGING_AND_PROFILING |
| 297 | 293 |
| 298 private: | 294 private: |
| 299 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 295 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 300 }; | 296 }; |
| 301 | 297 |
| 302 } } // namespace v8::internal | 298 } } // namespace v8::internal |
| 303 | 299 |
| 304 | 300 |
| 305 #endif // V8_CPU_PROFILER_H_ | 301 #endif // V8_CPU_PROFILER_H_ |
| OLD | NEW |