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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 197 virtual void SampleStack(TickSample* sample) { |
198 ASSERT(IsSynchronous()); | 198 ASSERT(IsSynchronous()); |
199 StackTracer::Trace(sample); | 199 StackTracer::Trace(sample); |
| 200 inc_samples_taken(); |
200 } | 201 } |
201 | 202 |
202 virtual void Tick(TickSample* sample) { | 203 virtual void Tick(TickSample* sample) { |
203 if (profiler_) profiler_->Insert(sample); | 204 if (profiler_) profiler_->Insert(sample); |
204 if (window_) window_->AddState(sample->state); | 205 if (window_) window_->AddState(sample->state); |
205 } | 206 } |
206 | 207 |
207 void SetWindow(SlidingStateWindow* window) { | 208 void SetWindow(SlidingStateWindow* window) { |
208 window_ = window; | 209 window_ = window; |
209 if (!IsActive()) Start(); | 210 if (!IsActive()) Start(); |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |