OLD | NEW |
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 }; | 122 }; |
123 | 123 |
124 | 124 |
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 = new 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 delete[] filename; |
139 } | 139 } |
140 | 140 |
141 ~PerfCodeObserver() { | 141 ~PerfCodeObserver() { |
142 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); | 142 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 | 525 |
526 | 526 |
527 void OS::Exit(int code) { | 527 void OS::Exit(int code) { |
528 exit(code); | 528 exit(code); |
529 } | 529 } |
530 | 530 |
531 } // namespace dart | 531 } // namespace dart |
532 | 532 |
533 #endif // defined(TARGET_OS_LINUX) | 533 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |