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

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

Issue 24255013: - Write the coverage data to a file instead of printing to stdout. (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
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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-%ld.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 = Isolate::Current()->current_zone()->Alloc<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 } 138 }
139 139
140 ~PerfCodeObserver() { 140 ~PerfCodeObserver() {
141 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 141 Dart_FileCloseCallback file_close = Isolate::file_close_callback();
142 if (file_close == NULL) { 142 if (file_close == NULL) {
143 return; 143 return;
144 } 144 }
145 ASSERT(out_file_ != NULL); 145 ASSERT(out_file_ != NULL);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 private: 266 private:
267 DISALLOW_COPY_AND_ASSIGN(GdbCodeObserver); 267 DISALLOW_COPY_AND_ASSIGN(GdbCodeObserver);
268 }; 268 };
269 269
270 270
271 const char* OS::Name() { 271 const char* OS::Name() {
272 return "linux"; 272 return "linux";
273 } 273 }
274 274
275 275
276 intptr_t OS::ProcessId() {
277 return static_cast<intptr_t>(getpid());
278 }
279
280
276 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { 281 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
277 time_t seconds = static_cast<time_t>(seconds_since_epoch); 282 time_t seconds = static_cast<time_t>(seconds_since_epoch);
278 if (seconds != seconds_since_epoch) return false; 283 if (seconds != seconds_since_epoch) return false;
279 struct tm* error_code = localtime_r(&seconds, tm_result); 284 struct tm* error_code = localtime_r(&seconds, tm_result);
280 return error_code != NULL; 285 return error_code != NULL;
281 } 286 }
282 287
283 288
284 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { 289 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
285 tm decomposed; 290 tm decomposed;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 523 }
519 524
520 525
521 void OS::Exit(int code) { 526 void OS::Exit(int code) {
522 exit(code); 527 exit(code);
523 } 528 }
524 529
525 } // namespace dart 530 } // namespace dart
526 531
527 #endif // defined(TARGET_OS_LINUX) 532 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« runtime/vm/json_stream.h ('K') | « runtime/vm/os_android.cc ('k') | runtime/vm/os_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698