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

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

Issue 23490015: Reland^2 "Add Chromium-style TimeDelta, Time and TimeTicks classes, and a new ElapsedTimer class." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some windows cleanup Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/counters.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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 }; 131 };
132 }; 132 };
133 133
134 134
135 // This class implements both the profile events processor thread and 135 // This class implements both the profile events processor thread and
136 // methods called by event producers: VM and stack sampler threads. 136 // methods called by event producers: VM and stack sampler threads.
137 class ProfilerEventsProcessor : public Thread { 137 class ProfilerEventsProcessor : public Thread {
138 public: 138 public:
139 ProfilerEventsProcessor(ProfileGenerator* generator, 139 ProfilerEventsProcessor(ProfileGenerator* generator,
140 Sampler* sampler, 140 Sampler* sampler,
141 int period_in_useconds); 141 TimeDelta period);
142 virtual ~ProfilerEventsProcessor() {} 142 virtual ~ProfilerEventsProcessor() {}
143 143
144 // Thread control. 144 // Thread control.
145 virtual void Run(); 145 virtual void Run();
146 void StopSynchronously(); 146 void StopSynchronously();
147 INLINE(bool running()) { return running_; } 147 INLINE(bool running()) { return running_; }
148 void Enqueue(const CodeEventsContainer& event); 148 void Enqueue(const CodeEventsContainer& event);
149 149
150 // Puts current stack into tick sample events buffer. 150 // Puts current stack into tick sample events buffer.
151 void AddCurrentStack(Isolate* isolate); 151 void AddCurrentStack(Isolate* isolate);
(...skipping 10 matching lines...) Expand all
162 bool ProcessCodeEvent(); 162 bool ProcessCodeEvent();
163 bool ProcessTicks(); 163 bool ProcessTicks();
164 164
165 void ProcessEventsAndDoSample(); 165 void ProcessEventsAndDoSample();
166 void ProcessEventsAndYield(); 166 void ProcessEventsAndYield();
167 167
168 ProfileGenerator* generator_; 168 ProfileGenerator* generator_;
169 Sampler* sampler_; 169 Sampler* sampler_;
170 bool running_; 170 bool running_;
171 // Sampling period in microseconds. 171 // Sampling period in microseconds.
172 const int period_in_useconds_; 172 const TimeDelta period_;
173 UnboundQueue<CodeEventsContainer> events_buffer_; 173 UnboundQueue<CodeEventsContainer> events_buffer_;
174 static const size_t kTickSampleBufferSize = 1 * MB; 174 static const size_t kTickSampleBufferSize = 1 * MB;
175 static const size_t kTickSampleQueueLength = 175 static const size_t kTickSampleQueueLength =
176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); 176 kTickSampleBufferSize / sizeof(TickSampleEventRecord);
177 SamplingCircularQueue<TickSampleEventRecord, 177 SamplingCircularQueue<TickSampleEventRecord,
178 kTickSampleQueueLength> ticks_buffer_; 178 kTickSampleQueueLength> ticks_buffer_;
179 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; 179 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_;
180 unsigned last_code_event_id_; 180 unsigned last_code_event_id_;
181 unsigned last_processed_code_event_id_; 181 unsigned last_processed_code_event_id_;
182 }; 182 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 bool need_to_stop_sampler_; 269 bool need_to_stop_sampler_;
270 bool is_profiling_; 270 bool is_profiling_;
271 271
272 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 272 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
273 }; 273 };
274 274
275 } } // namespace v8::internal 275 } } // namespace v8::internal
276 276
277 277
278 #endif // V8_CPU_PROFILER_H_ 278 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/counters.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698