Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / examples / profiling / Makefile
CommitLineData
7f918cf1
CE
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
9mlton := mlton
10mlprof := mlprof
11ALLOC_EX := list-rev
12COUNT_EX := tak
13MULT_EX := fib-tak
14TIME_EX := tak
15
16PATH := ../../../build/bin:$(shell echo $$PATH)
17
18.PHONY: all
19all: profile-time profile-alloc profile-count profile-stack profile-multiple
20
21.PHONY: clean
22clean:
23 ../../../bin/clean
24
25.PHONY: profile-alloc
26profile-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
32profile-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
38profile-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
46profile-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
54profile-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