Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8861 closed feature request (fixed)

Use commas to separate thousands when printing memory stats

Reported by: ErlendH Owned by:
Priority: lowest Milestone: 7.10.1
Component: GHCi Version: 7.6.3
Keywords: Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


In GHCi, by enabling printing of timing/memory stats after each evaluation (:set +s), the memory stats is printed in bytes. When this number is quite large, it's hard to see – at a glance – how much memory was used. It would be nicer if this was printed as “1,200,000 bytes” instead of “1200000 bytes” as is the case now.

Attachments (1)

0001-Separate-thousands-when-printing-allocated-bytes.patch (1.3 KB) - added by ErlendH 3 years ago.
Patch adding separating commas when printing bytes used

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by ErlendH

Patch adding separating commas when printing bytes used

comment:1 Changed 3 years ago by ErlendH

Status: newpatch

comment:2 Changed 3 years ago by tibbe

I believe there are tools (e.g. nofib-analyse) that rely on the current format.

comment:3 Changed 3 years ago by rwbarton

./prog +RTS -s already prints the memory stats with commas, can you reuse whatever code does the formatting there?

comment:4 Changed 3 years ago by ErlendH

tibbe: Good point. I did a quick check, running nofib and looking at the output. The file's <<ghc ... :ghc> blocks still had memory usage printed without the commas, e.g. <<ghc: 477115072 bytes, 54 GCs, 8876729/21024600 avg/max bytes residency (5 samples), 40M in use, 0.00 INIT (0.00 elapsed), 0.40 MUT (0.52 elapsed), 0.17 GC (0.18 elapsed) :ghc>. I haven't looked at nofib before, though, so take this with a grain of salt.

rwbarton: Thanks for the tip. I'll have a look.

comment:5 Changed 3 years ago by ErlendH

The formatting code that prints bytes used when passing the -s switch to the RTS is in the RTS C code (showStgWord64() in rts/RtsUtils.c), so that code would probably be difficult to reuse.

comment:6 Changed 3 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged, thanks!

comment:7 Changed 3 years ago by hvr

Milestone: 7.10.1
Note: See TracTickets for help on using tickets.