diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-30 11:43:14 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-02 22:21:26 -0400 |
commit | e3cbe319dbe2f6a64ea3108dcd8d42e7876e5b34 (patch) | |
tree | ea2b4d52394cf2776ca89a576973163746db68c5 | |
parent | 4664bafcb8db9f7cbcc9d16b0b1d381650b682c2 (diff) | |
download | haskell-e3cbe319dbe2f6a64ea3108dcd8d42e7876e5b34.tar.gz |
Packages: Add timing for package database initialization
-rw-r--r-- | compiler/main/Packages.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 8c86f8df64..ccf42c588c 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -84,7 +84,8 @@ import CmdLineParser import System.Environment ( getEnv ) import FastString -import ErrUtils ( debugTraceMsg, MsgDoc, dumpIfSet_dyn, compilationProgressMsg ) +import ErrUtils ( debugTraceMsg, MsgDoc, dumpIfSet_dyn, compilationProgressMsg, + withTiming ) import Exception import System.Directory @@ -468,7 +469,9 @@ listPackageConfigMap dflags = eltsUDFM pkg_map -- 'pkgState' in 'DynFlags' and return a list of packages to -- link in. initPackages :: DynFlags -> IO (DynFlags, [PreloadUnitId]) -initPackages dflags0 = do +initPackages dflags0 = withTiming (return dflags0) + (text "initializing package database") + forcePkgDb $ do dflags <- interpretPackageEnv dflags0 pkg_db <- case pkgDatabase dflags of @@ -481,6 +484,8 @@ initPackages dflags0 = do pkgState = pkg_state, thisUnitIdInsts_ = insts }, preload) + where + forcePkgDb (dflags, _) = pkgIdMap (pkgState dflags) `seq` () -- ----------------------------------------------------------------------------- -- Reading the package database(s) |