Skip to content

Instantly share code, notes, and snippets.

long start = System.currentTimeMillis();
while (true) {
int n = inputStream.read(buffer, 0, size - bytesRead);
if (n == -1) {
long msSinceStart = System.currentTimeMillis() - start;
if (waitForData && msSinceStart < TIMEOUT) {
pause();
} else {
throw new IOException("Unable to read trace data");
}

Keybase proof

I hereby claim:

  • I am leland-takamine on github.
  • I am leland (https://keybase.io/leland) on keybase.
  • I have a public key ASDMAfSygt7uW2rNSpxYkmq_InQ_JSR6orQxSQUmwYchIAo

To claim this, I am signing this object:

; TR = thread register
; MR = method register
; data_ptr = temp register
; timestamp = temp register
VisitTraceStart:
LDR data_ptr, [TR, data_ptr_offset] ; data_ptr = thread.data_ptr
CBZ data_ptr, done ; if (data_ptr != null)
MRS timestamp, SYS_CNTVCT_EL0 ; timestamp = <Generic Timer count>
STR MR, [data_ptr], +8 ; *data_ptr++ = method
void Thread::TraceStart(ArtMethod* method) {
if (LIKELY(tlsPtr_.trace_data_ptr != nullptr)) {
*tlsPtr_.trace_data_ptr++ = reinterpret_cast<int64_t>(method);
*tlsPtr_.trace_data_ptr++ = generic_timer_count();
}
}
void Thread::TraceEnd(ArtMethod* method) {
if (LIKELY(tlsPtr_.trace_data_ptr != nullptr)) {
*tlsPtr_.trace_data_ptr++ = 0;
static inline JValue Execute(Thread* self, ...) {
self->TraceStart(method);
… // Method execution logic
self->TraceEnd(method);
}
@Leland-Takamine
Leland-Takamine / SortTest.java
Last active June 19, 2016 04:46
Test to demonstrate unexpected sorting behavior in CoordinatorLayout.
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
/**