diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-03-23 16:11:45 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-24 10:53:27 +0100 |
commit | 8048d51be0676627b417c128af0b0c352b75c537 (patch) | |
tree | 0d4ae8449cf93b94078587e6793e13dcd4a5ac76 /compiler/utils/Outputable.hs | |
parent | da3b29bd1768d717753b7d1642e0e4e97750ae7b (diff) | |
download | haskell-8048d51be0676627b417c128af0b0c352b75c537.tar.gz |
ErrUtils: Add timings to compiler phases
This adds timings and allocation figures to the compiler's output when
run with `-v2` in an effort to ease performance analysis.
Todo:
* Documentation
* Where else should we add these?
* Perhaps we should remove some of the now-arguably-redundant
`showPass` occurrences where they are
* Must we force more?
* Perhaps we should place this behind a `-ftimings` instead of `-v2`
Test Plan: `ghc -v2 Test.hs`, look at the output
Reviewers: hvr, goldfire, simonmar, austin
Reviewed By: simonmar
Subscribers: angerman, michalt, niteria, ezyang, thomie
Differential Revision: https://phabricator.haskell.org/D1959
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r-- | compiler/utils/Outputable.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 259b554c23..64b3542706 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -22,7 +22,7 @@ module Outputable ( empty, isEmpty, nest, char, text, ftext, ptext, ztext, - int, intWithCommas, integer, float, double, rational, + int, intWithCommas, integer, float, double, rational, doublePrec, parens, cparen, brackets, braces, quotes, quote, doubleQuotes, angleBrackets, paBrackets, semi, comma, colon, dcolon, space, equals, dot, vbar, @@ -111,6 +111,7 @@ import Data.Word import System.IO ( Handle ) import System.FilePath import Text.Printf +import Numeric (showFFloat) import Data.Graph (SCC(..)) import GHC.Fingerprint @@ -508,6 +509,11 @@ float n = docToSDoc $ Pretty.float n double n = docToSDoc $ Pretty.double n rational n = docToSDoc $ Pretty.rational n +-- | @doublePrec p n@ shows a floating point number @n@ with @p@ +-- digits of precision after the decimal point. +doublePrec :: Int -> Double -> SDoc +doublePrec p n = text (showFFloat (Just p) n "") + parens, braces, brackets, quotes, quote, paBrackets, doubleQuotes, angleBrackets :: SDoc -> SDoc |