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

Unified Diff: src/log-utils.cc

Issue 3831002: Support profiling based on linux kernel performance events. (Closed)
Patch Set: More fixes Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log-utils.h ('k') | src/platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log-utils.cc
diff --git a/src/log-utils.cc b/src/log-utils.cc
index 62f0ca62f41300ac71073034a2291f71738e87ed..c3aeb0a1ed6c67ec0f1a56318f5d50be7a3af830 100644
--- a/src/log-utils.cc
+++ b/src/log-utils.cc
@@ -122,6 +122,7 @@ int LogDynamicBuffer::WriteInternal(const char* data, int data_size) {
bool Log::is_stopped_ = false;
Log::WritePtr Log::Write = NULL;
FILE* Log::output_handle_ = NULL;
+FILE* Log::output_code_handle_ = NULL;
LogDynamicBuffer* Log::output_buffer_ = NULL;
// Must be the same message as in Logger::PauseProfiler.
const char* Log::kDynamicBufferSeal = "profiler,\"pause\"\n";
@@ -143,9 +144,21 @@ void Log::OpenStdout() {
}
+static const char kCodeLogExt[] = ".code";
+
+
void Log::OpenFile(const char* name) {
ASSERT(!IsEnabled());
output_handle_ = OS::FOpen(name, OS::LogFileOpenMode);
+ if (FLAG_ll_prof) {
+ // Open a file for logging the contents of code objects so that
+ // they can be disassembled later.
+ size_t name_len = strlen(name);
+ ScopedVector<char> code_name(name_len + sizeof(kCodeLogExt));
+ memcpy(code_name.start(), name, name_len);
+ memcpy(code_name.start() + name_len, kCodeLogExt, sizeof(kCodeLogExt));
+ output_code_handle_ = OS::FOpen(code_name.start(), OS::LogFileOpenMode);
+ }
Write = WriteToFile;
Init();
}
@@ -165,6 +178,8 @@ void Log::Close() {
if (Write == WriteToFile) {
if (output_handle_ != NULL) fclose(output_handle_);
output_handle_ = NULL;
+ if (output_code_handle_ != NULL) fclose(output_code_handle_);
+ output_code_handle_ = NULL;
} else if (Write == WriteToMemory) {
delete output_buffer_;
output_buffer_ = NULL;
« no previous file with comments | « src/log-utils.h ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698