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

Unified Diff: bin/run_vm_tests.cc

Issue 10643003: Add pprof symbol generation option to run_vm_tests so that we can use pprof in the vm benchmark fra… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/run_vm_tests.cc
===================================================================
--- bin/run_vm_tests.cc (revision 8960)
+++ bin/run_vm_tests.cc (working copy)
@@ -4,6 +4,8 @@
#include <stdio.h>
+#include "bin/file.h"
+
#include "vm/benchmark_test.h"
#include "vm/dart.h"
#include "vm/unit_test.h"
@@ -57,6 +59,29 @@
}
+static void DumpPprofSymbolInfo(const char* pprof_filename) {
+ if (pprof_filename != NULL) {
+ char* err = NULL;
+ Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err);
+ EXPECT(isolate != NULL);
+ Dart_EnterScope();
+ File* pprof_file =
+ File::Open(pprof_filename, File::kWriteTruncate);
+ ASSERT(pprof_file != NULL);
+ void* buffer;
+ int buffer_size;
+ Dart_GetPprofSymbolInfo(&buffer, &buffer_size);
+ if (buffer_size > 0) {
+ ASSERT(buffer != NULL);
+ pprof_file->WriteFully(buffer, buffer_size);
+ }
+ delete pprof_file; // Closes the file.
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ }
+}
+
+
static void PrintUsage() {
fprintf(stderr, "run_vm_tests [--list | --benchmarks | "
"--tests | --all | <test name> | <benchmark name>]\n");
@@ -69,6 +94,7 @@
// Flags being passed to the Dart VM.
int dart_argc = 0;
const char** dart_argv = NULL;
+ const char* pprof_filename = NULL;
if (argc < 2) {
// Bad parameter count.
@@ -93,9 +119,19 @@
} else {
// First argument is the test name, the rest are vm flags.
run_filter = argv[1];
- // Remove the first two values from the arguments.
- dart_argc = argc - 2;
- dart_argv = &argv[2];
+ const char* pprof_option = "--generate_pprof_symbols=";
+ int length = strlen(pprof_option);
+ if (strncmp(pprof_option, argv[2], length) == 0) {
+ pprof_filename = (argv[2] + length);
+ Dart_InitPprofSupport();
+ // Remove the first three values from the arguments.
+ dart_argc = argc - 3;
+ dart_argv = &argv[3];
+ } else {
+ // Remove the first two values from the arguments.
+ dart_argc = argc - 2;
+ dart_argv = &argv[2];
+ }
}
bool set_vm_flags_success = Flags::ProcessCommandLineFlags(dart_argc,
dart_argv);
@@ -111,6 +147,8 @@
fprintf(stderr, "No tests matched: %s\n", run_filter);
return 1;
}
+ // Dump symbol information for the profiler.
+ DumpPprofSymbolInfo(pprof_filename);
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698