mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
tracy
This commit is contained in:
parent
40a586e368
commit
44e3538d67
3 changed files with 13 additions and 2 deletions
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name raytracer)
|
(name raytracer)
|
||||||
(libraries moonpool unix))
|
(libraries moonpool unix tracy-client))
|
||||||
|
|
|
||||||
|
|
@ -265,15 +265,24 @@ let progress_thread (st : state) : Thread.t =
|
||||||
in
|
in
|
||||||
Moonpool.start_thread_on_some_domain run ()
|
Moonpool.start_thread_on_some_domain run ()
|
||||||
|
|
||||||
|
let tracy_plot st =
|
||||||
|
Tracy.plot "done" (float_of_int @@ Atomic.get st.n_done);
|
||||||
|
Tracy.plot "waiting" (float_of_int @@ Atomic.get st.n_waiting);
|
||||||
|
()
|
||||||
|
|
||||||
(** background thread that writes the results sequentially into the file *)
|
(** background thread that writes the results sequentially into the file *)
|
||||||
let writer_thread (st : state) oc : Thread.t =
|
let writer_thread (st : state) oc : Thread.t =
|
||||||
let run () : unit =
|
let run () : unit =
|
||||||
|
let@ _sp =
|
||||||
|
Tracy.with_ ~line:__LINE__ ~file:__FILE__ ~name:"wait-next-res" ()
|
||||||
|
in
|
||||||
while not (Queue.is_empty st.results) do
|
while not (Queue.is_empty st.results) do
|
||||||
let r = Queue.pop st.results in
|
let r = Queue.pop st.results in
|
||||||
match r with
|
match r with
|
||||||
| Pixel r ->
|
| Pixel r ->
|
||||||
Atomic.incr st.n_done;
|
Atomic.incr st.n_done;
|
||||||
Atomic.decr st.n_waiting;
|
Atomic.decr st.n_waiting;
|
||||||
|
tracy_plot st;
|
||||||
|
|
||||||
let ir, ig, ib = Fut.wait_block_exn r in
|
let ir, ig, ib = Fut.wait_block_exn r in
|
||||||
fpf oc "%d " ir;
|
fpf oc "%d " ir;
|
||||||
|
|
@ -325,6 +334,7 @@ let run (config : config) =
|
||||||
let rst = RS.split rst in
|
let rst = RS.split rst in
|
||||||
|
|
||||||
let run () =
|
let run () =
|
||||||
|
let@ _sp = Tracy.with_ ~line:__LINE__ ~file:__FILE__ ~name:"pixel" () in
|
||||||
let color = ref { x = 0.; y = 0.; z = 0. } in
|
let color = ref { x = 0.; y = 0.; z = 0. } in
|
||||||
for _step = 0 to config.ns - 1 do
|
for _step = 0 to config.ns - 1 do
|
||||||
(* NOTE: Random.float is bounds __inclusive__ *)
|
(* NOTE: Random.float is bounds __inclusive__ *)
|
||||||
|
|
@ -371,6 +381,7 @@ let run (config : config) =
|
||||||
Thread.join t_writer
|
Thread.join t_writer
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
|
Tracy.enable ();
|
||||||
let nx = ref 400 in
|
let nx = ref 400 in
|
||||||
let ny = ref 200 in
|
let ny = ref 200 in
|
||||||
let ns = ref 150 in
|
let ns = ref 150 in
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
DUNE_OPTS="--profile=release --display=quiet"
|
DUNE_OPTS="--profile=release --display=quiet"
|
||||||
exec dune exec $DUNE_OPTS benchs/raytracer/raytracer.exe -- $@
|
sudo dune exec $DUNE_OPTS benchs/raytracer/raytracer.exe -- $@
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue