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

Side by Side Diff: src/log.h

Issue 499483002: [WIP] A sampler thread in d8 for consuming the new API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_LOG_H_ 5 #ifndef V8_LOG_H_
6 #define V8_LOG_H_ 6 #define V8_LOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "include/v8-sampler.h"
11
10 #include "src/allocation.h" 12 #include "src/allocation.h"
11 #include "src/base/platform/elapsed-timer.h" 13 #include "src/base/platform/elapsed-timer.h"
12 #include "src/base/platform/platform.h" 14 #include "src/base/platform/platform.h"
13 #include "src/objects.h" 15 #include "src/objects.h"
14 16
15 namespace v8 { 17 namespace v8 {
16 18
17 namespace base { 19 namespace base {
18 class Semaphore; 20 class Semaphore;
19 } 21 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Note that 'NATIVE_' cases for functions and scripts are mapped onto 144 // Note that 'NATIVE_' cases for functions and scripts are mapped onto
143 // original tags when writing to the log. 145 // original tags when writing to the log.
144 146
145 147
146 class JitLogger; 148 class JitLogger;
147 class PerfBasicLogger; 149 class PerfBasicLogger;
148 class LowLevelLogger; 150 class LowLevelLogger;
149 class PerfJitLogger; 151 class PerfJitLogger;
150 class Sampler; 152 class Sampler;
151 153
154 class StubCodeEventHandler: public v8::CodeEventHandler {
155 public:
156 void Create(const void* from,
157 const int size,
158 const std::string& name) {}
159 void Delete(const void* from) {}
160 void Move(const void* from, const void* to) {}
161 void SharedLibrary(const std::string& library_path,
162 const void* start,
163 const void* end) {}
164 };
165
166
152 class Logger { 167 class Logger {
153 public: 168 public:
154 #define DECLARE_ENUM(enum_item, ignore) enum_item, 169 #define DECLARE_ENUM(enum_item, ignore) enum_item,
155 enum LogEventsAndTags { 170 enum LogEventsAndTags {
156 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) 171 LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM)
157 NUMBER_OF_LOG_EVENTS 172 NUMBER_OF_LOG_EVENTS
158 }; 173 };
159 #undef DECLARE_ENUM 174 #undef DECLARE_ENUM
160 175
161 // Acquires resources for logging if the right flags are set. 176 // Acquires resources for logging if the right flags are set.
162 bool SetUp(Isolate* isolate); 177 bool SetUp(Isolate* isolate);
163 178
164 // Sets the current code event handler. 179 // Sets the current code event handler.
165 void SetCodeEventHandler(uint32_t options, 180 void SetCodeEventHandler(uint32_t options,
166 JitCodeEventHandler event_handler); 181 JitCodeEventHandler event_handler);
167 182
183 void SetCodeEventHandler(v8::CodeEventHandler* handler);
184
168 Sampler* sampler(); 185 Sampler* sampler();
186 v8::CodeEventHandler* codeEventHandler();
169 187
170 // Frees resources acquired in SetUp. 188 // Frees resources acquired in SetUp.
171 // When a temporary file is used for the log, returns its stream descriptor, 189 // When a temporary file is used for the log, returns its stream descriptor,
172 // leaving the file open. 190 // leaving the file open.
173 FILE* TearDown(); 191 FILE* TearDown();
174 192
175 // Emits an event with a string value -> (name, value). 193 // Emits an event with a string value -> (name, value).
176 void StringEvent(const char* name, const char* value); 194 void StringEvent(const char* name, const char* value);
177 195
178 // Emits an event with an int value -> (name, value). 196 // Emits an event with an int value -> (name, value).
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 template <StateTag Tag> friend class VMState; 446 template <StateTag Tag> friend class VMState;
429 friend class LoggerTestHelper; 447 friend class LoggerTestHelper;
430 448
431 bool is_logging_; 449 bool is_logging_;
432 Log* log_; 450 Log* log_;
433 PerfBasicLogger* perf_basic_logger_; 451 PerfBasicLogger* perf_basic_logger_;
434 PerfJitLogger* perf_jit_logger_; 452 PerfJitLogger* perf_jit_logger_;
435 LowLevelLogger* ll_logger_; 453 LowLevelLogger* ll_logger_;
436 JitLogger* jit_logger_; 454 JitLogger* jit_logger_;
437 List<CodeEventListener*> listeners_; 455 List<CodeEventListener*> listeners_;
456 CodeEventHandler* code_event_handler_;
438 457
439 // Guards against multiple calls to TearDown() that can happen in some tests. 458 // Guards against multiple calls to TearDown() that can happen in some tests.
440 // 'true' between SetUp() and TearDown(). 459 // 'true' between SetUp() and TearDown().
441 bool is_initialized_; 460 bool is_initialized_;
442 461
443 base::ElapsedTimer timer_; 462 base::ElapsedTimer timer_;
444 463
445 friend class CpuProfiler; 464 friend class CpuProfiler;
446 }; 465 };
447 466
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 int length) = 0; 543 int length) = 0;
525 544
526 NameBuffer* name_buffer_; 545 NameBuffer* name_buffer_;
527 }; 546 };
528 547
529 548
530 } } // namespace v8::internal 549 } } // namespace v8::internal
531 550
532 551
533 #endif // V8_LOG_H_ 552 #endif // V8_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698