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

Side by Side Diff: src/log.cc

Issue 14208012: Move StackTracer to sampler.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/log.h ('k') | src/sampler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Tells whether worker thread should continue running. 106 // Tells whether worker thread should continue running.
107 bool running_; 107 bool running_;
108 108
109 // Tells whether we are currently recording tick samples. 109 // Tells whether we are currently recording tick samples.
110 bool paused_; 110 bool paused_;
111 }; 111 };
112 112
113 113
114 // 114 //
115 // StackTracer implementation
116 //
117 DISABLE_ASAN void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
118 ASSERT(isolate->IsInitialized());
119
120 // Avoid collecting traces while doing GC.
121 if (sample->state == GC) return;
122
123 const Address js_entry_sp =
124 Isolate::js_entry_sp(isolate->thread_local_top());
125 if (js_entry_sp == 0) {
126 // Not executing JS now.
127 return;
128 }
129
130 sample->external_callback = isolate->external_callback();
131
132 SafeStackTraceFrameIterator it(isolate,
133 sample->fp, sample->sp,
134 sample->sp, js_entry_sp);
135 int i = 0;
136 while (!it.done() && i < TickSample::kMaxFramesCount) {
137 sample->stack[i++] = it.frame()->pc();
138 it.Advance();
139 }
140 sample->frames_count = i;
141 }
142
143
144 //
145 // Ticker used to provide ticks to the profiler and the sliding state 115 // Ticker used to provide ticks to the profiler and the sliding state
146 // window. 116 // window.
147 // 117 //
148 class Ticker: public Sampler { 118 class Ticker: public Sampler {
149 public: 119 public:
150 Ticker(Isolate* isolate, int interval): 120 Ticker(Isolate* isolate, int interval):
151 Sampler(isolate, interval), 121 Sampler(isolate, interval),
152 profiler_(NULL) {} 122 profiler_(NULL) {}
153 123
154 ~Ticker() { if (IsActive()) Stop(); } 124 ~Ticker() { if (IsActive()) Stop(); }
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 profiler_ = NULL; 1893 profiler_ = NULL;
1924 } 1894 }
1925 1895
1926 delete ticker_; 1896 delete ticker_;
1927 ticker_ = NULL; 1897 ticker_ = NULL;
1928 1898
1929 return log_->Close(); 1899 return log_->Close();
1930 } 1900 }
1931 1901
1932 } } // namespace v8::internal 1902 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/sampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698