Skip to content

Commit

Permalink
Merge branch 'remove-logger' into wip/ctrie
Browse files Browse the repository at this point in the history
Also, update submods.
  • Loading branch information
rrnewton committed May 10, 2016
2 parents 090c453 + 9279aaa commit d7c4c7b
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 510 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ docs_examples
test-results.xml
tags
*.stack-work
untracked_junk
2 changes: 1 addition & 1 deletion haskell/ctrie
3 changes: 2 additions & 1 deletion haskell/lvish/Control/LVish.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ import Control.LVish.Internal.Logging (LogMsg (..),
import Control.LVish.Internal.Logical
import Control.LVish.Internal.Types
import Control.Par.EffectSigs
import Data.LVar.IVar
import qualified Control.LVish.Internal.SchedIdempotent as L
import Data.LVar.IVar
import System.Log.TSLogger (LogMsg(..), OutDest(..), DbgCfg(..), defaultMemDbgRange, logOn)

--------------------------------------------------------------------------------

Expand Down
9 changes: 5 additions & 4 deletions haskell/lvish/Control/LVish/Internal/Basics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Control.Monad (forM_)
import Control.Par.EffectSigs
import qualified Control.LVish.Internal.SchedIdempotent as L
import Prelude hiding (rem)
import qualified System.Log.TSLogger as Lg

import qualified Control.Par.Class as PC
import qualified Data.Splittable.Class as SC
Expand Down Expand Up @@ -153,9 +154,9 @@ runParLogged (WrapPar p) = L.runParLogged p
-- This version of runPar catches ALL exceptions that occur within the runPar, and
-- returns them via an Either. The reason for this is that even if an error
-- occurs, it is still useful to observe the log messages that lead to the failure.
--
runParDetailed :: DbgCfg -- ^ Debugging configuration
-> Int -- ^ How many worker threads to use.
--
runParDetailed :: Lg.DbgCfg -- ^ Debugging configuration
-> Int -- ^ How many worker threads to use.
-> (forall s . Par e s a) -- ^ The computation to run.
-> IO ([String], Either SomeException a)
runParDetailed dc nw (WrapPar p) = L.runParDetailed dc nw p
Expand Down Expand Up @@ -208,7 +209,7 @@ getLogger = WrapPar $ L.getLogger
{-# INLINE parForL #-}
-- | Left-biased parallel for loop. As worker threads beyond the first are added,
-- this hews closer to the sequential iteration order than an unbiased parallel loop.
--
--y
-- Takes a range as inclusive-start, exclusive-end.
parForL :: (Int,Int) -> (Int -> Par e s ()) -> Par e s ()
parForL (start,end) _ | start > end = error$"parForL: start is greater than end: "++show (start,end)
Expand Down
471 changes: 0 additions & 471 deletions haskell/lvish/Control/LVish/Internal/Logging.hs

This file was deleted.

5 changes: 3 additions & 2 deletions haskell/lvish/Control/LVish/Internal/SchedIdempotent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ import qualified Control.Exception as E
import qualified Control.Concurrent.Async as A
import Control.DeepSeq
import Control.Applicative
import Control.LVish.Internal.Logging as L
-- import Debug.Trace(trace)
-- import Control.LVish.Internal.Logging as L
import Data.Concurrent.Internal.MonadToss
import Debug.Trace(trace)
import Data.IORef
import Data.Atomics
-- import Data.Typeable
Expand All @@ -70,6 +70,7 @@ import System.Mem.StableName (makeStableName, hashStableName)
import Prelude hiding (mapM, sequence, head, tail)
import qualified Prelude
import System.Random (random)
import System.Log.TSLogger as L
import Text.Printf (printf, hPrintf)

-- import Control.Compose ((:.), unO)
Expand Down
4 changes: 2 additions & 2 deletions haskell/lvish/Control/LVish/Internal/SchedUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import Data.Atomics (atomicModifyIORefCAS)
import System.Random (StdGen, mkStdGen)
import Text.Printf

import qualified Control.LVish.Internal.Logging as L
import Control.LVish.Internal.Types (DbgCfg(..))
import System.Log.TSLogger (DbgCfg(..))
import qualified System.Log.TSLogger as L

#ifdef CHASE_LEV
#warning "Compiling with Chase-Lev work-stealing deque"
Expand Down
23 changes: 1 addition & 22 deletions haskell/lvish/Control/LVish/Internal/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

-- | A simple internal module to factor out types that are used in many places.
module Control.LVish.Internal.Types
( LVishException(..)
, OutDest (..)
, DbgCfg(..))
( LVishException(..) )
where

import Data.Typeable (Typeable)
Expand All @@ -20,22 +18,3 @@ data LVishException = ConflictingPutExn String
deriving (Show, Read, Eq, Ord, Typeable)

instance Exception LVishException

-- | A destination for log messages
data OutDest = -- NoOutput -- ^ Drop them entirely.
OutputEvents -- ^ Output via GHC's `traceEvent` runtime events.
| OutputTo Handle -- ^ Printed human-readable output to a handle.
| OutputInMemory -- ^ Accumulate output in memory and flush when appropriate.

-- | DebugConfig: what level of debugging support is activated?
data DbgCfg =
DbgCfg { dbgRange :: Maybe (Int,Int)
-- ^ Inclusive range of debug messages to accept
-- (i.e. filter on priority level). If Nothing, use the default level,
-- which is (0,N) where N is controlled by the DEBUG environment variable.
-- The convention is to use Just (0,0) to disable logging.
, dbgDests :: [OutDest] -- ^ Destinations for debug log messages.
, dbgScheduling :: Bool
-- ^ In additional to logging debug messages, control
-- thread interleaving at these points when this is True.
}
10 changes: 7 additions & 3 deletions haskell/lvish/lvish.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ library
-- Package-internal and should not be exposed:
Control.LVish.Internal.SchedIdempotent
Control.LVish.Internal.Logging

-- Internal.Data.Concurrent.LinkedMap

-- Internal modules included in this library but not exported:
other-modules:
Expand Down Expand Up @@ -188,9 +188,11 @@ library
build-depends: containers >= 0.5.4.0

build-depends: par-classes >= 1.1 && < 2.0,
par-collections >= 1.1 && < 2.0

par-collections >= 1.1 && < 2.0,
tslogger >= 0.1

ghc-options: -rtsopts -Wall -fno-warn-orphans

if flag(useopt)
ghc-options: -O2

Expand Down Expand Up @@ -242,6 +244,8 @@ test-suite test-lvish

ghc-options: -Wall -fno-warn-orphans

build-depends: tslogger >= 0.1

-- For we duplicate these flag-dependent options:
if flag(useopt)
ghc-options: -O2
Expand Down
3 changes: 2 additions & 1 deletion haskell/lvish/tests/BulkRetryTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import GHC.Conc (numCapabilities)
import Control.LVish
import Control.LVish.DeepFrz (DeepFrz(..), Frzn, Trvrsbl, runParThenFreeze, runParThenFreezeIO)
import Control.LVish.BulkRetry
import qualified Control.LVish.Logging as L
import qualified Data.LVar.Generic as G
import Data.LVar.PureSet as IS
import qualified Data.LVar.SLSet as SS
Expand All @@ -29,6 +28,8 @@ import Data.LVar.NatArray as NA
import Data.Par.Splittable (pforEach)
import Data.Par.Range (range, fullpar)

import qualified System.Log.TSLogger as L

--------------------------------------------------------------------------------

tests :: TestTree
Expand Down
4 changes: 2 additions & 2 deletions haskell/lvish/tests/SetTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import qualified Data.LVar.IVar as IV

import Control.LVish
import Control.LVish.DeepFrz (DeepFrz(..), Frzn, Trvrsbl, runParThenFreeze, runParThenFreezeIO)
import qualified Control.LVish.Internal.Logging as L
import Control.LVish.Internal (liftIO)

import qualified System.Log.TSLogger as L

--------------------------------------------------------------------------------

runTests :: IO ()
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ extra-deps:
- chaselev-deque-0.5.0.5
- bits-atomic-0.1.3
- thread-local-storage-0.1.0.3
- tslogger-0.1.0.0

resolver: lts-5.11

1 comment on commit d7c4c7b

@rrnewton
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it looks like this merge actually caused some problems. Need to fix how the global logger is iniatialized.

We can close #104 when this is fully fixed.

Please sign in to comment.