[logging] Platform logging improvements
- Add V8_OS_STRING and V8_TARGET_OS_STRING define - Add v8-platform logging event - Add shared-library-end event for faster v8.log processing Change-Id: Id25a9e704620dbb70042e51a1fb6ed77ca7256bb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3067219 Reviewed-by: Patrick Thier <pthier@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#76040}
This commit is contained in:
parent
cb879ec910
commit
caf6582a42
@ -86,51 +86,80 @@ path. Add it with -I<path> to the command line
|
||||
# define V8_OS_ANDROID 1
|
||||
# define V8_OS_LINUX 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "android"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define V8_OS_BSD 1
|
||||
# define V8_OS_MACOSX 1
|
||||
# define V8_OS_POSIX 1
|
||||
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
# define V8_OS_IOS 1
|
||||
# define V8_OS_STRING "ios"
|
||||
# else
|
||||
# define V8_OS_STRING "macos"
|
||||
# endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define V8_OS_CYGWIN 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "cygwin"
|
||||
|
||||
#elif defined(__linux__)
|
||||
# define V8_OS_LINUX 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "linux"
|
||||
|
||||
#elif defined(__sun)
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_SOLARIS 1
|
||||
# define V8_OS_STRING "sun"
|
||||
|
||||
#elif defined(STARBOARD)
|
||||
# define V8_OS_STARBOARD 1
|
||||
# define V8_OS_STRING "starboard"
|
||||
|
||||
#elif defined(_AIX)
|
||||
#define V8_OS_POSIX 1
|
||||
#define V8_OS_AIX 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_AIX 1
|
||||
# define V8_OS_STRING "aix"
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
# define V8_OS_BSD 1
|
||||
# define V8_OS_FREEBSD 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "freebsd"
|
||||
|
||||
#elif defined(__Fuchsia__)
|
||||
# define V8_OS_FUCHSIA 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "fuchsia"
|
||||
|
||||
#elif defined(__DragonFly__)
|
||||
# define V8_OS_BSD 1
|
||||
# define V8_OS_DRAGONFLYBSD 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "dragonflybsd"
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
# define V8_OS_BSD 1
|
||||
# define V8_OS_NETBSD 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "netbsd"
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
# define V8_OS_BSD 1
|
||||
# define V8_OS_OPENBSD 1
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_STRING "openbsd"
|
||||
|
||||
#elif defined(__QNXNTO__)
|
||||
# define V8_OS_POSIX 1
|
||||
# define V8_OS_QNX 1
|
||||
# define V8_OS_STRING "qnx"
|
||||
|
||||
#elif defined(_WIN32)
|
||||
# define V8_OS_WIN 1
|
||||
# define V8_OS_STRING "windows"
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -195,6 +224,22 @@ path. Add it with -I<path> to the command line
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
#if defined(V8_TARGET_OS_ANDROID)
|
||||
# define V8_TARGET_OS_STRING "android"
|
||||
#elif defined(V8_TARGET_OS_FUCHSIA)
|
||||
# define V8_TARGET_OS_STRING "fuchsia"
|
||||
#elif defined(V8_TARGET_OS_IOS)
|
||||
# define V8_TARGET_OS_STRING "ios"
|
||||
#elif defined(V8_TARGET_OS_LINUX)
|
||||
# define V8_TARGET_OS_STRING "linux"
|
||||
#elif defined(V8_TARGET_OS_MACOSX)
|
||||
# define V8_TARGET_OS_STRING "macos"
|
||||
#elif defined(V8_TARGET_OS_WINDOWS)
|
||||
# define V8_TARGET_OS_STRING "windows"
|
||||
#else
|
||||
# define V8_TARGET_OS_STRING "unknown"
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
//
|
||||
|
13
src/d8/d8.cc
13
src/d8/d8.cc
@ -2841,19 +2841,8 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
|
||||
Local<ObjectTemplate> Shell::CreateOSTemplate(Isolate* isolate) {
|
||||
Local<ObjectTemplate> os_template = ObjectTemplate::New(isolate);
|
||||
AddOSMethods(isolate, os_template);
|
||||
#if defined(V8_TARGET_OS_LINUX)
|
||||
const char os_name[] = "linux";
|
||||
#elif defined(V8_TARGET_OS_WIN)
|
||||
const char os_name[] = "windows";
|
||||
#elif defined(V8_TARGET_OS_MACOSX)
|
||||
const char os_name[] = "macos";
|
||||
#elif defined(V8_TARGET_OS_ANDROID)
|
||||
const char os_name[] = "android";
|
||||
#else
|
||||
const char os_name[] = "unknown";
|
||||
#endif
|
||||
os_template->Set(isolate, "name",
|
||||
v8::String::NewFromUtf8Literal(isolate, os_name),
|
||||
v8::String::NewFromUtf8Literal(isolate, V8_TARGET_OS_STRING),
|
||||
PropertyAttribute::ReadOnly);
|
||||
os_template->Set(
|
||||
isolate, "d8Path",
|
||||
|
@ -66,6 +66,8 @@ void Log::WriteLogHeader() {
|
||||
}
|
||||
msg << kNext << Version::IsCandidate();
|
||||
msg.WriteToLogFile();
|
||||
msg << "v8-platform" << kNext << V8_OS_STRING << kNext << V8_TARGET_OS_STRING;
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
std::unique_ptr<Log::MessageBuilder> Log::NewMessageBuilder() {
|
||||
|
@ -974,6 +974,7 @@ void Profiler::Engage() {
|
||||
LOG(isolate_, SharedLibraryEvent(address.library_path, address.start,
|
||||
address.end, address.aslr_slide));
|
||||
}
|
||||
LOG(isolate_, SharedLibraryEnd());
|
||||
|
||||
// Start thread processing the profiler buffer.
|
||||
base::Relaxed_Store(&running_, 1);
|
||||
@ -983,7 +984,7 @@ void Profiler::Engage() {
|
||||
Logger* logger = isolate_->logger();
|
||||
logger->ticker_->SetProfiler(this);
|
||||
|
||||
logger->ProfilerBeginEvent();
|
||||
LOG(isolate_, ProfilerBeginEvent());
|
||||
}
|
||||
|
||||
void Profiler::Disengage() {
|
||||
@ -1093,6 +1094,13 @@ void Logger::SharedLibraryEvent(const std::string& library_path,
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
void Logger::SharedLibraryEnd() {
|
||||
if (!FLAG_prof_cpp) return;
|
||||
MSG_BUILDER();
|
||||
msg << "shared-library-end";
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
void Logger::CurrentTimeEvent() {
|
||||
DCHECK(FLAG_log_internal_timer_events);
|
||||
MSG_BUILDER();
|
||||
|
@ -258,6 +258,7 @@ class Logger : public CodeEventListener {
|
||||
|
||||
void SharedLibraryEvent(const std::string& library_path, uintptr_t start,
|
||||
uintptr_t end, intptr_t aslr_slide);
|
||||
void SharedLibraryEnd();
|
||||
|
||||
void CurrentTimeEvent();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user