package trace
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A stub for tracing/observability, agnostic in how data is collected
Install
dune-project
Dependency
Authors
Maintainers
Sources
trace-0.10.1.tbz
sha256=0b5121a2b3ca0f0d850017865333259f313ce83f77bba54da956f9cafbba6e34
sha512=06476b3b450d3f382ba7e5287591e2bb0f928d38b698af0bd6083d1518fcac93bf498815710d26ecbe9c80c71888638919c0166a79e447ee64ed625afd56dc4b
doc/src/trace_private_util/rpool.ml.html
Source file rpool.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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67open struct module A = Trace_core.Internal_.Atomic_ end module List_with_len = struct type +'a t = | Nil | Cons of int * 'a * 'a t let empty : _ t = Nil let[@inline] len = function | Nil -> 0 | Cons (i, _, _) -> i let[@inline] cons x self = Cons (len self + 1, x, self) end type 'a t = { max_size: int; create: unit -> 'a; clear: 'a -> unit; cached: 'a List_with_len.t A.t; } let create ~max_size ~create ~clear () : _ t = { max_size; create; clear; cached = A.make List_with_len.empty } let alloc (type a) (self : a t) : a = let module M = struct exception Found of a end in try while match A.get self.cached with | Nil -> false | Cons (_, x, tl) as old -> if A.compare_and_set self.cached old tl then raise_notrace (M.Found x) else true do () done; self.create () with M.Found x -> x let recycle (self : 'a t) (x : 'a) : unit = self.clear x; while match A.get self.cached with | Cons (i, _, _) when i >= self.max_size -> false (* drop buf *) | old -> not (A.compare_and_set self.cached old (List_with_len.cons x old)) do () done let with_ (self : 'a t) f = let x = alloc self in try let res = f x in recycle self x; res with e -> let bt = Printexc.get_raw_backtrace () in recycle self x; Printexc.raise_with_backtrace e bt
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>