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

Side by Side Diff: src/log.cc

Issue 1635005: Allow new CPU profiling subsystem to coexist nicely with the old one. (Closed)
Patch Set: Fix TickSampleEvent Created 10 years, 8 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 it.Advance(); 174 it.Advance();
175 } 175 }
176 sample->frames_count = i; 176 sample->frames_count = i;
177 } 177 }
178 178
179 179
180 // 180 //
181 // Ticker used to provide ticks to the profiler and the sliding state 181 // Ticker used to provide ticks to the profiler and the sliding state
182 // window. 182 // window.
183 // 183 //
184 #ifndef ENABLE_CPP_PROFILES_PROCESSOR
185
186 class Ticker: public Sampler { 184 class Ticker: public Sampler {
187 public: 185 public:
188 explicit Ticker(int interval): 186 explicit Ticker(int interval):
189 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {} 187 Sampler(interval, FLAG_prof), window_(NULL), profiler_(NULL) {}
190 188
191 ~Ticker() { if (IsActive()) Stop(); } 189 ~Ticker() { if (IsActive()) Stop(); }
192 190
193 void SampleStack(TickSample* sample) { 191 void SampleStack(TickSample* sample) {
194 StackTracer::Trace(sample); 192 StackTracer::Trace(sample);
195 } 193 }
(...skipping 21 matching lines...) Expand all
217 void ClearProfiler() { 215 void ClearProfiler() {
218 profiler_ = NULL; 216 profiler_ = NULL;
219 if (!window_ && IsActive()) Stop(); 217 if (!window_ && IsActive()) Stop();
220 } 218 }
221 219
222 private: 220 private:
223 SlidingStateWindow* window_; 221 SlidingStateWindow* window_;
224 Profiler* profiler_; 222 Profiler* profiler_;
225 }; 223 };
226 224
227 #endif // ENABLE_CPP_PROFILES_PROCESSOR
228
229 225
230 // 226 //
231 // SlidingStateWindow implementation. 227 // SlidingStateWindow implementation.
232 // 228 //
233 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) { 229 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) {
234 for (int i = 0; i < kBufferSize; i++) { 230 for (int i = 0; i < kBufferSize; i++) {
235 buffer_[i] = static_cast<byte>(OTHER); 231 buffer_[i] = static_cast<byte>(OTHER);
236 } 232 }
237 Logger::ticker_->SetWindow(this); 233 Logger::ticker_->SetWindow(this);
238 } 234 }
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 if (!FLAG_prof_auto) { 1497 if (!FLAG_prof_auto) {
1502 profiler_->pause(); 1498 profiler_->pause();
1503 } else { 1499 } else {
1504 logging_nesting_ = 1; 1500 logging_nesting_ = 1;
1505 } 1501 }
1506 if (!FLAG_prof_lazy) { 1502 if (!FLAG_prof_lazy) {
1507 profiler_->Engage(); 1503 profiler_->Engage();
1508 } 1504 }
1509 } 1505 }
1510 1506
1511 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
1512 // Disable old logging, as we are using the same '--prof' flag.
1513 logging_nesting_ = 0;
1514 #endif
1515
1516 LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling); 1507 LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling);
1517 1508
1518 return true; 1509 return true;
1519 1510
1520 #else 1511 #else
1521 return false; 1512 return false;
1522 #endif 1513 #endif
1523 } 1514 }
1524 1515
1525 1516
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 } 1551 }
1561 // Otherwise, if the sliding state window computation has not been 1552 // Otherwise, if the sliding state window computation has not been
1562 // started we do it now. 1553 // started we do it now.
1563 if (sliding_state_window_ == NULL) { 1554 if (sliding_state_window_ == NULL) {
1564 sliding_state_window_ = new SlidingStateWindow(); 1555 sliding_state_window_ = new SlidingStateWindow();
1565 } 1556 }
1566 #endif 1557 #endif
1567 } 1558 }
1568 1559
1569 } } // namespace v8::internal 1560 } } // namespace v8::internal
OLDNEW
« src/cpu-profiler-inl.h ('K') | « src/log.h ('k') | src/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698