Skip to content

Commit

Permalink
Install exit handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Nov 13, 2023
1 parent 6dece82 commit c36862a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions haskell-perf.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,4 @@ executable stat-collector
, streamly
, containers
, ansi-terminal
, unix
6 changes: 4 additions & 2 deletions stat-collector-src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Streamly.Internal.Data.Tuple.Strict (Tuple3Fused' (Tuple3Fused'))
import Streamly.Unicode.String (str)
import System.IO (hFlush, stdout, stdin)
import Text.Read (readMaybe)
import System.Posix.Signals (installHandler, Handler(Catch), sigINT, sigTERM)

Check warning on line 28 in stat-collector-src/Main.hs

View workflow job for this annotation

GitHub Actions / 9.4.4-linux cabal-v2 ubuntu-latest 9.4.4

The import of ‘sigTERM’

Check warning on line 28 in stat-collector-src/Main.hs

View workflow job for this annotation

GitHub Actions / 9.2.7-linux cabal-v2 ubuntu-latest 9.2.7

The import of ‘sigTERM’

Check warning on line 28 in stat-collector-src/Main.hs

View workflow job for this annotation

GitHub Actions / 9.0.2-linux cabal-v2 ubuntu-latest 9.0.2

The import of ‘sigTERM’

import qualified Data.Map as Map
import qualified Streamly.Data.Fold as Fold
Expand Down Expand Up @@ -285,12 +286,13 @@ printSlidingStats winSizeList counter rowsOnPage strm =
main :: IO ()
main = do
let rowsOnPage = 50
windowSize = 30
windowSize = 50
counter = CpuTime
freqMeasurementWindow = 30
freqMeasurementWindow = 5
tidToInstrument = 21
mainTag = "server"
lastCounter = Allocated
_ <- installHandler sigINT (Catch $ ANSI.showCursor) Nothing
ANSI.hideCursor
ANSI.clearScreen
(winSizeList, rest) <- Stream.unfold Handle.chunkReader stdin
Expand Down

0 comments on commit c36862a

Please sign in to comment.