profiteur 0.3.0.3 → 0.4.0.0
raw patch · 7 files changed
+143/−80 lines, 7 files
Files
- CHANGELOG +0/−39
- CHANGELOG.md +45/−0
- README.md +25/−0
- data/css/main.css +12/−0
- data/js/details.js +28/−19
- profiteur.cabal +3/−2
- src/Profiteur/Core.hs +30/−20
− CHANGELOG
@@ -1,39 +0,0 @@-- 0.3.0.3- * Bump `aeson` dependency--- 0.3.0.2- * Bump `aeson` dependency--- 0.3.0.1- * Bump base version, add example to repo--- 0.3.0.0- * Simplify the tree, creating actual (indiv) nodes where necessary from the- Haskell code--- 0.2.0.2- * Bump `aeson` and `vector` dependencies--- 0.2.0.1- * Bump `aeson` and `attoparsec` dependencies--- 0.2.0.0- * Show individual time/alloc as separate nodes--- 0.1.2.2- * Loosen `text` dependency--- 0.1.2.1- * Loosen `text` dependency--- 0.1.2.0- * Fix resize/redraw bug for Firefox/Linux combo--- 0.1.1.0- * Ignore extra information in `.prof` file--- 0.1.0.1- * Loosen `attoparsec` dependency--- 0.1.0.0- * Initial release
+ CHANGELOG.md view
@@ -0,0 +1,45 @@+- 0.4.0.0+ * Always show time/alloc relative to MAIN as well as relative to the current+ root node+ * Replace help button by link to homepage+ * Never include (0 time, 0 alloc) nodes++- 0.3.0.3+ * Bump `aeson` dependency++- 0.3.0.2+ * Bump `aeson` dependency++- 0.3.0.1+ * Bump base version, add example to repo++- 0.3.0.0+ * Simplify the tree, creating actual (indiv) nodes where necessary from the+ Haskell code++- 0.2.0.2+ * Bump `aeson` and `vector` dependencies++- 0.2.0.1+ * Bump `aeson` and `attoparsec` dependencies++- 0.2.0.0+ * Show individual time/alloc as separate nodes++- 0.1.2.2+ * Loosen `text` dependency++- 0.1.2.1+ * Loosen `text` dependency++- 0.1.2.0+ * Fix resize/redraw bug for Firefox/Linux combo++- 0.1.1.0+ * Ignore extra information in `.prof` file++- 0.1.0.1+ * Loosen `attoparsec` dependency++- 0.1.0.0+ * Initial release
+ README.md view
@@ -0,0 +1,25 @@+profiteur+=========++Profiteur is a visualiser for GHC `.prof` files.++Installation+------------++ cabal install profiteur++Usage+-----++ ghc --make -auto-all -prof your-program.hs+ ./your-program +RTS -p -RTS+ profiteur your-program.prof++See also [example/Makefile](example/Makefile).++A tree browser and a tree map are available to browse the profile.++Expand cost centres by clicking the chevrons in the tree browser or+double-clicking them in the tree map.++
data/css/main.css view
@@ -16,6 +16,10 @@ width: 100%; } +a {+ color: #8ee2f9;+}+ #details-tree { position: absolute; left: 0px;@@ -28,6 +32,7 @@ height: 33%; overflow: auto; top: 0px;+ position: relative; } #tree {@@ -61,6 +66,13 @@ #details td { padding-right: 15px;+}++#details .credits {+ font-size: 12px;+ position: absolute;+ bottom: 0px;+ margin: 5px; } /* Tree browser
data/js/details.js view
@@ -2,17 +2,6 @@ return $(document.createElement(el)); } -Details.helpText =- "Profiteur: A visualizer for Haskell profile files.\n" +- "\n" +- "A tree browser and a tree map are available to browse\n" +- "the profile.\n" +- "\n" +- "Expand cost centres by clicking the chevrons in the\n" +- "tree browser or double-clicking them in the tree map.\n" +- "\n" +- "For more info: <http://github.com/jaspervdj/profiteur>.";- function Details(container, selection, sorting, zoom) { this.container = container; this.selection = selection;@@ -50,12 +39,6 @@ }); controls.append(combo); - var help = mk('button').text('help');- help.click(function() {- alert(Details.helpText);- });- controls.append(help);- var table = mk('table'); table.append(mk('tr')@@ -74,9 +57,23 @@ .append(mk('td').text('Alloc')) .append(mk('td').addClass('alloc'))); + table.append(mk('tr').addClass('mainTimeRow')+ .append(mk('td').text('MAIN Time'))+ .append(mk('td').addClass('mainTime')));++ table.append(mk('tr').addClass('mainAllocRow')+ .append(mk('td').text('MAIN Alloc'))+ .append(mk('td').addClass('mainAlloc')));++ var credits = mk('p').addClass('credits');+ credits.html('Generated by ' ++ '<a href="http://github.com/jaspervdj/profiteur" ' ++ 'target="_blank">profiteur</a>.');+ this.container.append(canonical); this.container.append(controls); this.container.append(table);+ this.container.append(credits); }; Details.prototype.render = function(node) {@@ -104,8 +101,10 @@ _this.zoom.setZoom(node); }); - var time = node.getTime();- var alloc = node.getAlloc();+ var mainTime = node.getTime();+ var mainAlloc = node.getAlloc();+ var time = mainTime;+ var alloc = mainAlloc; var zoom = _this.zoom.getZoom(); if (zoom.parent && zoom.getTime() > 0) {@@ -119,6 +118,16 @@ this.container.find('.entries').text(node.getEntries()); this.container.find('.time').text(time); this.container.find('.alloc').text(alloc);+ this.container.find('.mainTime').text(mainTime);+ this.container.find('.mainAlloc').text(mainAlloc);++ if (zoom.parent) {+ this.container.find('.mainTimeRow').show();+ this.container.find('.mainAllocRow').show();+ } else {+ this.container.find('.mainTimeRow').hide();+ this.container.find('.mainAllocRow').hide();+ } }; Details.prototype.onChange = function() {
profiteur.cabal view
@@ -1,5 +1,5 @@ Name: profiteur-Version: 0.3.0.3+Version: 0.4.0.0 Synopsis: Treemap visualiser for GHC prof files Description: Treemap visualiser for GHC prof files Homepage: http://github.com/jaspervdj/profiteur@@ -13,7 +13,8 @@ Cabal-version: >= 1.8 Extra-source-files:- CHANGELOG+ CHANGELOG.md+ README.md Data-files: data/css/main.css
src/Profiteur/Core.hs view
@@ -18,7 +18,7 @@ import qualified Data.Aeson as A import qualified Data.HashMap.Strict as HMS import Data.List (foldl')-import Data.Maybe (maybeToList)+import Data.Maybe (mapMaybe, maybeToList) import Data.Monoid ((<>)) import qualified Data.Text as T import qualified Data.Vector as V@@ -55,30 +55,36 @@ ---------------------------------------------------------------------------------nodesFromCostCentre :: CostCentre -> [Node]+-- | Returns the node and its (transitive) children.+nodesFromCostCentre :: CostCentre -> Maybe (Node, [Node]) nodesFromCostCentre cc | V.null (ccChildren cc), Just indiv' <- indiv =- [ indiv' {nId = nId self, nName = nName self}- ]- | otherwise =- self : maybeToList indiv ++- concatMap nodesFromCostCentre (V.toList $ ccChildren cc)- where- self = Node- { nId = ccId cc- , nName = ccName cc- , nModule = ccModule cc- , nEntries = ccEntries cc- , nTime = ccInheritedTime cc- , nAlloc = ccInheritedAlloc cc- , nChildren = V.fromList $- maybeToList (nId <$> indiv) ++ map ccId (V.toList $ ccChildren cc)- }+ Just (indiv' {nId = ccId cc, nName = ccName cc}, [])+ | otherwise = do+ guard $ ccInheritedTime cc > 0 || ccInheritedAlloc cc > 0 + let (children, grandChildren) = unzip $+ mapMaybe nodesFromCostCentre (V.toList $ ccChildren cc)++ let allChildren = maybeToList indiv ++ children ++ concat grandChildren++ let self = Node+ { nId = ccId cc+ , nName = ccName cc+ , nModule = ccModule cc+ , nEntries = ccEntries cc+ , nTime = ccInheritedTime cc+ , nAlloc = ccInheritedAlloc cc+ , nChildren = V.fromList $ map nId $+ maybeToList indiv ++ children+ }++ return (self, allChildren)+ where indiv = do guard $ ccIndividualTime cc > 0 || ccIndividualAlloc cc > 0 return Node- { nId = nId self <> ".indiv"+ { nId = ccId cc <> ".indiv" , nName = ccName cc <> " (indiv)" , nModule = ccModule cc , nEntries = ccEntries cc@@ -126,4 +132,8 @@ -------------------------------------------------------------------------------- nodeMapFromCostCentre :: CostCentre -> NodeMap nodeMapFromCostCentre root =- nodeMapFromNodes (ccId root) (nodesFromCostCentre root)+ nodeMapFromNodes (ccId root) nodes+ where+ nodes = case nodesFromCostCentre root of+ Nothing -> []+ Just (n, ns) -> n : ns