1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Add 📝 use of BangPatterns

This commit is contained in:
Rick Winfrey 2017-03-09 13:52:30 -08:00
parent df45a039c7
commit 10af2e4715

View File

@ -1,3 +1,4 @@
-- | We use BangPatterns to force evaluation of git operations to preserve accuracy in measuring system stats (particularly disk read bytes)
{-# LANGUAGE RecordWildCards, BangPatterns, DeriveGeneric, RankNTypes #-} {-# LANGUAGE RecordWildCards, BangPatterns, DeriveGeneric, RankNTypes #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
module GitmonClient where module GitmonClient where
@ -77,6 +78,7 @@ reportGitmon' SocketFactory{..} program gitCommand = do
sendAll s $ processJSON Schedule ProcessScheduleData sendAll s $ processJSON Schedule ProcessScheduleData
recv s 1024 recv s 1024
-- | We are eagerly evaluating the gitCommand with BangPatterns. This is to preserve accuracy in measuring the process stats calculated, in particular disk read bytes.
!result <- withGitmonStatus (join gitmonStatus) gitCommand !result <- withGitmonStatus (join gitmonStatus) gitCommand
(afterTime, afterProcIOContents) <- liftIO collectStats (afterTime, afterProcIOContents) <- liftIO collectStats