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

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

Issue 2750843003: Rename TARGET_OS_* to HOST_OS_*. (Closed)
Patch Set: DEPS Created 3 years, 9 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
« no previous file with comments | « runtime/vm/thread_interrupter_win.cc ('k') | runtime/vm/virtual_memory_android.cc » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 #ifndef PRODUCT 5 #ifndef PRODUCT
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <cstdlib> 9 #include <cstdlib>
10 10
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 void TimelineEventFixedBufferRecorder::CompleteEvent(TimelineEvent* event) { 1368 void TimelineEventFixedBufferRecorder::CompleteEvent(TimelineEvent* event) {
1369 if (event == NULL) { 1369 if (event == NULL) {
1370 return; 1370 return;
1371 } 1371 }
1372 ThreadBlockCompleteEvent(event); 1372 ThreadBlockCompleteEvent(event);
1373 } 1373 }
1374 1374
1375 1375
1376 TimelineEventSystraceRecorder::TimelineEventSystraceRecorder(intptr_t capacity) 1376 TimelineEventSystraceRecorder::TimelineEventSystraceRecorder(intptr_t capacity)
1377 : TimelineEventFixedBufferRecorder(capacity), systrace_fd_(-1) { 1377 : TimelineEventFixedBufferRecorder(capacity), systrace_fd_(-1) {
1378 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_LINUX) 1378 #if defined(HOST_OS_ANDROID) || defined(HOST_OS_LINUX)
1379 const char* kSystracePath = "/sys/kernel/debug/tracing/trace_marker"; 1379 const char* kSystracePath = "/sys/kernel/debug/tracing/trace_marker";
1380 systrace_fd_ = open(kSystracePath, O_WRONLY); 1380 systrace_fd_ = open(kSystracePath, O_WRONLY);
1381 if ((systrace_fd_ < 0) && FLAG_trace_timeline) { 1381 if ((systrace_fd_ < 0) && FLAG_trace_timeline) {
1382 OS::PrintErr("TimelineEventSystraceRecorder: Could not open `%s`\n", 1382 OS::PrintErr("TimelineEventSystraceRecorder: Could not open `%s`\n",
1383 kSystracePath); 1383 kSystracePath);
1384 } 1384 }
1385 #else 1385 #else
1386 OS::PrintErr( 1386 OS::PrintErr(
1387 "Warning: The systrace timeline recorder is equivalent to the" 1387 "Warning: The systrace timeline recorder is equivalent to the"
1388 "ring recorder on this platform."); 1388 "ring recorder on this platform.");
1389 #endif 1389 #endif
1390 } 1390 }
1391 1391
1392 1392
1393 TimelineEventSystraceRecorder::~TimelineEventSystraceRecorder() { 1393 TimelineEventSystraceRecorder::~TimelineEventSystraceRecorder() {
1394 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_LINUX) 1394 #if defined(HOST_OS_ANDROID) || defined(HOST_OS_LINUX)
1395 if (systrace_fd_ >= 0) { 1395 if (systrace_fd_ >= 0) {
1396 close(systrace_fd_); 1396 close(systrace_fd_);
1397 } 1397 }
1398 #endif 1398 #endif
1399 } 1399 }
1400 1400
1401 1401
1402 TimelineEventBlock* TimelineEventSystraceRecorder::GetNewBlockLocked() { 1402 TimelineEventBlock* TimelineEventSystraceRecorder::GetNewBlockLocked() {
1403 // TODO(johnmccutchan): This function should only hand out blocks 1403 // TODO(johnmccutchan): This function should only hand out blocks
1404 // which have been marked as finished. 1404 // which have been marked as finished.
1405 if (block_cursor_ == num_blocks_) { 1405 if (block_cursor_ == num_blocks_) {
1406 block_cursor_ = 0; 1406 block_cursor_ = 0;
1407 } 1407 }
1408 TimelineEventBlock* block = blocks_[block_cursor_++]; 1408 TimelineEventBlock* block = blocks_[block_cursor_++];
1409 block->Reset(); 1409 block->Reset();
1410 block->Open(); 1410 block->Open();
1411 return block; 1411 return block;
1412 } 1412 }
1413 1413
1414 1414
1415 void TimelineEventSystraceRecorder::CompleteEvent(TimelineEvent* event) { 1415 void TimelineEventSystraceRecorder::CompleteEvent(TimelineEvent* event) {
1416 if (event == NULL) { 1416 if (event == NULL) {
1417 return; 1417 return;
1418 } 1418 }
1419 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_LINUX) 1419 #if defined(HOST_OS_ANDROID) || defined(HOST_OS_LINUX)
1420 if (systrace_fd_ >= 0) { 1420 if (systrace_fd_ >= 0) {
1421 // Serialize to the systrace format. 1421 // Serialize to the systrace format.
1422 const intptr_t kBufferLength = 1024; 1422 const intptr_t kBufferLength = 1024;
1423 char buffer[kBufferLength]; 1423 char buffer[kBufferLength];
1424 const intptr_t event_length = 1424 const intptr_t event_length =
1425 event->PrintSystrace(&buffer[0], kBufferLength); 1425 event->PrintSystrace(&buffer[0], kBufferLength);
1426 if (event_length > 0) { 1426 if (event_length > 0) {
1427 ssize_t __result; 1427 ssize_t __result;
1428 // Repeatedly attempt the write while we are being interrupted. 1428 // Repeatedly attempt the write while we are being interrupted.
1429 do { 1429 do {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 TimelineEventBlock* TimelineEventBlockIterator::Next() { 1774 TimelineEventBlock* TimelineEventBlockIterator::Next() {
1775 ASSERT(current_ != NULL); 1775 ASSERT(current_ != NULL);
1776 TimelineEventBlock* r = current_; 1776 TimelineEventBlock* r = current_;
1777 current_ = current_->next(); 1777 current_ = current_->next();
1778 return r; 1778 return r;
1779 } 1779 }
1780 1780
1781 } // namespace dart 1781 } // namespace dart
1782 1782
1783 #endif // !PRODUCT 1783 #endif // !PRODUCT
OLDNEW
« no previous file with comments | « runtime/vm/thread_interrupter_win.cc ('k') | runtime/vm/virtual_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698