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

Side by Side Diff: runtime/vm/os_linux.cc

Issue 24364002: Fix Linux perf profiling support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 class PerfCodeObserver : public CodeObserver { 125 class PerfCodeObserver : public CodeObserver {
126 public: 126 public:
127 PerfCodeObserver() { 127 PerfCodeObserver() {
128 Dart_FileOpenCallback file_open = Isolate::file_open_callback(); 128 Dart_FileOpenCallback file_open = Isolate::file_open_callback();
129 if (file_open == NULL) { 129 if (file_open == NULL) {
130 return; 130 return;
131 } 131 }
132 const char* format = "/tmp/perf-%"Pd".map"; 132 const char* format = "/tmp/perf-%"Pd".map";
133 intptr_t pid = getpid(); 133 intptr_t pid = getpid();
134 intptr_t len = OS::SNPrint(NULL, 0, format, pid); 134 intptr_t len = OS::SNPrint(NULL, 0, format, pid);
135 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 135 char* filename = new char[len + 1];
136 OS::SNPrint(filename, len + 1, format, pid); 136 OS::SNPrint(filename, len + 1, format, pid);
137 out_file_ = (*file_open)(filename, true); 137 out_file_ = (*file_open)(filename, true);
138 delete[] filename;
138 } 139 }
139 140
140 ~PerfCodeObserver() { 141 ~PerfCodeObserver() {
141 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 142 Dart_FileCloseCallback file_close = Isolate::file_close_callback();
142 if (file_close == NULL) { 143 if (file_close == NULL) {
143 return; 144 return;
144 } 145 }
145 ASSERT(out_file_ != NULL); 146 ASSERT(out_file_ != NULL);
146 (*file_close)(out_file_); 147 (*file_close)(out_file_);
147 } 148 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 524 }
524 525
525 526
526 void OS::Exit(int code) { 527 void OS::Exit(int code) {
527 exit(code); 528 exit(code);
528 } 529 }
529 530
530 } // namespace dart 531 } // namespace dart
531 532
532 #endif // defined(TARGET_OS_LINUX) 533 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« 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