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

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

Issue 12321046: Send SIGPROF signals on the profiler event processor thread (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fixed typo: Profler->Profiler Created 7 years, 10 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
« no previous file with comments | « src/circular-queue.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 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 static TickSampleEventRecord* cast(void* value) { 117 static TickSampleEventRecord* cast(void* value) {
118 return reinterpret_cast<TickSampleEventRecord*>(value); 118 return reinterpret_cast<TickSampleEventRecord*>(value);
119 } 119 }
120 }; 120 };
121 121
122 122
123 // This class implements both the profile events processor thread and 123 // This class implements both the profile events processor thread and
124 // methods called by event producers: VM and stack sampler threads. 124 // methods called by event producers: VM and stack sampler threads.
125 class ProfilerEventsProcessor : public Thread { 125 class ProfilerEventsProcessor : public Thread {
126 public: 126 public:
127 explicit ProfilerEventsProcessor(ProfileGenerator* generator); 127 ProfilerEventsProcessor(ProfileGenerator* generator,
128 Sampler* sampler,
129 int period_in_useconds);
128 virtual ~ProfilerEventsProcessor() {} 130 virtual ~ProfilerEventsProcessor() {}
129 131
130 // Thread control. 132 // Thread control.
131 virtual void Run(); 133 virtual void Run();
132 inline void Stop() { running_ = false; } 134 inline void Stop() { running_ = false; }
133 INLINE(bool running()) { return running_; } 135 INLINE(bool running()) { return running_; }
134 136
135 // Events adding methods. Called by VM threads. 137 // Events adding methods. Called by VM threads.
136 void CallbackCreateEvent(Logger::LogEventsAndTags tag, 138 void CallbackCreateEvent(Logger::LogEventsAndTags tag,
137 const char* prefix, String* name, 139 const char* prefix, String* name,
(...skipping 28 matching lines...) Expand all
166 union CodeEventsContainer { 168 union CodeEventsContainer {
167 CodeEventRecord generic; 169 CodeEventRecord generic;
168 #define DECLARE_CLASS(ignore, type) type type##_; 170 #define DECLARE_CLASS(ignore, type) type type##_;
169 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) 171 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS)
170 #undef DECLARE_TYPE 172 #undef DECLARE_TYPE
171 }; 173 };
172 174
173 // Called from events processing thread (Run() method.) 175 // Called from events processing thread (Run() method.)
174 bool ProcessCodeEvent(unsigned* dequeue_order); 176 bool ProcessCodeEvent(unsigned* dequeue_order);
175 bool ProcessTicks(unsigned dequeue_order); 177 bool ProcessTicks(unsigned dequeue_order);
178 void ProcessEventsAndDoSample(unsigned* dequeue_order);
179 void ProcessEventsAndYield(unsigned* dequeue_order);
176 180
177 INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); 181 INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag));
178 182
179 ProfileGenerator* generator_; 183 ProfileGenerator* generator_;
184 Sampler* sampler_;
180 bool running_; 185 bool running_;
186 // Sampling period in microseconds.
187 const int period_in_useconds_;
181 UnboundQueue<CodeEventsContainer> events_buffer_; 188 UnboundQueue<CodeEventsContainer> events_buffer_;
182 SamplingCircularQueue ticks_buffer_; 189 SamplingCircularQueue ticks_buffer_;
183 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; 190 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_;
184 unsigned enqueue_order_; 191 unsigned enqueue_order_;
185 }; 192 };
186 193
187 } } // namespace v8::internal 194 } } // namespace v8::internal
188 195
189 196
190 #define PROFILE(isolate, Call) \ 197 #define PROFILE(isolate, Call) \
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Atomic32 is_profiling_; 281 Atomic32 is_profiling_;
275 282
276 private: 283 private:
277 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 284 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
278 }; 285 };
279 286
280 } } // namespace v8::internal 287 } } // namespace v8::internal
281 288
282 289
283 #endif // V8_CPU_PROFILER_H_ 290 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/circular-queue.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698