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

Side by Side Diff: src/log.cc

Issue 5325003: Simplify ProfLazyMode test on Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 10 years 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/platform.h » ('j') | src/platform.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Ticker used to provide ticks to the profiler and the sliding state 187 // Ticker used to provide ticks to the profiler and the sliding state
188 // window. 188 // window.
189 // 189 //
190 class Ticker: public Sampler { 190 class Ticker: public Sampler {
191 public: 191 public:
192 explicit Ticker(int interval): 192 explicit Ticker(int interval):
193 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} 193 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {}
194 194
195 ~Ticker() { if (IsActive()) Stop(); } 195 ~Ticker() { if (IsActive()) Stop(); }
196 196
197 virtual void SampleStack(TickSample* sample) {
198 ASSERT(IsSynchronous());
199 StackTracer::Trace(sample);
200 }
201
202 virtual void Tick(TickSample* sample) { 197 virtual void Tick(TickSample* sample) {
203 if (profiler_) profiler_->Insert(sample); 198 if (profiler_) profiler_->Insert(sample);
204 if (window_) window_->AddState(sample->state); 199 if (window_) window_->AddState(sample->state);
205 } 200 }
206 201
207 void SetWindow(SlidingStateWindow* window) { 202 void SetWindow(SlidingStateWindow* window) {
208 window_ = window; 203 window_ = window;
209 if (!IsActive()) Start(); 204 if (!IsActive()) Start();
210 } 205 }
211 206
212 void ClearWindow() { 207 void ClearWindow() {
213 window_ = NULL; 208 window_ = NULL;
214 if (!profiler_ && IsActive()) Stop(); 209 if (!profiler_ && IsActive()) Stop();
215 } 210 }
216 211
217 void SetProfiler(Profiler* profiler) { 212 void SetProfiler(Profiler* profiler) {
218 profiler_ = profiler; 213 profiler_ = profiler;
219 if (!FLAG_prof_lazy && !IsActive()) Start(); 214 if (!FLAG_prof_lazy && !IsActive()) Start();
220 } 215 }
221 216
222 void ClearProfiler() { 217 void ClearProfiler() {
223 profiler_ = NULL; 218 profiler_ = NULL;
224 if (!window_ && IsActive()) Stop(); 219 if (!window_ && IsActive()) Stop();
225 } 220 }
226 221
222 protected:
223 virtual void DoSampleStack(TickSample* sample) {
224 ASSERT(IsSynchronous());
225 StackTracer::Trace(sample);
226 }
227
227 private: 228 private:
228 SlidingStateWindow* window_; 229 SlidingStateWindow* window_;
229 Profiler* profiler_; 230 Profiler* profiler_;
230 }; 231 };
231 232
232 233
233 // 234 //
234 // SlidingStateWindow implementation. 235 // SlidingStateWindow implementation.
235 // 236 //
236 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) { 237 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) {
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 } 1650 }
1650 // Otherwise, if the sliding state window computation has not been 1651 // Otherwise, if the sliding state window computation has not been
1651 // started we do it now. 1652 // started we do it now.
1652 if (sliding_state_window_ == NULL) { 1653 if (sliding_state_window_ == NULL) {
1653 sliding_state_window_ = new SlidingStateWindow(); 1654 sliding_state_window_ = new SlidingStateWindow();
1654 } 1655 }
1655 #endif 1656 #endif
1656 } 1657 }
1657 1658
1658 } } // namespace v8::internal 1659 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/platform.h » ('j') | src/platform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698