Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix render of heap profiles in -p mode #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Eventlog/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ generateJsonData a (ProfData h binfo ccMap fs traces heap_info ipes _ticky_count
sortBy (flip (comparing (fst . snd))) $ Map.toList keeps
-- Only supply the cost centre view in cost centre profiling mode.
cc_descs = case hHeapProfileType h of
Just HeapProfBreakdownCostCentre -> Just (outputTree ccMap mdescs)
(FromEventlog (Just HeapProfBreakdownCostCentre)) -> Just (outputTree ccMap mdescs)
_ -> Nothing

use_ipes = case hHeapProfileType h of
Just HeapProfBreakdownInfoTable -> Just ipes
(FromEventlog (Just HeapProfBreakdownInfoTable)) -> Just ipes
_ -> Nothing

-- If we have IPE info, try to translate info table pointers to names
Expand Down
2 changes: 1 addition & 1 deletion src/Eventlog/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import Eventlog.Types
import Eventlog.Total
import Eventlog.Args (Args(..))
import Data.List (foldl')

Check warning on line 19 in src/Eventlog/Events.hs

View workflow job for this annotation

GitHub Actions / GHC 9.10.1 on ubuntu-latest

The import of ‘Data.List’ is redundant
import Data.Function
import Data.Word
import Data.Time
Expand Down Expand Up @@ -344,7 +344,7 @@
let title = maybe "" T.unwords pargs
date = formatDate clocktimeSec
ppSamplingRate = T.pack . maybe "<Not available>" (show . fromNano) $ samplingRate
in \v -> Header title date heapProfileType ppSamplingRate "" "" v (T.unpack . head <$> pargs)
in \v -> Header title date (FromEventlog heapProfileType) ppSamplingRate "" "" v (T.unpack . head <$> pargs)

Check warning on line 347 in src/Eventlog/Events.hs

View workflow job for this annotation

GitHub Actions / GHC 9.10.1 on ubuntu-latest

In the use of ‘head’

Check warning on line 347 in src/Eventlog/Events.hs

View workflow job for this annotation

GitHub Actions / GHC 9.8.1 on ubuntu-latest

In the use of ‘head’


elBucketMap :: EL -> BucketMap
Expand Down
2 changes: 1 addition & 1 deletion src/Eventlog/HeapProf.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ chunkT s =
[job, date, smpU, valU] =
zipWith header [sJOB, sDATE, sSAMPLE_UNIT, sVALUE_UNIT] hs
fs = chunkSamples ss
in (\v -> Header job date Nothing (pack "") smpU valU v Nothing
in (\v -> Header job date FromHPFile (pack "") smpU valU v Nothing
, fs
)

Expand Down
15 changes: 12 additions & 3 deletions src/Eventlog/HtmlTemplate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import Eventlog.Data
import Eventlog.Javascript
import Eventlog.Args
import Eventlog.Types (Header(..), HeapProfBreakdown(..))
import Eventlog.Types (Header(..), HeapProfBreakdown(..), ProfileType(..))
import Eventlog.Rendering.Bootstrap
import Eventlog.Rendering.Types
import Eventlog.VegaTemplate
Expand Down Expand Up @@ -162,11 +162,15 @@
perTabFooter header' = do
H.div ! class_ "row" $ do
H.div ! class_ "col" $ do
toHtml $ maybe "No heap profile" ppHeapProfileType (hHeapProfileType header')
toHtml $ render_type (hHeapProfileType header')
", created at "
code $ toHtml $ hDate header'
" by "
code $ toHtml $ hJob header'
where
render_type FromHPFile = "heap profile"
render_type (FromEventlog Nothing) = "No heap profile"
render_type (FromEventlog (Just t)) = ppHeapProfileType t


select_data :: IncludeTraceData -> ChartType -> [Text]
Expand Down Expand Up @@ -223,6 +227,7 @@
ppHeapProfileType (HeapProfBreakdownBiography) = "Biographical profiling (implied by -hb)"
ppHeapProfileType (HeapProfBreakdownClosureType) = "Basic heap profile (implied by -hT)"
ppHeapProfileType (HeapProfBreakdownInfoTable) = "Info table profile (implied by -hi)"
ppHeapProfileType (HeapProfBreakdownEra) = "Era profile (implied by -he)"

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6.2 on macos-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6.2 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.10.1 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6.2 on windows-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.4.7 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.8.1 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.0.2 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’

Check failure on line 230 in src/Eventlog/HtmlTemplate.hs

View workflow job for this annotation

GitHub Actions / GHC 9.2.7 on ubuntu-latest

Not in scope: data constructor ‘HeapProfBreakdownEra’


allTabs :: EventlogType
Expand All @@ -248,7 +253,11 @@
" seconds between heap samples"

has_heap_profile :: Header -> Bool
has_heap_profile h = isJust (hHeapProfileType h)
has_heap_profile h =
case (hHeapProfileType h) of
FromHPFile -> True
FromEventlog t -> isJust t


allHeapTabs :: Header -> Args -> HeapProfileData -> [TabGroup]
allHeapTabs header' as x =
Expand Down
4 changes: 3 additions & 1 deletion src/Eventlog/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ data Header =
Header
{ hJob :: Text
, hDate :: Text
, hHeapProfileType :: Maybe HeapProfBreakdown
, hHeapProfileType :: ProfileType
, hSamplingRate :: Text
, hSampleUnit :: Text
, hValueUnit :: Text
, hCount :: Int
, hProgPath :: Maybe FilePath
} deriving Show

data ProfileType = FromHPFile | FromEventlog (Maybe HeapProfBreakdown) deriving Show


-- The bucket is a key to uniquely identify a band
newtype Bucket = Bucket Text
Expand Down
Loading