package runtime import "unsafe" // tracePuts and traceU64 write an instrumented build's counters to a file // descriptor. The alloc_trace and cover runtimes both dump "site count" lines // that a host or a reporter reads back, so the writers live here rather than // once per instrumented runtime. // // An untagged build carries them unreferenced and the linker drops them. func tracePuts(fd int32, s string) { if len(s) == 0 { return } MoxieWrite(fd, unsafe.Pointer(&([]byte(s))[0]), int32(len(s))) } func traceU64(fd int32, v uint64) { buf := []byte{:24} i := int32(24) if v == 0 { i-- buf[i] = '0' } for v > 0 { i-- buf[i] = byte(v%10) + '0' v = v / 10 } MoxieWrite(fd, unsafe.Pointer(&buf[i]), 24-i) }