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

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

Issue 10871039: Replacing circular queue by single buffer in CPU Profiler. (Closed) Base URL: http://git.chromium.org/external/v8.git@profiling
Patch Set: an attempt to fix a test that strangely crashed only once Created 8 years, 3 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
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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_CPU_PROFILER_INL_H_ 28 #ifndef V8_CPU_PROFILER_INL_H_
29 #define V8_CPU_PROFILER_INL_H_ 29 #define V8_CPU_PROFILER_INL_H_
30 30
31 #include "cpu-profiler.h" 31 #include "cpu-profiler.h"
32 32
33 #include <new> 33 #include <new>
34 #include "circular-queue-inl.h"
35 #include "profile-generator-inl.h" 34 #include "profile-generator-inl.h"
36 #include "unbound-queue-inl.h" 35 #include "unbound-queue-inl.h"
37 36
38 namespace v8 { 37 namespace v8 {
39 namespace internal { 38 namespace internal {
40 39
41 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { 40 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) {
42 code_map->AddCode(start, entry, size); 41 code_map->AddCode(start, entry, size);
43 if (shared != NULL) { 42 if (shared != NULL) {
44 entry->set_shared_id(code_map->GetSharedId(shared)); 43 entry->set_shared_id(code_map->GetSharedId(shared));
45 } 44 }
46 } 45 }
47 46
48 47
49 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { 48 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
50 code_map->MoveCode(from, to); 49 code_map->MoveCode(from, to);
51 } 50 }
52 51
53 52
54 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { 53 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
55 code_map->MoveCode(from, to); 54 code_map->MoveCode(from, to);
56 } 55 }
57 56
58 57
59 TickSample* ProfilerEventsProcessor::TickSampleEvent() { 58 TickSample* ProfilerEventsProcessor::StartTickSampleEvent() {
59 if (!ticks_buffer_is_empty_ || ticks_buffer_is_initialized_) return NULL;
60 ticks_buffer_is_initialized_ = true;
60 generator_->Tick(); 61 generator_->Tick();
61 TickSampleEventRecord* evt = 62 ticks_buffer_ = TickSampleEventRecord(enqueue_order_);
62 new(ticks_buffer_.Enqueue()) TickSampleEventRecord(enqueue_order_); 63 return &ticks_buffer_.sample;
63 return &evt->sample;
64 } 64 }
65 65
66 66
67 void ProfilerEventsProcessor::FinishTickSampleEvent() {
68 ASSERT(ticks_buffer_is_initialized && ticks_buffer_is_empty_);
Jakob Kummerow 2012/10/02 10:56:51 typo: ticks_buffer_is_initialized_ is missing its
69 ticks_buffer_is_empty_ = false;
70 }
71
72
67 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( 73 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent(
68 Logger::LogEventsAndTags tag) { 74 Logger::LogEventsAndTags tag) {
69 return FLAG_prof_browser_mode 75 return FLAG_prof_browser_mode
70 && (tag != Logger::CALLBACK_TAG 76 && (tag != Logger::CALLBACK_TAG
71 && tag != Logger::FUNCTION_TAG 77 && tag != Logger::FUNCTION_TAG
72 && tag != Logger::LAZY_COMPILE_TAG 78 && tag != Logger::LAZY_COMPILE_TAG
73 && tag != Logger::REG_EXP_TAG 79 && tag != Logger::REG_EXP_TAG
74 && tag != Logger::SCRIPT_TAG); 80 && tag != Logger::SCRIPT_TAG);
75 } 81 }
76 82
77 } } // namespace v8::internal 83 } } // namespace v8::internal
78 84
79 #endif // V8_CPU_PROFILER_INL_H_ 85 #endif // V8_CPU_PROFILER_INL_H_
OLDNEW
« src/cpu-profiler.h ('K') | « src/cpu-profiler.cc ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698