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

Side by Side Diff: src/cpu-profiler.h

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 5 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/codegen.cc ('k') | src/cpu-profiler.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_CPU_PROFILER_H_ 28 #ifndef V8_CPU_PROFILER_H_
29 #define V8_CPU_PROFILER_H_ 29 #define V8_CPU_PROFILER_H_
30 30
31 #ifdef ENABLE_LOGGING_AND_PROFILING
32
33 #include "allocation.h" 31 #include "allocation.h"
34 #include "atomicops.h" 32 #include "atomicops.h"
35 #include "circular-queue.h" 33 #include "circular-queue.h"
36 #include "unbound-queue.h" 34 #include "unbound-queue.h"
37 35
38 namespace v8 { 36 namespace v8 {
39 namespace internal { 37 namespace internal {
40 38
41 // Forward declarations. 39 // Forward declarations.
42 class CodeEntry; 40 class CodeEntry;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } } // namespace v8::internal 197 } } // namespace v8::internal
200 198
201 199
202 #define PROFILE(isolate, Call) \ 200 #define PROFILE(isolate, Call) \
203 LOG(isolate, Call); \ 201 LOG(isolate, Call); \
204 do { \ 202 do { \
205 if (v8::internal::CpuProfiler::is_profiling(isolate)) { \ 203 if (v8::internal::CpuProfiler::is_profiling(isolate)) { \
206 v8::internal::CpuProfiler::Call; \ 204 v8::internal::CpuProfiler::Call; \
207 } \ 205 } \
208 } while (false) 206 } while (false)
209 #else
210 #define PROFILE(isolate, Call) LOG(isolate, Call)
211 #endif // ENABLE_LOGGING_AND_PROFILING
212 207
213 208
214 namespace v8 { 209 namespace v8 {
215 namespace internal { 210 namespace internal {
216 211
217 212
218 // TODO(isolates): isolatify this class. 213 // TODO(isolates): isolatify this class.
219 class CpuProfiler { 214 class CpuProfiler {
220 public: 215 public:
221 static void Setup(); 216 static void Setup();
222 static void TearDown(); 217 static void TearDown();
223 218
224 #ifdef ENABLE_LOGGING_AND_PROFILING
225 static void StartProfiling(const char* title); 219 static void StartProfiling(const char* title);
226 static void StartProfiling(String* title); 220 static void StartProfiling(String* title);
227 static CpuProfile* StopProfiling(const char* title); 221 static CpuProfile* StopProfiling(const char* title);
228 static CpuProfile* StopProfiling(Object* security_token, String* title); 222 static CpuProfile* StopProfiling(Object* security_token, String* title);
229 static int GetProfilesCount(); 223 static int GetProfilesCount();
230 static CpuProfile* GetProfile(Object* security_token, int index); 224 static CpuProfile* GetProfile(Object* security_token, int index);
231 static CpuProfile* FindProfile(Object* security_token, unsigned uid); 225 static CpuProfile* FindProfile(Object* security_token, unsigned uid);
232 static void DeleteAllProfiles(); 226 static void DeleteAllProfiles();
233 static void DeleteProfile(CpuProfile* profile); 227 static void DeleteProfile(CpuProfile* profile);
234 static bool HasDetachedProfiles(); 228 static bool HasDetachedProfiles();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 276
283 CpuProfilesCollection* profiles_; 277 CpuProfilesCollection* profiles_;
284 unsigned next_profile_uid_; 278 unsigned next_profile_uid_;
285 TokenEnumerator* token_enumerator_; 279 TokenEnumerator* token_enumerator_;
286 ProfileGenerator* generator_; 280 ProfileGenerator* generator_;
287 ProfilerEventsProcessor* processor_; 281 ProfilerEventsProcessor* processor_;
288 int saved_logging_nesting_; 282 int saved_logging_nesting_;
289 bool need_to_stop_sampler_; 283 bool need_to_stop_sampler_;
290 Atomic32 is_profiling_; 284 Atomic32 is_profiling_;
291 285
292 #else
293 static INLINE(bool is_profiling(Isolate* isolate)) { return false; }
294 #endif // ENABLE_LOGGING_AND_PROFILING
295
296 private: 286 private:
297 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 287 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
298 }; 288 };
299 289
300 } } // namespace v8::internal 290 } } // namespace v8::internal
301 291
302 292
303 #endif // V8_CPU_PROFILER_H_ 293 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698