package trace-fuchsia
A high-performance backend for trace, emitting a Fuchsia trace into a file
Install
Dune Dependency
Authors
Maintainers
Sources
trace-0.9.tbz
sha256=1a8c75efea8a691f1e0fa3dcf59ee0bf53fad7190b9fa0babde4f9a21bc10dd6
sha512=a082b3cbf34631069855bef7b8cf5017daf08141f8794dc0ef963e7afe0812749c388553fa3d21ecb35ce75909571dfd8fc38bcc4438b7eaaa9010296f28e2fc
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)"
>