OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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_UTILS_H_ | 5 #ifndef V8_LOG_UTILS_H_ |
6 #define V8_LOG_UTILS_H_ | 6 #define V8_LOG_UTILS_H_ |
7 | 7 |
8 #include "allocation.h" | 8 #include "allocation.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class Logger; | 13 class Logger; |
14 | 14 |
15 // Functions and data for performing output of log messages. | 15 // Functions and data for performing output of log messages. |
16 class Log { | 16 class Log { |
17 public: | 17 public: |
18 // Performs process-wide initialization. | 18 // Performs process-wide initialization. |
19 void Initialize(const char* log_file_name); | 19 void Initialize(const char* log_file_name); |
20 | 20 |
21 // Disables logging, but preserves acquired resources. | 21 // Disables logging, but preserves acquired resources. |
22 void stop() { is_stopped_ = true; } | 22 void stop() { is_stopped_ = true; } |
23 | 23 |
24 static bool InitLogAtStart() { | 24 static bool InitLogAtStart() { |
25 return FLAG_log || FLAG_log_runtime || FLAG_log_api | 25 return FLAG_log || FLAG_log_api || FLAG_log_code || FLAG_log_gc |
26 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect | 26 || FLAG_log_handles || FLAG_log_suspect || FLAG_log_regexp |
27 || FLAG_log_regexp || FLAG_ll_prof || FLAG_perf_basic_prof | 27 || FLAG_ll_prof || FLAG_perf_basic_prof || FLAG_perf_jit_prof |
28 || FLAG_perf_jit_prof || FLAG_log_internal_timer_events; | 28 || FLAG_log_internal_timer_events; |
29 } | 29 } |
30 | 30 |
31 // Frees all resources acquired in Initialize and Open... functions. | 31 // Frees all resources acquired in Initialize and Open... functions. |
32 // When a temporary file is used for the log, returns its stream descriptor, | 32 // When a temporary file is used for the log, returns its stream descriptor, |
33 // leaving the file open. | 33 // leaving the file open. |
34 FILE* Close(); | 34 FILE* Close(); |
35 | 35 |
36 // Returns whether logging is enabled. | 36 // Returns whether logging is enabled. |
37 bool IsEnabled() { | 37 bool IsEnabled() { |
38 return !is_stopped_ && output_handle_ != NULL; | 38 return !is_stopped_ && output_handle_ != NULL; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 Logger* logger_; | 129 Logger* logger_; |
130 | 130 |
131 friend class Logger; | 131 friend class Logger; |
132 }; | 132 }; |
133 | 133 |
134 | 134 |
135 } } // namespace v8::internal | 135 } } // namespace v8::internal |
136 | 136 |
137 #endif // V8_LOG_UTILS_H_ | 137 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |