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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Ticker used to provide ticks to the profiler and the sliding state | 169 // Ticker used to provide ticks to the profiler and the sliding state |
170 // window. | 170 // window. |
171 // | 171 // |
172 class Ticker: public Sampler { | 172 class Ticker: public Sampler { |
173 public: | 173 public: |
174 explicit Ticker(int interval): | 174 explicit Ticker(int interval): |
175 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} | 175 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} |
176 | 176 |
177 ~Ticker() { if (IsActive()) Stop(); } | 177 ~Ticker() { if (IsActive()) Stop(); } |
178 | 178 |
| 179 void SampleStack(TickSample* sample) { |
| 180 StackTracer::Trace(sample); |
| 181 } |
| 182 |
179 void Tick(TickSample* sample) { | 183 void Tick(TickSample* sample) { |
180 if (IsProfiling()) StackTracer::Trace(sample); | |
181 if (profiler_) profiler_->Insert(sample); | 184 if (profiler_) profiler_->Insert(sample); |
182 if (window_) window_->AddState(sample->state); | 185 if (window_) window_->AddState(sample->state); |
183 } | 186 } |
184 | 187 |
185 void SetWindow(SlidingStateWindow* window) { | 188 void SetWindow(SlidingStateWindow* window) { |
186 window_ = window; | 189 window_ = window; |
187 if (!IsActive()) Start(); | 190 if (!IsActive()) Start(); |
188 } | 191 } |
189 | 192 |
190 void ClearWindow() { | 193 void ClearWindow() { |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 // Otherwise, if the sliding state window computation has not been | 1195 // Otherwise, if the sliding state window computation has not been |
1193 // started we do it now. | 1196 // started we do it now. |
1194 if (sliding_state_window_ == NULL) { | 1197 if (sliding_state_window_ == NULL) { |
1195 sliding_state_window_ = new SlidingStateWindow(); | 1198 sliding_state_window_ = new SlidingStateWindow(); |
1196 } | 1199 } |
1197 #endif | 1200 #endif |
1198 } | 1201 } |
1199 | 1202 |
1200 | 1203 |
1201 } } // namespace v8::internal | 1204 } } // namespace v8::internal |
OLD | NEW |