Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kfish/heapscope
base: 4b97f1da7e
...
head fork: kfish/heapscope
compare: 18426b1977
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 7 additions and 1 deletion.
  1. +6 −0 HeapScope/ZoomCache.hs
  2. +1 −1  src/heapscope.hs
View
6 HeapScope/ZoomCache.hs
@@ -11,6 +11,7 @@ import Blaze.ByteString.Builder
import Control.Applicative
import Control.Monad (replicateM)
import Data.ByteString (ByteString)
+import qualified Data.Foldable as Fold
import Data.Iteratee (Iteratee)
import qualified Data.Iteratee as I
import Data.Map (Map)
@@ -30,6 +31,7 @@ instance ZoomReadable HeapProfile where
{ summaryHPHeader :: Maybe HPHeader
, summaryHPSampleTimes :: [(Double, Double)]
, summaryHPSamples :: Map ByteString Int
+ , summaryHPTotal :: Integer
} deriving (Show)
trackIdentifier = const trackTypeHeapProfile
@@ -107,6 +109,7 @@ readSummaryHeapProfile = do
summaryHPHeader <- iterReadMaybe readHPHeader
summaryHPSampleTimes <- readSampleTimes
summaryHPSamples <- readSamples
+ summaryHPTotal <- readIntegerVLC
return SummaryHeapProfile{..}
instance ZoomWrite HeapProfile where
@@ -174,6 +177,7 @@ fromSummaryHeapProfile SummaryHeapProfile{..} = mconcat
[ buildMaybe fromHPHeader summaryHPHeader
, fromSampleTimes summaryHPSampleTimes
, fromSamples summaryHPSamples
+ , fromIntegerVLC summaryHPTotal
]
initSummaryHeapProfile :: SampleOffset -> SummaryWork HeapProfile
@@ -184,6 +188,7 @@ mkSummaryHeapProfile (SODiff dur) SummaryWorkHeapProfile{..} = SummaryHeapProfil
{ summaryHPHeader = swHPHeader
, summaryHPSampleTimes = swHPSampleTimes
, summaryHPSamples = swHPSamples
+ , summaryHPTotal = fromIntegral (Fold.sum swHPSamples)
}
updateSummaryHeapProfile :: SampleOffset -> HeapProfile -> SummaryWork HeapProfile
@@ -205,5 +210,6 @@ appendSummaryHeapProfile (SODiff dur1) s1 (SODiff dur2) s2 = SummaryHeapProfile
{ summaryHPHeader = summaryHPHeader s1
, summaryHPSampleTimes = summaryHPSampleTimes s1 ++ summaryHPSampleTimes s2
, summaryHPSamples = Map.unionWith (+) (summaryHPSamples s1) (summaryHPSamples s2)
+ , summaryHPTotal = (summaryHPTotal s1) + (summaryHPTotal s2)
}
View
2  src/heapscope.hs
@@ -36,7 +36,7 @@ hpFile path = withFileWrite trackMap Nothing True iter zpath
spec = def { specName = "hp" }
hpDo :: Iteratee [HeapProfile] ZoomW ()
-hpDo = I.mapM_ (write 1)
+hpDo = I.mapM_ (\hp -> maybe (return ()) (\ts -> write 1 (TS ts, hp)) (hpSampleStart hp))
hpEnum :: MonadIO m => HeapProfile -> Enumeratee ByteString [HeapProfile] m a
hpEnum = I.unfoldConvStream hpIter

No commit comments for this range

Something went wrong with that request. Please try again.