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

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

Issue 21101002: Support higher CPU profiler sampling rate on posix systems (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebaseline Created 7 years, 4 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/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 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) 133 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS)
134 #undef DECLARE_TYPE 134 #undef DECLARE_TYPE
135 }; 135 };
136 }; 136 };
137 137
138 138
139 // This class implements both the profile events processor thread and 139 // This class implements both the profile events processor thread and
140 // methods called by event producers: VM and stack sampler threads. 140 // methods called by event producers: VM and stack sampler threads.
141 class ProfilerEventsProcessor : public Thread { 141 class ProfilerEventsProcessor : public Thread {
142 public: 142 public:
143 explicit ProfilerEventsProcessor(ProfileGenerator* generator); 143 ProfilerEventsProcessor(ProfileGenerator* generator,
144 Sampler* sampler,
145 int period_in_useconds);
144 virtual ~ProfilerEventsProcessor() {} 146 virtual ~ProfilerEventsProcessor() {}
145 147
146 // Thread control. 148 // Thread control.
147 virtual void Run(); 149 virtual void Run();
148 void StopSynchronously(); 150 void StopSynchronously();
149 INLINE(bool running()) { return running_; } 151 INLINE(bool running()) { return running_; }
150 void Enqueue(const CodeEventsContainer& event); 152 void Enqueue(const CodeEventsContainer& event);
151 153
152 // Puts current stack into tick sample events buffer. 154 // Puts current stack into tick sample events buffer.
153 void AddCurrentStack(Isolate* isolate); 155 void AddCurrentStack(Isolate* isolate);
154 156
155 // Tick sample events are filled directly in the buffer of the circular 157 // Tick sample events are filled directly in the buffer of the circular
156 // queue (because the structure is of fixed width, but usually not all 158 // queue (because the structure is of fixed width, but usually not all
157 // stack frame entries are filled.) This method returns a pointer to the 159 // stack frame entries are filled.) This method returns a pointer to the
158 // next record of the buffer. 160 // next record of the buffer.
159 INLINE(TickSample* TickSampleEvent()); 161 INLINE(TickSample* TickSampleEvent());
160 162
161 private: 163 private:
162 // Called from events processing thread (Run() method.) 164 // Called from events processing thread (Run() method.)
163 bool ProcessCodeEvent(); 165 bool ProcessCodeEvent();
164 bool ProcessTicks(); 166 bool ProcessTicks();
165 167
168 void ProcessEventsAndDoSample();
169 void ProcessEventsAndYield();
170
166 ProfileGenerator* generator_; 171 ProfileGenerator* generator_;
172 Sampler* sampler_;
167 bool running_; 173 bool running_;
174 // Sampling period in microseconds.
175 const int period_in_useconds_;
168 UnboundQueue<CodeEventsContainer> events_buffer_; 176 UnboundQueue<CodeEventsContainer> events_buffer_;
169 SamplingCircularQueue ticks_buffer_; 177 SamplingCircularQueue ticks_buffer_;
170 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; 178 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_;
171 unsigned last_code_event_id_; 179 unsigned last_code_event_id_;
172 unsigned last_processed_code_event_id_; 180 unsigned last_processed_code_event_id_;
173 }; 181 };
174 182
175 183
176 #define PROFILE(IsolateGetter, Call) \ 184 #define PROFILE(IsolateGetter, Call) \
177 do { \ 185 do { \
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 bool need_to_stop_sampler_; 267 bool need_to_stop_sampler_;
260 bool is_profiling_; 268 bool is_profiling_;
261 269
262 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 270 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
263 }; 271 };
264 272
265 } } // namespace v8::internal 273 } } // namespace v8::internal
266 274
267 275
268 #endif // V8_CPU_PROFILER_H_ 276 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698