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

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: Moved thread logic out of GetSample 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"
11 #include "src/code-stubs.h" 11 #include "src/code-stubs.h"
12 #include "src/cpu-profiler.h" 12 #include "src/cpu-profiler.h"
13 #include "src/deoptimizer.h" 13 #include "src/deoptimizer.h"
14 #include "src/global-handles.h" 14 #include "src/global-handles.h"
15 #include "src/log.h" 15 #include "src/log.h"
16 #include "src/log-utils.h" 16 #include "src/log-utils.h"
17 #include "src/macro-assembler.h" 17 #include "src/macro-assembler.h"
18 #include "src/runtime-profiler.h" 18 #include "src/runtime-profiler.h"
19 #include "src/sampler.h"
19 #include "src/serialize.h" 20 #include "src/serialize.h"
20 #include "src/string-stream.h" 21 #include "src/string-stream.h"
21 #include "src/vm-state-inl.h" 22 #include "src/vm-state-inl.h"
22 23
23 namespace v8 { 24 namespace v8 {
24 namespace internal { 25 namespace internal {
25 26
26
27 #define DECLARE_EVENT(ignore1, name) name, 27 #define DECLARE_EVENT(ignore1, name) name,
28 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { 28 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
29 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) 29 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)
30 }; 30 };
31 #undef DECLARE_EVENT 31 #undef DECLARE_EVENT
32 32
33 33
34 #define CALL_LISTENERS(Call) \ 34 #define CALL_LISTENERS(Call) \
35 for (int i = 0; i < listeners_.length(); ++i) { \ 35 for (int i = 0; i < listeners_.length(); ++i) { \
36 listeners_[i]->Call; \ 36 listeners_[i]->Call; \
(...skipping 1676 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 // This one's for the new sampler API. (include/v8.h)
2064 if (FLAG_new_sampler_api) {
2065 Sampler::SetUpForNewSamplingAPI();
2066 }
2067
2063 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start(); 2068 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start();
2064 2069
2065 return true; 2070 return true;
2066 } 2071 }
2067 2072
2068 2073
2069 void Logger::SetCodeEventHandler(uint32_t options, 2074 void Logger::SetCodeEventHandler(uint32_t options,
2070 JitCodeEventHandler event_handler) { 2075 JitCodeEventHandler event_handler) {
2071 if (jit_logger_) { 2076 if (jit_logger_) {
2072 removeCodeEventListener(jit_logger_); 2077 removeCodeEventListener(jit_logger_);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 if (jit_logger_) { 2131 if (jit_logger_) {
2127 removeCodeEventListener(jit_logger_); 2132 removeCodeEventListener(jit_logger_);
2128 delete jit_logger_; 2133 delete jit_logger_;
2129 jit_logger_ = NULL; 2134 jit_logger_ = NULL;
2130 } 2135 }
2131 2136
2132 return log_->Close(); 2137 return log_->Close();
2133 } 2138 }
2134 2139
2135 } } // namespace v8::internal 2140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/profile-generator.cc » ('j') | src/sampler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698