Skip to content

Commit

Permalink
Tweak how-to.md so that the extracted code builds
Browse files Browse the repository at this point in the history
  • Loading branch information
myreen committed Jun 14, 2021
1 parent 1a644f8 commit 2963c53
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,36 @@ Alternatively, the allocated heap and stack size can be set in `basis_ffi.c`
by modifying these lines in the file.
Note that `cml_heap_sz` and `cml_stack_sz` are given in bytes here.

unsigned long sz = 1024*1024; // 1 MB unit
unsigned long cml_heap_sz = 1024 * sz; // Default: 1 GB heap
unsigned long cml_stack_sz = 1024 * sz; // Default: 1 GB stack
```
unsigned long sz = 1024*1024; // 1 MB unit
unsigned long cml_heap_sz = 1024 * sz; // Default: 1 GB heap
unsigned long cml_stack_sz = 1024 * sz; // Default: 1 GB stack
```

Basic profiling
-------------------------------------

On Linux systems, CakeML executables can be profiled using `perf`.
As an example, we may profile the factorial program by running:

$ perf record ./fac.cake 30000
```
$ perf record ./fac.cake 30000
```

The report generated by `perf` shows that most of the time is spent in
the bignum library (`LongDiv` is used internally there):

$ perf report

Samples: 20K of event 'cycles', Event count (approx.): 15828778212
Overhead Command Shared Object Symbol
52.88% fac.cake fac.cake [.] cml__LongDiv_21
16.19% fac.cake fac.cake [.] cml__Bignum_50
12.10% fac.cake fac.cake [.] cml__Bignum_47
6.31% fac.cake fac.cake [.] cml__Replicate_9
...

```
$ perf report
Samples: 20K of event 'cycles', Event count (approx.): 15828778212
Overhead Command Shared Object Symbol
52.88% fac.cake fac.cake [.] cml__LongDiv_21
16.19% fac.cake fac.cake [.] cml__Bignum_50
12.10% fac.cake fac.cake [.] cml__Bignum_47
6.31% fac.cake fac.cake [.] cml__Replicate_9
...
```

How CakeML differs from SML and OCaml
-------------------------------------
Expand Down

0 comments on commit 2963c53

Please sign in to comment.