packages feed

viewprof 0.0.0.1 → 0.0.0.2

raw patch · 4 files changed

+94/−33 lines, 4 filesdep ~ghc-prof

Dependency ranges changed: ghc-prof

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for viewprof +## 0.0.0.2 (2017-02-14)++* Update ghc-prof to 1.4.0++## 0.0.0.1 (2017-01-25)++* Relax upper version bounds for vty and brick+ ## 0.0.0 (2017-01-20)  * Initial release
+ README.md view
@@ -0,0 +1,46 @@+# viewprof+[![Hackage](https://img.shields.io/hackage/v/viewprof.svg)](https://hackage.haskell.org/package/viewprof)+[![Hackage-Deps](https://img.shields.io/hackage-deps/v/viewprof.svg)](http://packdeps.haskellers.com/feed?needle=viewprof)+[![Stackage LTS](http://stackage.org/package/viewprof/badge/lts)](http://stackage.org/lts/package/viewprof)+[![Stackage Nightly](http://stackage.org/package/viewprof/badge/nightly)](http://stackage.org/nightly/package/viewprof)+[![Build Status](https://travis-ci.org/maoe/viewprof.svg?branch=master)](https://travis-ci.org/maoe/viewprof)++viewprof is a text-based interactive GHC .prof viewer.++![screenshot](./img/screenshot.png)++It has three display modes:++* __Aggregate cost centers view__: This is the default view. It groups cost centers by their name and module name, like the middle section of .prof files.+* __Call sites view__: If you press enter on a cost center, viewprof displays call sites of the cost center you selected. This view tells how much the cost center spent for each call site.+* __Modules view__: If you press M, viewprof displays the module level breakdown. This view tells coarse overview of cost attribution.++## Installation++Note: Currently viewprof doesn't support Windows because the underlying library (vty) doesn't support it yet. See [#1](https://github.com/maoe/viewprof/issues/1).++```+stack install viewprof+```++## Usage++| keys              | action                                      |+|-------------------|---------------------------------------------|+| `q` or `escape`   | quit the current view                       |+| `j` or `↓`        | move focus down                        |+| `k` or `↑`        | move focus up                          |+| `gg`              | move focus to the top                       |+| `G`               | move focus to the bottom                    |+| `C`               | display aggregate cost center view          |+| `M`               | switch to module breakdown                  |+| `enter`           | select a cost center and display call sites |+| `t`               | sort by time                                |+| `a`               | sort by allocation                          |+| `e`               | sort by # of entries                        |+| `h` or `?`        | show key bindings                           |+| `i`               | show profile information                    |++## Acknowledgement++`viewprof` was originally meant to be a Haskell port of [mkotha/viewprof](https://github.com/mkotha/viewprof), which is a text-based .prof viewer written in Common Lisp.
bin/viewprof.hs view
@@ -41,12 +41,12 @@  data View   = AggregatesView-    { _costCentres :: !(V.Vector Prof.AggregateCostCentre)+    { _costCentres :: !(V.Vector Prof.AggregatedCostCentre)     , _focus :: !Int     }   | CallSitesView-    { _callee :: !Prof.AggregateCostCentre-    , _callSites :: !(V.Vector (Prof.CallSite Prof.AggregateCostCentre))+    { _callee :: !Prof.AggregatedCostCentre+    , _callSites :: !(V.Vector (Prof.CallSite Prof.AggregatedCostCentre))     , _focus :: !Int     , _expanded :: !(Set Int)     }@@ -85,7 +85,7 @@     Right prof -> return Profile       { _report = prof       , _views = AggregatesView-        { _costCentres = V.fromList (Prof.aggregateCostCentres prof)+        { _costCentres = V.fromList (Prof.aggregatedCostCentres prof)         , _focus = 0         } :| []       , _modalView = Nothing@@ -151,17 +151,17 @@         EvKey (KChar 't') [] -> do           invalidateCache           continue $! sortCostCentresBy-            (Prof.aggregateCostCentreTime &&& Prof.aggregateCostCentreAlloc)+            (Prof.aggregatedCostCentreTime &&& Prof.aggregatedCostCentreAlloc)             prof         EvKey (KChar 'a') [] -> do           invalidateCache           continue $! sortCostCentresBy-            (Prof.aggregateCostCentreAlloc &&& Prof.aggregateCostCentreTime)+            (Prof.aggregatedCostCentreAlloc &&& Prof.aggregatedCostCentreTime)             prof         EvKey (KChar 'e') [] -> do           invalidateCache           continue $! sortCostCentresBy-            Prof.aggregateCostCentreEntries+            Prof.aggregatedCostCentreEntries             prof         EvKey key []           | key `elem` [KEnter] -> do@@ -204,16 +204,16 @@     sortCallSitesBy key p = p & topView . callSites       %~ V.modify (Merge.sortBy (flip compare `on` key))     displayCostCentres p = p & views .~ AggregatesView-      { _costCentres = V.fromList $ Prof.aggregateCostCentres $ p ^. report+      { _costCentres = V.fromList $ Prof.aggregatedCostCentres $ p ^. report       , _focus = 0       } NE.:| []     displayCallers p = fromMaybe p $ do       let !model = p ^. topView . costCentres           !idx = p ^. currentFocus-      Prof.AggregateCostCentre {..} <- model V.!? idx+      Prof.AggregatedCostCentre {..} <- model V.!? idx       (_callee, callers) <- Prof.aggregateCallSites-        aggregateCostCentreName-        aggregateCostCentreModule+        aggregatedCostCentreName+        aggregatedCostCentreModule         (p ^. report)       return $! p & views %~ NE.cons CallSitesView         { _callee@@ -283,13 +283,13 @@       AggregatesView {..} -> viewport AggregatesViewport Vertical $         vBox $ V.toList $           flip V.imap _costCentres $ \i row -> cached (AggregatesCache i) $-            let widget = drawAggregateCostCentre row+            let widget = drawAggregatedCostCentre row             in if i == _focus               then withAttr selectedAttr (visible widget)               else widget       CallSitesView {..} -> viewport CallSitesViewport Vertical $         vBox-          [ drawAggregateCostCentre _callee+          [ drawAggregatedCostCentre _callee           , vBox $ V.toList $ flip V.imap _callSites $ \i row ->             cached (CallSitesCache i) $               let widget = drawCallSite _callee row@@ -305,33 +305,33 @@               then withAttr selectedAttr (visible widget)               else widget -drawAggregateCostCentre :: Prof.AggregateCostCentre -> Widget n-drawAggregateCostCentre Prof.AggregateCostCentre {..} = hBox-  [ txt aggregateCostCentreModule+drawAggregatedCostCentre :: Prof.AggregatedCostCentre -> Widget n+drawAggregatedCostCentre Prof.AggregatedCostCentre {..} = hBox+  [ txt aggregatedCostCentreModule   , txt "."-  , padRight Max $ txt aggregateCostCentreName-  , maybe emptyWidget (padRight (Pad 1) . str . show) aggregateCostCentreEntries-  , padRight (Pad 1) $ str (formatPercentage aggregateCostCentreTime)-  , str (formatPercentage aggregateCostCentreAlloc)+  , padRight Max $ txt aggregatedCostCentreName+  , maybe emptyWidget (padRight (Pad 1) . str . show) aggregatedCostCentreEntries+  , padRight (Pad 1) $ str (formatPercentage aggregatedCostCentreTime)+  , str (formatPercentage aggregatedCostCentreAlloc)   ]  drawCallSite-  :: Prof.AggregateCostCentre-  -> Prof.CallSite Prof.AggregateCostCentre+  :: Prof.AggregatedCostCentre+  -> Prof.CallSite Prof.AggregatedCostCentre   -> Widget n-drawCallSite Prof.AggregateCostCentre {..} Prof.CallSite {..} = hBox-  [ txt $ Prof.aggregateCostCentreModule callSiteCostCentre+drawCallSite Prof.AggregatedCostCentre {..} Prof.CallSite {..} = hBox+  [ txt $ Prof.aggregatedCostCentreModule callSiteCostCentre   , txt "."-  , padRight Max $ txt $ Prof.aggregateCostCentreName callSiteCostCentre+  , padRight Max $ txt $ Prof.aggregatedCostCentreName callSiteCostCentre   , padRight (Pad 1) $ str $ show callSiteContribEntries   , padRight (Pad 1) $ hBox-    [ str $ contribution callSiteContribTime aggregateCostCentreTime+    [ str $ contribution callSiteContribTime aggregatedCostCentreTime     , txt " ("     , str $ formatPercentage callSiteContribTime     , txt ")"     ]   , hBox-    [ str $ contribution callSiteContribAlloc aggregateCostCentreAlloc+    [ str $ contribution callSiteContribAlloc aggregatedCostCentreAlloc     , txt " ("     , str $ formatPercentage callSiteContribAlloc     , txt ")"
viewprof.cabal view
@@ -1,26 +1,29 @@ name: viewprof-version: 0.0.0.1+version: 0.0.0.2 synopsis: Text-based interactive GHC .prof viewer--- description:+description: Text-based interactive GHC .prof viewer+homepage: https://github.com/maoe/viewprof+bug-reports: https://github.com/maoe/lifted-async/issues license: BSD3 license-file: LICENSE author: Mitsutoshi Aoe maintainer: Mitsutoshi Aoe <maoe@foldr.in>-copyright: Copyright (C) 2016 Mitsutoshi Aoe+copyright: Copyright (C) 2016-2017 Mitsutoshi Aoe category: Development build-type: Simple-extra-source-files: CHANGELOG.md+extra-source-files:+  CHANGELOG.md+  README.md cabal-version: >= 1.10 tested-with: GHC == 8.0.2  executable viewprof   main-is: viewprof.hs-  -- other-extensions:   build-depends:       base >= 4.9 && < 4.10     , brick >= 0.16 && < 0.18     , containers >= 0.5.7 && < 0.6-    , ghc-prof >= 1.3.0 && < 1.4+    , ghc-prof >= 1.4 && < 1.5     , lens >= 4.14 && < 4.16     , scientific >= 0.3.4.4 && < 0.4     , text >= 1.2.2.0 && < 1.3@@ -30,3 +33,7 @@   hs-source-dirs: bin   default-language: Haskell2010   ghc-options: -Wall -threaded++source-repository head+  type: git+  location: https://github.com/maoe/viewprof.git