Image noise/OCaml/Xlib: Difference between revisions

m
moved Image Noise/OCaml/Xlib to Image noise/OCaml/Xlib: capitalization policy
m (just a comment)
m (moved Image Noise/OCaml/Xlib to Image noise/OCaml/Xlib: capitalization policy)
 
(4 intermediate revisions by one other user not shown)
Line 1:
{{libheader|OCaml-Xlib}}
 
By default this program displays the noise with double buffering.
The command-line options <code>-single</code> selects the single buffering.
 
Launch this program as a script with:
ocaml -I +Xlib Xlib.cma unix.cma noise_fps_x.ml
ocaml -I +Xlib Xlib.cma unix.cma noise_fps_x.ml -single
 
<lang ocaml>open Xlib
Line 131 ⟶ 138:
done;
 
(* tell what was the FPS for num_frames frames *)
let t_end = Unix.gettimeofday() in
let fps = (float num_frames) /. (t_end -. t0) in
Line 136 ⟶ 144:
print_float fps;
print_newline()</lang>
 
You can also compile this program to native-code with the following command:
:$ ocamlopt -I +Xlib Xlib.cmxa unix.cmxa noise_fps_x.ml -o noise_fps_x.opt
 
and then execute the result with:
:$ ./noise_fps_x.opt
Anonymous user