Skip to content

Document the units of -ddump-timings

MaxGabriel requested to merge trac-MaxGabriel/ghc:documentDdumpTimings into master

(Haven't contributed to GHC via GitLab before, so tell me if there's anything I'm missing in the merge request process)

Right now, in the output of -ddump-timings to a file, you can't tell what the units are:

CodeGen [TemplateTestImports]: alloc=22454880 time=14.597

I believe bytes/milliseconds are the correct units, but confirmation would be appreciated. I'm basing it off of this snippet from withTiming':

when (verbosity dflags >= 2 && prtimings == PrintTimings)
  $ liftIO $ logInfo dflags (defaultUserStyle dflags)
      (text "!!!" <+> what <> colon <+> text "finished in"
       <+> doublePrec 2 time
       <+> text "milliseconds"
       <> comma
       <+> text "allocated"
       <+> doublePrec 3 (realToFrac alloc / 1024 / 1024)
       <+> text "megabytes")

which implies time is in milliseconds, and allocations in bytes (which divided by 1024 would be KB, and again would be MB)

Merge request reports