Commit 1ee700c4 authored by Sven Panne's avatar Sven Panne

Log V8 version in profiler log file

Patch from issue 800293002 authored by ben@strongloop.com

TBR=yangguo@chromium.org

Review URL: https://codereview.chromium.org/806143002

Cr-Commit-Position: refs/heads/master@{#25835}
parent 54a31b62
......@@ -6,6 +6,7 @@
#include "src/log-utils.h"
#include "src/string-stream.h"
#include "src/version.h"
namespace v8 {
namespace internal {
......@@ -49,6 +50,14 @@ void Log::Initialize(const char* log_file_name) {
} else {
OpenFile(log_file_name);
}
if (output_handle_ != nullptr) {
Log::MessageBuilder msg(this);
msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(),
Version::GetMinor(), Version::GetBuild(), Version::GetPatch(),
Version::IsCandidate());
msg.WriteToLogFile();
}
}
}
......
......@@ -42,6 +42,7 @@
#include "src/natives.h"
#include "src/utils.h"
#include "src/v8threads.h"
#include "src/version.h"
#include "src/vm-state-inl.h"
#include "test/cctest/cctest.h"
......@@ -507,3 +508,23 @@ TEST(EquivalenceOfLoggingAndTraversal) {
}
isolate->Dispose();
}
TEST(LogVersion) {
v8::Isolate* isolate;
{
ScopedLoggerInitializer initialize_logger;
isolate = initialize_logger.isolate();
bool exists = false;
i::Vector<const char> log(
i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
CHECK(exists);
i::EmbeddedVector<char, 100> ref_data;
i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(),
i::Version::GetMinor(), i::Version::GetBuild(),
i::Version::GetPatch(), i::Version::IsCandidate());
CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
}
isolate->Dispose();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment