| 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 28 matching lines...) Expand all Loading... |
| 39 namespace v8 { | 39 namespace v8 { |
| 40 namespace internal { | 40 namespace internal { |
| 41 | 41 |
| 42 static const int kEventsBufferSize = 256*KB; | 42 static const int kEventsBufferSize = 256*KB; |
| 43 static const int kTickSamplesBufferChunkSize = 64*KB; | 43 static const int kTickSamplesBufferChunkSize = 64*KB; |
| 44 static const int kTickSamplesBufferChunksCount = 16; | 44 static const int kTickSamplesBufferChunksCount = 16; |
| 45 | 45 |
| 46 | 46 |
| 47 ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) | 47 ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) |
| 48 : generator_(generator), | 48 : generator_(generator), |
| 49 running_(false), | 49 running_(true), |
| 50 ticks_buffer_(sizeof(TickSampleEventRecord), | 50 ticks_buffer_(sizeof(TickSampleEventRecord), |
| 51 kTickSamplesBufferChunkSize, | 51 kTickSamplesBufferChunkSize, |
| 52 kTickSamplesBufferChunksCount), | 52 kTickSamplesBufferChunksCount), |
| 53 enqueue_order_(0) { | 53 enqueue_order_(0) { |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, | 57 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, |
| 58 const char* prefix, | 58 const char* prefix, |
| 59 String* name, | 59 String* name, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 ticks_buffer_.FinishDequeue(); | 240 ticks_buffer_.FinishDequeue(); |
| 241 } else { | 241 } else { |
| 242 return true; | 242 return true; |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 void ProfilerEventsProcessor::Run() { | 248 void ProfilerEventsProcessor::Run() { |
| 249 unsigned dequeue_order = 0; | 249 unsigned dequeue_order = 0; |
| 250 running_ = true; | |
| 251 | 250 |
| 252 while (running_) { | 251 while (running_) { |
| 253 // Process ticks until we have any. | 252 // Process ticks until we have any. |
| 254 if (ProcessTicks(dequeue_order)) { | 253 if (ProcessTicks(dequeue_order)) { |
| 255 // All ticks of the current dequeue_order are processed, | 254 // All ticks of the current dequeue_order are processed, |
| 256 // proceed to the next code event. | 255 // proceed to the next code event. |
| 257 ProcessCodeEvent(&dequeue_order); | 256 ProcessCodeEvent(&dequeue_order); |
| 258 } | 257 } |
| 259 YieldCPU(); | 258 YieldCPU(); |
| 260 } | 259 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 void CpuProfiler::TearDown() { | 529 void CpuProfiler::TearDown() { |
| 531 #ifdef ENABLE_LOGGING_AND_PROFILING | 530 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 532 if (singleton_ != NULL) { | 531 if (singleton_ != NULL) { |
| 533 delete singleton_; | 532 delete singleton_; |
| 534 } | 533 } |
| 535 singleton_ = NULL; | 534 singleton_ = NULL; |
| 536 #endif | 535 #endif |
| 537 } | 536 } |
| 538 | 537 |
| 539 } } // namespace v8::internal | 538 } } // namespace v8::internal |
| OLD | NEW |