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

Side by Side Diff: src/log.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the Sample class into an iterable. Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 } else { 1713 } else {
1714 msg.Append(",0,"); 1714 msg.Append(",0,");
1715 msg.AppendAddress(sample->tos); 1715 msg.AppendAddress(sample->tos);
1716 } 1716 }
1717 msg.Append(",%d", static_cast<int>(sample->state)); 1717 msg.Append(",%d", static_cast<int>(sample->state));
1718 if (overflow) { 1718 if (overflow) {
1719 msg.Append(",overflow"); 1719 msg.Append(",overflow");
1720 } 1720 }
1721 for (unsigned i = 0; i < sample->frames_count; ++i) { 1721 for (unsigned i = 0; i < sample->frames_count; ++i) {
1722 msg.Append(','); 1722 msg.Append(',');
1723 msg.AppendAddress(sample->stack[i]); 1723 msg.AppendAddress(static_cast<Address>(sample->stack[i]));
1724 } 1724 }
1725 msg.Append('\n'); 1725 msg.Append('\n');
1726 msg.WriteToLogFile(); 1726 msg.WriteToLogFile();
1727 } 1727 }
1728 1728
1729 1729
1730 void Logger::StopProfiler() { 1730 void Logger::StopProfiler() {
1731 if (!log_->IsEnabled()) return; 1731 if (!log_->IsEnabled()) return;
1732 if (profiler_ != NULL) { 1732 if (profiler_ != NULL) {
1733 profiler_->pause(); 1733 profiler_->pause();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 if (Log::InitLogAtStart()) { 2053 if (Log::InitLogAtStart()) {
2054 is_logging_ = true; 2054 is_logging_ = true;
2055 } 2055 }
2056 2056
2057 if (FLAG_prof) { 2057 if (FLAG_prof) {
2058 profiler_ = new Profiler(isolate); 2058 profiler_ = new Profiler(isolate);
2059 is_logging_ = true; 2059 is_logging_ = true;
2060 profiler_->Engage(); 2060 profiler_->Engage();
2061 } 2061 }
2062 2062
2063 // TODO(gholap): This one's for the new sampler API. (include/v8-sampler.h)
2064 // Call to IncreaseProfilingDepth causes the
2065 // SIGPROF signal handler to be installed on the VM thread.
2066 // Figure out whether there's a way to only optionally
2067 // do this based on a runtime flag.
2068 ticker_->IncreaseProfilingDepth();
2069
2063 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start(); 2070 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start();
2064 2071
2065 return true; 2072 return true;
2066 } 2073 }
2067 2074
2068 2075
2069 void Logger::SetCodeEventHandler(uint32_t options, 2076 void Logger::SetCodeEventHandler(uint32_t options,
2070 JitCodeEventHandler event_handler) { 2077 JitCodeEventHandler event_handler) {
2071 if (jit_logger_) { 2078 if (jit_logger_) {
2072 removeCodeEventListener(jit_logger_); 2079 removeCodeEventListener(jit_logger_);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 if (jit_logger_) { 2133 if (jit_logger_) {
2127 removeCodeEventListener(jit_logger_); 2134 removeCodeEventListener(jit_logger_);
2128 delete jit_logger_; 2135 delete jit_logger_;
2129 jit_logger_ = NULL; 2136 jit_logger_ = NULL;
2130 } 2137 }
2131 2138
2132 return log_->Close(); 2139 return log_->Close();
2133 } 2140 }
2134 2141
2135 } } // namespace v8::internal 2142 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698