summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-01-06 00:32:45 -0800
committerOri Bernstein <ori@eigenstate.org>2018-01-06 00:32:45 -0800
commit6ddb81f706b6780bfad00c3d203a1bc7ea1f247b (patch)
treeaa83717ca60a7e03f3af7f991c4ca1ccb3f31ecb /support
parent2f53fe1fb0d524696058f1d15a58fdcf5fc2203a (diff)
downloadmc-6ddb81f706b6780bfad00c3d203a1bc7ea1f247b.tar.gz
Rename cache => bigcache.
We have two unrelated caches. Let's not make the naming unnecessarily confusing.
Diffstat (limited to 'support')
-rw-r--r--support/dumpleak.myr22
1 files changed, 14 insertions, 8 deletions
diff --git a/support/dumpleak.myr b/support/dumpleak.myr
index 32d8e25..bd6334a 100644
--- a/support/dumpleak.myr
+++ b/support/dumpleak.myr
@@ -3,13 +3,14 @@ use bio
var stackaggr = 10
var summary
+var allocstats
type memstats = struct
- allocs : uint64
- allocsz : uint64
- frees : uint64
- freesz : uint64
- tab : std.htab(uint64, (uint64, uint64[:]))#
+ allocs : std.size
+ allocsz : std.size
+ frees : std.size
+ freesz : std.size
+ tab : std.htab(std.size, (std.size, std.size[:]))#
;;
@@ -20,6 +21,7 @@ const main = {args
cmd = std.optparse(args, &[
.argdesc="dumps...",
.opts=[
+ [.opt='a', .arg="", .desc="show all allocations, regardless of frees"],
[.opt='d', .arg="depth", .desc="aggregate by at most `depth` stack elements"],
[.opt='s', .arg="", .desc="only show a summary of memory activity"],
][:]
@@ -27,6 +29,8 @@ const main = {args
for opt : cmd.opts
match opt
+ | ('a',""):
+ allocstats = true
| ('d', depth):
match std.intparse(depth)
| `std.Some d: stackaggr = d
@@ -34,10 +38,12 @@ const main = {args
;;
| ('s', ""):
summary = true
- | _: std.die("unreachable")
+ | _:
+ std.die("unreachable")
;;
;;
+ std.clear(&stats)
stats.tab = std.mkht()
for d : cmd.args
match bio.open(d, bio.Rd)
@@ -91,8 +97,8 @@ const tracefree = {path, f, stats
ptr = get64(path, f)
sz = get64(path, f)
- stats.allocs++
- stats.allocsz += sz
+ stats.frees++
+ stats.freesz += sz
std.htdel(stats.tab, ptr)
}