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

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

Issue 1138004: Add multithreading test for SamplingCircularQueue, fix implementation. (Closed)
Patch Set: Created 10 years, 9 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/cpu-profiler.h ('k') | src/globals.h » ('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 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 generator_->RecordTickSample(rec->sample); 169 generator_->RecordTickSample(rec->sample);
170 ticks_buffer_.FinishDequeue(); 170 ticks_buffer_.FinishDequeue();
171 } else { 171 } else {
172 return true; 172 return true;
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 177
178 void ProfilerEventsProcessor::Run() { 178 void ProfilerEventsProcessor::Run() {
179 ticks_buffer_.SetUpConsumer();
180 unsigned dequeue_order = 0; 179 unsigned dequeue_order = 0;
181 running_ = true; 180 running_ = true;
182 181
183 while (running_) { 182 while (running_) {
184 // Process ticks until we have any. 183 // Process ticks until we have any.
185 if (ProcessTicks(dequeue_order)) { 184 if (ProcessTicks(dequeue_order)) {
186 // All ticks of the current dequeue_order are processed, 185 // All ticks of the current dequeue_order are processed,
187 // proceed to the next code event. 186 // proceed to the next code event.
188 ProcessCodeEvent(&dequeue_order); 187 ProcessCodeEvent(&dequeue_order);
189 } 188 }
190 YieldCPU(); 189 YieldCPU();
191 } 190 }
192 191
193 // Process remaining tick events. 192 // Process remaining tick events.
194 ticks_buffer_.FlushResidualRecords(); 193 ticks_buffer_.FlushResidualRecords();
195 // Perform processing until we have tick events, skip remaining code events. 194 // Perform processing until we have tick events, skip remaining code events.
196 while (ProcessTicks(dequeue_order) && ProcessCodeEvent(&dequeue_order)) { } 195 while (ProcessTicks(dequeue_order) && ProcessCodeEvent(&dequeue_order)) { }
197 ticks_buffer_.TearDownConsumer();
198 } 196 }
199 197
200 198
201 } } // namespace v8::internal 199 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698