on master help sign in
Add a diagnostics flag to debug problems in field
commited0323caed910405b8e939e0128387cd870a55e6 authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 27 May 2018, 09:52 (8 years ago) parentd765444
3 files changed+19−6
.travis.yml+3 src/Streamly/Core.hs+4−3 streamly.cabal+12−3
.travis.yml+3
@@ -69,6 +69,9 @@ matrix:
6969 - env: BUILD=stack CABALVER=2.0 GHCVER=8.2.2 RESOLVER=lts-11 STACK_BUILD_OPTIONS="--flag streamly:examples-sdl"
7070 addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,libsdl1.2-dev], sources: [hvr-ghc]}}
7171
72+ - env: BUILD=stack CABALVER=2.0 GHCVER=8.2.2 RESOLVER=lts-11 STACK_BUILD_OPTIONS="--flag streamly:diag"
73+ addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,libsdl1.2-dev], sources: [hvr-ghc]}}
74+
7275 # Nightly
7376 - env: BUILD=stack RESOLVER=nightly
7477
src/Streamly/Core.hs+4−3
@@ -93,9 +93,10 @@ import GHC.Exts
9393import GHC.Conc (ThreadId(..))
9494import GHC.IO (IO(..))
9595
96−-- MVar diagnostics has some overhead - around 5% on asyncly null benchmark,
97−-- but keep it on for now to debug problems quickly if and when they happen.
98−#define DIAGNOSTICS
96+-- MVar diagnostics has some overhead - around 5% on asyncly null benchmark, we
97+-- can keep it on in production to debug problems quickly if and when they
98+-- happen, but it may result in unexpected output when threads are left hanging
99+-- until they are GCed because the consumer went away.
99100
100101#ifdef DIAGNOSTICS
101102import Control.Exception (catches, throwIO, Handler(..),
streamly.cabal+12−3
@@ -71,18 +71,23 @@ source-repository head
7171 type: git
7272 location: https://github.com/composewell/streamly
7373
74+flag diag
75+ description: Diagnostics build
76+ manual: True
77+ default: False
78+
7479flag dev
75− description: Build development version
80+ description: Development build
7681 manual: True
7782 default: False
7883
7984flag examples
80− description: Build examples
85+ description: Build including examples
8186 manual: True
8287 default: False
8388
8489flag examples-sdl
85− description: Include examples that use SDL dependency
90+ description: Build including SDL examples
8691 manual: True
8792 default: False
8893
@@ -103,7 +108,11 @@ library
103108 default-language: Haskell2010
104109 ghc-options: -Wall
105110
111+ if flag(diag)
112+ cpp-options: -DDIAGNOSTICS
113+
106114 if flag(dev)
115+ cpp-options: -DDIAGNOSTICS
107116 ghc-options: -Wmissed-specialisations
108117 -Wall-missed-specialisations
109118 -fno-ignore-asserts