Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (37 sloc) 1.14 KB
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -Wall #-}
module HeapScope.HeapProfile (
-- * Types
HPHeader(..)
, HeapProfile(..)
-- * Functions
, emptyHeapProfile
, emptyHPHeader
, clearHeapProfile
) where
import Data.ByteString.Char8 (ByteString)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Typeable
----------------------------------------------------------------------
data HPHeader = HPHeader
{ hpJob :: ByteString
, hpDate :: ByteString
, hpSampleUnit :: ByteString
, hpValueUnit :: ByteString
}
deriving (Show, Typeable)
data HeapProfile = HeapProfile
{ hpHeader :: HPHeader
, hpSampleStart :: Maybe Double
, hpSampleEnd :: Maybe Double
, hpSamples :: Map ByteString Int
}
deriving (Show, Typeable)
emptyHeapProfile :: HeapProfile
emptyHeapProfile = HeapProfile emptyHPHeader Nothing Nothing Map.empty
emptyHPHeader :: HPHeader
emptyHPHeader = HPHeader "" "" "" ""
clearHeapProfile :: HeapProfile -> HeapProfile
clearHeapProfile hp = hp { hpSampleStart = Nothing, hpSampleEnd = Nothing, hpSamples = Map.empty }
Something went wrong with that request. Please try again.