Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,244
    • Issues 5,244
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 570
    • Merge requests 570
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !9435

driver: Add timing information to upsweep and some simple analysis scripts

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Matthew Pickering requested to merge wip/par-stats into master Nov 29, 2022
  • Overview 8
  • Commits 1
  • Pipelines 1
  • Changes 5

This commit adds a new flag -ddump-make-stats which shows some statistics about the project build graph after compilation has finished. These can be useful identifying bottlenecks in your projects module structure.

The statistics which are currently outputted are:

  • The modules which took longest to compile.
  • The modules which have the largest "flow". The initial flow is 1, and split evenly between all roots of the dependency graph. The flow is propagated through the graph, accumulated on each node and split evenly on children. The result is that any synchronisation points will have a flow equal to 1, and likewise other important modules will have a high flow value.
  • The length of the longest (critical) path through the project. This provides a lower bound on the projects compilation time.
  • The "parallelism score" which is the sum of compiling all nodes divided by the length of the critical path. This should be a more stable metric then critical path length because it doesn't depend on how fast your computer is.

For example, here is an example of the output from compiling the Cabal library.

===== Maximum Duration (s) =====
000 M: main:Distribution.Simple.Setup (59): time: 1.40 allocs: 1489.93
001 M: main:Distribution.PackageDescription.Check (82): time: 0.68 allocs: 732.85
...
104 M: main:Distribution.Compat.GetShortPathName (9): time: 0.00 allocs: 3.62
105 M: main:Distribution.Compat.FilePath (8): time: 0.00 allocs: 3.46
===== Maximum Flows =====
000 M: main:Distribution.Simple (105): 1.000
001 M: main:Distribution.Simple.Configure (97): 0.346
...
104 M: main:Distribution.Simple.Program.Types (50): 0.002
105 M: main:Distribution.Simple.GHC.ImplInfo (46): 0.000
===== Flows x Time =====
000 M: main:Distribution.Simple (105): 0.175
001 M: main:Distribution.Simple.Configure (97): 0.127
...
104 M: main:Distribution.Backpack.PreExistingComponent (4): 0.000
105 M: main:Distribution.Simple.GHC.ImplInfo (46): 0.000
===== Statistics =====
longest path: 4.291s
parallelism score: 2.247
sequential time: 9.642s

In addition to this, the build graph is also emitted to the eventlog. For each node in the build graph, an event is emitted to the eventlog of the form

node: { "node_id": 0, "node_deps": [0, 1,2,3], "node_desc": "GHC.Driver.Make" }

this allows external tooling to easily reconstruct the actual build graph used by GHC and analyse it using external tools.

Edited Nov 29, 2022 by sheaf
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/par-stats