OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Ticker used to provide ticks to the profiler and the sliding state | 184 // Ticker used to provide ticks to the profiler and the sliding state |
185 // window. | 185 // window. |
186 // | 186 // |
187 class Ticker: public Sampler { | 187 class Ticker: public Sampler { |
188 public: | 188 public: |
189 explicit Ticker(int interval): | 189 explicit Ticker(int interval): |
190 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} | 190 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} |
191 | 191 |
192 ~Ticker() { if (IsActive()) Stop(); } | 192 ~Ticker() { if (IsActive()) Stop(); } |
193 | 193 |
194 void SampleStack(TickSample* sample) { | 194 virtual void SampleStack(TickSample* sample) { |
| 195 ASSERT(IsSynchronous()); |
195 StackTracer::Trace(sample); | 196 StackTracer::Trace(sample); |
196 } | 197 } |
197 | 198 |
198 void Tick(TickSample* sample) { | 199 virtual void Tick(TickSample* sample) { |
199 if (profiler_) profiler_->Insert(sample); | 200 if (profiler_) profiler_->Insert(sample); |
200 if (window_) window_->AddState(sample->state); | 201 if (window_) window_->AddState(sample->state); |
201 } | 202 } |
202 | 203 |
203 void SetWindow(SlidingStateWindow* window) { | 204 void SetWindow(SlidingStateWindow* window) { |
204 window_ = window; | 205 window_ = window; |
205 if (!IsActive()) Start(); | 206 if (!IsActive()) Start(); |
206 } | 207 } |
207 | 208 |
208 void ClearWindow() { | 209 void ClearWindow() { |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 } | 1588 } |
1588 // Otherwise, if the sliding state window computation has not been | 1589 // Otherwise, if the sliding state window computation has not been |
1589 // started we do it now. | 1590 // started we do it now. |
1590 if (sliding_state_window_ == NULL) { | 1591 if (sliding_state_window_ == NULL) { |
1591 sliding_state_window_ = new SlidingStateWindow(); | 1592 sliding_state_window_ = new SlidingStateWindow(); |
1592 } | 1593 } |
1593 #endif | 1594 #endif |
1594 } | 1595 } |
1595 | 1596 |
1596 } } // namespace v8::internal | 1597 } } // namespace v8::internal |
OLD | NEW |