-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(executable | ||
(name test) | ||
(modes native) | ||
(libraries landmark)) | ||
|
||
(rule | ||
(ignore-stderr | ||
(with-stdout-to | ||
test.out | ||
(run ./test.exe)))) | ||
|
||
(rule | ||
(alias runtest) | ||
(enabled_if | ||
(>= %{ocaml_version} "4.04")) | ||
(action | ||
(diff test.out.expected test.out))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module L = Landmark | ||
|
||
let name = "zero_alloc" | ||
let zero_alloc = L.register name | ||
|
||
let () = | ||
L.start_profiling | ||
~profiling_options:{L.default_options with allocated_bytes = true} (); | ||
L.enter zero_alloc; | ||
L.exit zero_alloc | ||
|
||
let check_allocated_bytes () = | ||
let open Landmark.Graph in | ||
|
||
let graph = L.export () in | ||
let node = | ||
root graph | ||
|> children graph | ||
|> List.filter (fun n -> n.name = name) | ||
|> List.hd | ||
in | ||
Printf.printf "Allocations:\n%d\n%d\n" | ||
(node.allocated_bytes) | ||
(node.allocated_bytes_major) | ||
|
||
let () = | ||
check_allocated_bytes () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Allocations: | ||
0 | ||
0 |