maoe / tkyprof

An interactive GHC profiling visualizer
https://hackage.haskell.org/package/tkyprof
Other
33 stars 4 forks source link

ParseError {errorContexts = [], errorMessage = "Failed reading: takeWhile1", errorPosition = 10:39} @(yesod_GBB6gCJ4065E6aE3B1q92h:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:629:5) #35

Open niteria opened 8 years ago

niteria commented 8 years ago

I got this error while trying to load: haddock.prof.txt

TKYProf 0.2.2.2 launched, listening on http://localhost:3000/
15/Jun/2016:10:36:16 +0100 [Info#yesod-core] Application launched @(yesod_GBB6gCJ4065E6aE3B1q92h:Yesod.Core.Dispatch ./Yesod/Core/Dispatch.hs:157:11)
15/Jun/2016:10:36:29 +0100 [Error#yesod-core] ParseError {errorContexts = [], errorMessage = "Failed reading: takeWhile1", errorPosition = 10:39} @(yesod_GBB6gCJ4065E6aE3B1q92h:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:629:5)
127.0.0.1 - - [15/Jun/2016:10:36:29 +0100] "POST /reports HTTP/1.1" 500 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36"

The profile was produced with GHC 8.

niteria commented 8 years ago

I suspect it's because it was created with -P instead of -p.

maoe commented 8 years ago

Thanks for the report. Apparently the SRC column has been added (since GHC 8?). I've fixed it in my ghc-time-alloc-prof library, which is meant for a replacement for the parser in tkyprof. I think I had a branch which replaces the parser but I need time to remember where I was.

For the time being, you can try the dump command in ghc-time-alloc-prof. The UI isn't good at all but it's kind of usable.

Sort by time:

% stack exec dump -- haddock.prof.txt
MAIN.MAIN:716 (100.0,0.0,100.0,0.0)
|
+- GHC.runGhc:1432 (100.0,0.0,100.0,0.0)
|  |
|  +- GHC.withCleanupSession:1439 (99.9,19.6,99.9,24.3)
|  |  |
|  |  +- GHC.typecheckModule:1723 (57.8,0.1,50.3,0.1)
|  |  |  |
|  |  |  +- HscMain.Typecheck-Rename:1724 (57.8,0.0,50.2,0.0)
|  |  |  |  |
|  |  |  |  `- TcRnDriver.tcRnModule:1727 (57.8,0.3,50.2,0.2)
|  |  |  |     |
|  |  |  |     +- TcRnDriver.withTcPlugins:1732 (57.5,0.0,50.1,0.0)
|  |  |  |     |  |
|  |  |  |     |  +- TcRnDriver.tcRnModuleTcRnM:1735 (57.5,0.0,50.1,0.0)
|  |  |  |     |  |  |
|  |  |  |     |  |  +- TcRnDriver.tcRnSrcDecls:1870 (39.7,0.0,22.7,0.0)
...

Who calls it:

% stack exec dump -- haddock.prof.txt tcRnModuleTcRnM TcRnDriver
Callee {calleeName = "tcRnModuleTcRnM", calleeModule = "TcRnDriver", calleeEntries = 468, calleeTime = 0.0, calleeAlloc = 0.0, calleeTicks = Just 0, calleeBytes = Just 0}
CallSite {callSiteCostCentre = CostCentre {costCentreName = "withTcPlugins", costCentreModule = "TcRnDriver", costCentreSrc = Just "compiler/typecheck/TcRnDriver.hs:(2502,1)-(2518,31)", costCentreNo = 1732, costCentreEntries = 468, costCentreIndTime = 0.0, costCentreIndAlloc = 0.0, costCentreInhTime = 57.5, costCentreInhAlloc = 50.1, costCentreTicks = Just 1, costCentreBytes = Just 29952}, callSiteContribEntries = 0, callSiteContribTime = 0.0, callSiteContribAlloc = 0.0, callSiteContribTicks = Just 12, callSiteContribBytes = Just 835016}
CallSite {callSiteCostCentre = CostCentre {costCentreName = "withTcPlugins", costCentreModule = "TcRnDriver", costCentreSrc = Just "compiler/typecheck/TcRnDriver.hs:(2502,1)-(2518,31)", costCentreNo = 2148, costCentreEntries = 0, costCentreIndTime = 0.0, costCentreIndAlloc = 0.0, costCentreInhTime = 0.0, costCentreInhAlloc = 0.0, costCentreTicks = Just 0, costCentreBytes = Just 0}, callSiteContribEntries = 0, callSiteContribTime = 0.0, callSiteContribAlloc = 0.0, callSiteContribTicks = Just 0, callSiteContribBytes = Just 0}
CallSite {callSiteCostCentre = CostCentre {costCentreName = "CAF", costCentreModule = "TcRnDriver", costCentreSrc = Just "<entire-module>", costCentreNo = 864, costCentreEntries = 0, costCentreIndTime = 0.0, costCentreIndAlloc = 0.0, costCentreInhTime = 0.0, costCentreInhAlloc = 0.0, costCentreTicks = Just 0, costCentreBytes = Just 48}, callSiteContribEntries = 0, callSiteContribTime = 0.0, callSiteContribAlloc = 0.0, callSiteContribTicks = Just 0, callSiteContribBytes = Just 0}
CallSite {callSiteCostCentre = CostCentre {costCentreName = "tcRnModule", costCentreModule = "TcRnDriver", costCentreSrc = Just "compiler/typecheck/TcRnDriver.hs:(133,1)-(159,45)", costCentreNo = 1727, costCentreEntries = 468, costCentreIndTime = 0.3, costCentreIndAlloc = 0.2, costCentreInhTime = 57.8, costCentreInhAlloc = 50.2, costCentreTicks = Just 213, costCentreBytes = Just 114853928}, callSiteContribEntries = 468, callSiteContribTime = 0.0, callSiteContribAlloc = 0.0, callSiteContribTicks = Just 1, callSiteContribBytes = Just 117168}
niteria commented 8 years ago

Thanks for the quick response. I think I've tried ghc-time-alloc-prof from Hackage and got the same error. I will try the github repo. The think I want to eventually achieve is to compute a difference between two profiles. Your library looks like a good fit.