Backport from sid to buster
[hcoop/debian/mlton.git] / doc / examples / profiling / Makefile
1 ## Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 # Jagannathan, and Stephen Weeks.
3 # Copyright (C) 1997-2000 NEC Research Institute.
4 #
5 # MLton is released under a BSD-style license.
6 # See the file MLton-LICENSE for details.
7 ##
8
9 mlton := mlton
10 mlprof := mlprof
11 ALLOC_EX := list-rev
12 COUNT_EX := tak
13 MULT_EX := fib-tak
14 TIME_EX := tak
15
16 PATH := ../../../build/bin:$(shell echo $$PATH)
17
18 .PHONY: all
19 all: profile-time profile-alloc profile-count profile-stack profile-multiple
20
21 .PHONY: clean
22 clean:
23 ../../../bin/clean
24
25 .PHONY: profile-alloc
26 profile-alloc:
27 $(mlton) -profile alloc $(ALLOC_EX).sml
28 ./$(ALLOC_EX)
29 $(mlprof) -show-line true $(ALLOC_EX) mlmon.out
30
31 .PHONY: profile-count
32 profile-count:
33 $(mlton) -profile count $(COUNT_EX).sml
34 ./$(COUNT_EX)
35 $(mlprof) -raw true -show-line true $(COUNT_EX) mlmon.out
36
37 .PHONE: profile-multiple
38 profile-multiple:
39 $(mlton) -profile time $(MULT_EX).sml
40 ./$(MULT_EX)
41 $(mlprof) $(MULT_EX) mlmon.fib.out
42 $(mlprof) $(MULT_EX) mlmon.tak.out
43 $(mlprof) $(MULT_EX) mlmon.fib.out mlmon.tak.out mlmon.out
44
45 .PHONY: profile-stack
46 profile-stack:
47 $(mlton) -profile alloc -profile-stack true $(ALLOC_EX).sml
48 ./$(ALLOC_EX)
49 $(mlprof) -call-graph $(ALLOC_EX).dot -show-line true \
50 $(ALLOC_EX) mlmon.out
51 dot -Tps $(ALLOC_EX).dot >$(ALLOC_EX).ps || true
52
53 .PHONY: profile-time
54 profile-time:
55 $(mlton) -profile time $(TIME_EX).sml
56 ./$(TIME_EX)
57 $(mlprof) $(TIME_EX) mlmon.out
58 $(mlprof) -raw true $(TIME_EX) mlmon.out
59 $(mlprof) -show-line true $(TIME_EX) mlmon.out