time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

makefile (1117B)


      1 # Compiler
      2 OC=ocamlopt
      3 # ocamlopt: platform-specific, faster
      4 # ocamlc: platform-independent intermediate representation, run with ocamlrun
      5 FAST=-O3 -unsafe # install flambda with opam
      6 PROF=-g
      7 
      8 SRC=samples.ml
      9 OUT=./out/samples
     10 
     11 build: $(SRC)
     12 	$(OC) $(SRC) -o $(OUT)
     13 	mv samples.cmi samples.cmx samples.o ./out/
     14 
     15 run:
     16 	$(OUT)
     17 
     18 fast:
     19 	$(OC) $(FAST) $(SRC) -o $(OUT)
     20 	mv samples.cmi samples.cmx samples.o ./out/
     21 
     22 time:
     23 	bash -c "time $(OUT)"
     24 
     25 time-linux:
     26 	@echo "Requires /bin/time, found on GNU/Linux systems" && echo
     27 	@echo "Running 100x and taking avg time of: $(OUTPUT)"
     28 	@t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do ./out/samples; done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time: |" | sed 's|$$|ms|' && echo
     29 
     30 profile:
     31 	$(OC) $(PERF) $(SRC) -o $(OUT)
     32 	mv samples.cmi samples.cmx samples.o ./out/
     33 	sudo perf record -g $(OUT)
     34 	sudo perf report
     35 	rm perf.data
     36 
     37 switch-opam-fast:
     38 	opam switch create 4.11.2+flambda 
     39 	eval $(opam env)
     40 
     41 switch-opam-5.1.0:
     42 	opam switch create 5.1.0 
     43 	eval $(opam env)