package trace-fuchsia
A high-performance backend for trace, emitting a Fuchsia trace into a file
Install
Dune Dependency
Authors
Maintainers
Sources
trace-0.8.tbz
sha256=34cfa5662b611c1e246f0fb8131ee605eeb90b359c105e882f51adc7e70878c3
sha512=ea47974a77a0ab26c58fe6d1bc898d4f3e6a5f865e4c1acb4188b9acd7ba8e7527d0ea7f2ae66574ceccc14f11127ee203aedba2be334d17b36c83dabff61261
doc/src/trace-fuchsia.write/buf.ml.html
Source file buf.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
open Util type t = { buf: bytes; mutable offset: int; } let empty : t = { buf = Bytes.empty; offset = 0 } let create (n : int) : t = let buf = Bytes.create (round_to_word n) in { buf; offset = 0 } let[@inline] clear self = self.offset <- 0 let[@inline] available self = Bytes.length self.buf - self.offset let[@inline] size self = self.offset (* see below: we assume little endian *) let () = assert (not Sys.big_endian) let[@inline] add_i64 (self : t) (i : int64) : unit = (* NOTE: we use LE, most systems are this way, even though fuchsia says we should use the system's native endianess *) Bytes.set_int64_le self.buf self.offset i; self.offset <- self.offset + 8 let[@inline] add_string (self : t) (s : string) : unit = let len = String.length s in let missing = missing_to_round len in (* bound check *) Bytes.blit_string s 0 self.buf self.offset len; self.offset <- self.offset + len; (* add 0-padding *) if missing != 0 then ( Bytes.unsafe_fill self.buf self.offset missing '\x00'; self.offset <- self.offset + missing ) let to_string (self : t) : string = Bytes.sub_string self.buf 0 self.offset
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>