package trace-fuchsia
A high-performance backend for trace, emitting a Fuchsia trace into a file
Install
Dune Dependency
Authors
Maintainers
Sources
trace-0.6.tbz
sha256=97cc4159b96429adc01a84bff1ed34b8f06746bc56a40a214a6306036be2df38
sha512=6a67ea9ddeebb4b93a0b8dba9ed26d95e786722d08fd9ca7d8e2db7651a9b9d6ccc63cc437b4eb71c28b3ec51838716a84707a8d366abb595f32a5e65035e28b
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)"
>