OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/utils.h" | 5 #include "platform/utils.h" |
6 | 6 |
7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
8 #include "vm/atomic.h" | 8 #include "vm/atomic.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1578 file_write(buffer->buf(), buffer->length(), f); | 1578 file_write(buffer->buf(), buffer->length(), f); |
1579 file_close(f); | 1579 file_close(f); |
1580 } | 1580 } |
1581 | 1581 |
1582 | 1582 |
1583 IsolateProfilerData::IsolateProfilerData(SampleBuffer* sample_buffer, | 1583 IsolateProfilerData::IsolateProfilerData(SampleBuffer* sample_buffer, |
1584 bool own_sample_buffer) { | 1584 bool own_sample_buffer) { |
1585 ASSERT(sample_buffer != NULL); | 1585 ASSERT(sample_buffer != NULL); |
1586 sample_buffer_ = sample_buffer; | 1586 sample_buffer_ = sample_buffer; |
1587 own_sample_buffer_ = own_sample_buffer; | 1587 own_sample_buffer_ = own_sample_buffer; |
1588 block_count_ = 0; | |
1588 } | 1589 } |
1589 | 1590 |
1590 | 1591 |
1591 IsolateProfilerData::~IsolateProfilerData() { | 1592 IsolateProfilerData::~IsolateProfilerData() { |
1592 if (own_sample_buffer_) { | 1593 if (own_sample_buffer_) { |
1593 delete sample_buffer_; | 1594 delete sample_buffer_; |
1594 sample_buffer_ = NULL; | 1595 sample_buffer_ = NULL; |
1595 own_sample_buffer_ = false; | 1596 own_sample_buffer_ = false; |
1596 } | 1597 } |
1597 } | 1598 } |
1598 | 1599 |
1599 | 1600 |
1601 void IsolateProfilerData::Block() { | |
1602 block_count_++; | |
1603 } | |
1604 | |
1605 | |
1606 void IsolateProfilerData::Unblock() { | |
1607 block_count_--; | |
Ivan Posva
2014/05/25 12:25:16
ASSERT that you are not over unblocking.
Cutch
2014/05/26 06:59:35
Added a FATAL.
| |
1608 if (!blocked()) { | |
1609 // We just unblocked this isolate, wake up the thread interrupter. | |
1610 ThreadInterrupter::WakeUp(); | |
1611 } | |
1612 } | |
1613 | |
1614 | |
1600 Sample* SampleBuffer::ReserveSample() { | 1615 Sample* SampleBuffer::ReserveSample() { |
1601 ASSERT(samples_ != NULL); | 1616 ASSERT(samples_ != NULL); |
1602 uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_); | 1617 uintptr_t cursor = AtomicOperations::FetchAndIncrement(&cursor_); |
1603 // Map back into sample buffer range. | 1618 // Map back into sample buffer range. |
1604 cursor = cursor % capacity_; | 1619 cursor = cursor % capacity_; |
1605 return At(cursor); | 1620 return At(cursor); |
1606 } | 1621 } |
1607 | 1622 |
1608 | 1623 |
1609 class ProfilerDartStackWalker : public ValueObject { | 1624 class ProfilerDartStackWalker : public ValueObject { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 ProfilerDartStackWalker stackWalker(sample); | 1846 ProfilerDartStackWalker stackWalker(sample); |
1832 stackWalker.walk(); | 1847 stackWalker.walk(); |
1833 } else { | 1848 } else { |
1834 // TODO(johnmccutchan): Support collecting only Dart frames with | 1849 // TODO(johnmccutchan): Support collecting only Dart frames with |
1835 // ProfilerNativeStackWalker. | 1850 // ProfilerNativeStackWalker. |
1836 } | 1851 } |
1837 } | 1852 } |
1838 } | 1853 } |
1839 | 1854 |
1840 } // namespace dart | 1855 } // namespace dart |
OLD | NEW |