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

Side by Side Diff: src/log.h

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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #ifdef ENABLE_LOGGING_AND_PROFILING 80 #ifdef ENABLE_LOGGING_AND_PROFILING
81 #define LOG(Call) \ 81 #define LOG(Call) \
82 do { \ 82 do { \
83 if (v8::internal::Logger::is_logging()) \ 83 if (v8::internal::Logger::is_logging()) \
84 v8::internal::Logger::Call; \ 84 v8::internal::Logger::Call; \
85 } while (false) 85 } while (false)
86 #else 86 #else
87 #define LOG(Call) ((void) 0) 87 #define LOG(Call) ((void) 0)
88 #endif 88 #endif
89 89
90 #define LOG_EVENTS_AND_TAGS_LIST(V) \ 90 #define LOG_EVENTS_AND_TAGS_LIST_NO_NATIVES(V) \
91 V(CODE_CREATION_EVENT, "code-creation", "cc") \ 91 V(CODE_CREATION_EVENT, "code-creation", "cc") \
92 V(CODE_MOVE_EVENT, "code-move", "cm") \ 92 V(CODE_MOVE_EVENT, "code-move", "cm") \
93 V(CODE_DELETE_EVENT, "code-delete", "cd") \ 93 V(CODE_DELETE_EVENT, "code-delete", "cd") \
94 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \ 94 V(FUNCTION_CREATION_EVENT, "function-creation", "fc") \
95 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \ 95 V(FUNCTION_MOVE_EVENT, "function-move", "fm") \
96 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \ 96 V(FUNCTION_DELETE_EVENT, "function-delete", "fd") \
97 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \ 97 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos", "sp") \
98 V(TICK_EVENT, "tick", "t") \ 98 V(TICK_EVENT, "tick", "t") \
99 V(REPEAT_META_EVENT, "repeat", "r") \ 99 V(REPEAT_META_EVENT, "repeat", "r") \
100 V(BUILTIN_TAG, "Builtin", "bi") \ 100 V(BUILTIN_TAG, "Builtin", "bi") \
(...skipping 10 matching lines...) Expand all
111 V(FUNCTION_TAG, "Function", "f") \ 111 V(FUNCTION_TAG, "Function", "f") \
112 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \ 112 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC", "klic") \
113 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \ 113 V(KEYED_STORE_IC_TAG, "KeyedStoreIC", "ksic") \
114 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \ 114 V(LAZY_COMPILE_TAG, "LazyCompile", "lc") \
115 V(LOAD_IC_TAG, "LoadIC", "lic") \ 115 V(LOAD_IC_TAG, "LoadIC", "lic") \
116 V(REG_EXP_TAG, "RegExp", "re") \ 116 V(REG_EXP_TAG, "RegExp", "re") \
117 V(SCRIPT_TAG, "Script", "sc") \ 117 V(SCRIPT_TAG, "Script", "sc") \
118 V(STORE_IC_TAG, "StoreIC", "sic") \ 118 V(STORE_IC_TAG, "StoreIC", "sic") \
119 V(STUB_TAG, "Stub", "s") 119 V(STUB_TAG, "Stub", "s")
120 120
121 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
122 // Add 'NATIVE_' cases for functions and scripts, but map them to
123 // original tags when writing to the log.
124 #define LOG_EVENTS_AND_TAGS_LIST(V) \
125 LOG_EVENTS_AND_TAGS_LIST_NO_NATIVES(V) \
126 V(NATIVE_FUNCTION_TAG, "Function", "f") \
127 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile", "lc") \
128 V(NATIVE_SCRIPT_TAG, "Script", "sc")
129 #else
130 #define LOG_EVENTS_AND_TAGS_LIST(V) LOG_EVENTS_AND_TAGS_LIST_NO_NATIVES(V)
131 #endif
132
121 class Logger { 133 class Logger {
122 public: 134 public:
123 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 135 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
124 enum LogEventsAndTags { 136 enum LogEventsAndTags {
125 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 137 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
126 NUMBER_OF_LOG_EVENTS 138 NUMBER_OF_LOG_EVENTS
127 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
128 , NATIVE_FUNCTION_TAG
129 , NATIVE_LAZY_COMPILE_TAG
130 , NATIVE_SCRIPT_TAG
131 #endif
132 }; 139 };
133 #undef DECLARE_ENUM 140 #undef DECLARE_ENUM
134 141
135 // Acquires resources for logging if the right flags are set. 142 // Acquires resources for logging if the right flags are set.
136 static bool Setup(); 143 static bool Setup();
137 144
138 // Frees resources acquired in Setup. 145 // Frees resources acquired in Setup.
139 static void TearDown(); 146 static void TearDown();
140 147
141 // Enable the computation of a sliding window of states. 148 // Enable the computation of a sliding window of states.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 #endif 365 #endif
359 }; 366 };
360 367
361 368
362 // Class that extracts stack trace, used for profiling. 369 // Class that extracts stack trace, used for profiling.
363 class StackTracer : public AllStatic { 370 class StackTracer : public AllStatic {
364 public: 371 public:
365 static void Trace(TickSample* sample); 372 static void Trace(TickSample* sample);
366 }; 373 };
367 374
368
369 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
370
371 class Ticker: public Sampler {
372 public:
373 explicit Ticker(int interval):
374 Sampler(interval, FLAG_prof) {}
375
376 void SampleStack(TickSample* sample) {
377 StackTracer::Trace(sample);
378 }
379 void Tick(TickSample* sample) { }
380 void SetWindow(SlidingStateWindow* window) { }
381 void ClearWindow() { }
382 void SetProfiler(Profiler* profiler) { }
383 void ClearProfiler() { }
384 };
385
386 #endif // ENABLE_CPP_PROFILES_PROCESSOR
387
388 } } // namespace v8::internal 375 } } // namespace v8::internal
389 376
390 377
391 #endif // V8_LOG_H_ 378 #endif // V8_LOG_H_
OLDNEW
« src/cpu-profiler-inl.h ('K') | « src/globals.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698