diff --git a/Database/Sybase/Sysmon/Average.hs b/Database/Sybase/Sysmon/Average.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/Average.hs
+++ /dev/null
@@ -1,36 +0,0 @@
-{-# LANGUAGE TypeSynonymInstances #-}
-{-# LANGUAGE BangPatterns #-}
-
--- |
--- Module      :  Average
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Defines the class to calculate the average Sysmon report 
-
-module Database.Sybase.Sysmon.Average where
-import Database.Sybase.Sysmon.LogTypes
-import Data.List
-import Data.IntervalMap.FingerTree
-
-class Averageable a where
-  avg :: [a] -> a
-
-instance Averageable Int where
-  avg = fst . foldl' (\(!m, !n) xs -> (m+(xs-m) `div` (n+1),n+1)) (0,0) 
-
-instance Averageable Double where
-  avg = fst . foldl' (\(!m, !n) xs -> (m+(xs-m)/(n+1),n+1)) (0,0)
-
-instance Averageable String where
-  avg [] = ""
-  avg xs = head xs
-
-instance Averageable LogInterval where
-  avg xs = Interval s e where
-   s = foldr1 min $ map low xs
-   e = foldr1 max $ map high xs
diff --git a/Database/Sybase/Sysmon/Derive.hs b/Database/Sybase/Sysmon/Derive.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/Derive.hs
+++ /dev/null
@@ -1,63 +0,0 @@
--- |
--- Module      :  Derive
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Generate average functions for Sysmon data type
-
-module Database.Sybase.Sysmon.Derive where
-import Database.Sybase.Sysmon.Average
-import Language.Haskell.TH
-import Control.Monad
-
-genpe :: String -> Int -> Q ([PatQ],[ExpQ]) 
-genpe s n = do 
-    ns <- replicateM n (newName s)
-    return (map varP ns, map varE ns) 
- 
-deriveAverage t = do
-  TyConI (DataD _ _ _ constructors _) <- reify t
-  let avgClause (RecC name fields) = do
-        ([xsp], [xsv]) <- genpe "xs" 1
-        (pats, vars) <- genpe "x" (length fields)
-
-        let mkApp [x,y] = appE x y
-            mkApp (x:ys) = appE (mkApp (init (x:ys))) (last ys)
-        
-        let vare s = varE (mkName s)   
-        let dec (vp, fld) = valD 
-             vp 
-             (normalB 
-                (appE
-                    (vare "avg") 
-                    (appE 
-                       (appE (vare "map") (varE fld)) 
-                        xsv)
-                )
-             ) []
-
-        let declst (vp, fld) = valD
-             vp
-             (normalB
-               (appE
-                  (appE (vare "map") (vare "avg"))
-                  (appE (vare "transpose") 
-                     (appE 
-                       (appE (vare "map") (varE fld))
-                       xsv)))) []
-
-        let decl (vp, (fld, _, typ)) = case typ of
-                 AppT _ _ -> declst (vp, fld)
-                 _ -> dec (vp, fld)
-
-        let decls = map decl $ zip pats fields
-        clause [xsp] (normalB $ mkApp (conE name : vars)) decls
-
-  body <- mapM avgClause constructors
-  return [InstanceD [] (AppT (ConT $ mkName "Averageable") (ConT t)) 
-           [FunD (mkName "avg") body]
-         ]
diff --git a/Database/Sybase/Sysmon/Log.hs b/Database/Sybase/Sysmon/Log.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/Log.hs
+++ /dev/null
@@ -1,112 +0,0 @@
--- |
--- Module      :  Log
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- The generic api to work with the log reports 
-
-module Database.Sybase.Sysmon.Log 
-  ( Interval (..)
-  , LogRequest
-  , merge
-  , parse
-  , hints 
-  , fmtHints
-  , average
-  , list
-  , intervals
-  , hasInterval
-  , mkInterval
-  ) where
-
-import Data.IntervalMap.FingerTree hiding (empty)
-import Data.DateTime
-import Data.Maybe (fromMaybe)
-import Data.ConfigFile hiding (merge)
-import Control.Monad.State (forM)
-import qualified System.FilePath.Glob as G (compile, globDir1) 
-import System.FilePath (splitFileName)
-import System.IO.Unsafe (unsafePerformIO)
-import System.IO
-import Text.PrettyPrint
-import Database.Sybase.Sysmon.LogTypes
-import Database.Sybase.Sysmon.Average
-
-find :: (LogEntry a) => LogInterval -> LogTree a -> [LogNode a]
-find x = map LogNode . intersections x
-
--- | The request to retrieve data from the LogTree. It can be defined:
--- Just (Interval DateTime) - get data corresponding to the requested interval
--- Nothing - get data corresponding to the max interval from the start of time           
---           to the current time (see function maxInterval)
-type LogRequest = Maybe LogInterval
-
--- | Merge two log trees. (Implemented as union function from 
--- IntervalMap.FingerTree package)
-merge :: LogEntry a => LogTree a -> LogTree a -> LogTree a
-merge = union
-
--- | Parse the log file(s) to the LogTree.  
--- The LogTree is defined as IntervalMap.FingerTree
-parse :: LogEntry a => FilePath -> IO (LogTree a)
-parse path = do
-    let (dir, fp) = splitFileName path
-    fs <- G.globDir1 (G.compile fp) dir
-    if null fs then error $ fp ++ ": No such file or directory"
-      else do
-         mons <- forM fs $ \name -> do
-           h <- openFile name ReadMode
-           c <- hGetContents h
-           return [mkParse c]
-         return $ mkLogTree $ map mkNode (concat mons)
-
--- | Max interval to cover all intervals in the LogTree 
-maxInterval = mkInterval startOfTime (unsafePerformIO getCurrentTime)
-
--- | Get hints for the average sysmon report. To override the default facts constrained
--- use ConfigParser package API. The configuration type (HConfig) and the Sysmon default 
--- configuration parameters (defConfig) are defined in the SysmonHints package.
-hints :: (Averageable a, LogEntry a) => LogRequest -> ConfigParser -> LogTree a -> [Hint]
-hints x cp = mkHints cp . average x 
-
--- | Pretty print the hints
-fmtHints :: [Hint] -> Doc
-fmtHints hs = vcat [text "Hints:", foldr fmtHint empty hs]
-  where
-    fmtHint (ruleId, msg, details) doc = 
-       vcat [doc, 
-             vcat [nest 2 (text msg), 
-                   nest 4 (text $ show details), 
-                   nest 6 (text "Rule Name:" <+> text ruleId) 
-                  ]
-            ]
-
--- | Average sysmon report calculated from the reports corresponding
--- to the intersection of the requested interval and LogTree intervals. 
-average :: (Averageable a, LogEntry a) => LogRequest -> LogTree a -> a        
-average x = avg . list x
-
--- | Get log reports from LogTree which intervals intersect
--- with the requested interval 
-list :: LogEntry a => LogRequest -> LogTree a -> [a]
-list x = map (\(LogNode x) -> snd x) . find (fromMaybe maxInterval x)
-
--- | Get intervals LogTree which intervals intersect
--- with the requested interval 
-intervals :: LogEntry a => LogRequest -> LogTree a -> [LogInterval]
-intervals x = map (\(LogNode x) -> fst x) . find (fromMaybe maxInterval x)
-
--- | Check if the requested interval intersects with intervals from LogTree
-hasInterval :: LogEntry a => LogRequest -> LogTree a -> Bool
-hasInterval x = not . null . intervals x
-
--- | Create log interval
-mkInterval :: DateTime -> DateTime -> LogInterval
-mkInterval = Interval
-
-
-
diff --git a/Database/Sybase/Sysmon/LogParserPrim.hs b/Database/Sybase/Sysmon/LogParserPrim.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/LogParserPrim.hs
+++ /dev/null
@@ -1,115 +0,0 @@
--- |
--- Module      :  LogParserPrim
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Log files parsing primitives 
-
-module Database.Sybase.Sysmon.LogParserPrim 
-       ( LogState (..)
-       , Field
-       , matchLine
-       , matchField
-       , optLine
-       , optString
-       , optField
-       , string
-       , field
-       , look
-       , lookAhead
-       , whileJust
-       , goto
-       ) where
-import Data.List
-import Data.DateTime
-import Control.Monad.State
-
-type LogState a = State [String] a 
-type Field = String
-
--- | Discard until predicate and split a string to the fields
-line :: (String -> Bool) -> LogState [Field]
-line p = do
-   xs <- get
-   let ys = dropWhile (not . p)  xs   
-   if null ys then do
-      put ys
-      return []
-    else do
-      put $ drop 1 ys
-      return $ (words . head) ys 
-
--- | Recursively collect values contained in the Just  
-whileJust :: Monad m => m (Maybe a) -> m [a]
-whileJust p = do
-  x <- p
-  case x of
-    Nothing -> return mzero
-    Just x -> do
-      xs <- whileJust p
-      return $ return x `mplus` xs
-
--- | Get field after discarding the prefix 
-matchField :: Read a => String -> Int -> LogState a
-matchField s i = do
-  ls <- line (isInfixOf s)
-  return $ field i ls
-
--- | Get fields after discarding the prefix
-matchLine :: String -> LogState [Field]
-matchLine s = line (isInfixOf s) 
-
--- | Parse string to the field value
-field :: Read a => Int -> [Field] -> a
-field i xs = read $ xs !! i
-
--- | Concatenate fields to the string value
-string :: Int -> Int -> [Field] -> Field
-string i j = unwords . take (j - i) . drop i
-
--- | Look ahead for the first substring until the second substring 
-look :: String -> String -> LogState Bool
-look s f = lookAhead (isInfixOf s) (isInfixOf f) 
-
--- | Get fields if the first substring matches otherwise return empty
-optLine :: String -> String -> LogState [Field]
-optLine f g = do
-  b <- lookAhead (isInfixOf f) (isInfixOf g)
-  if b then matchLine f
-   else return []
-
--- | Get field if the first substring matches otherwise return a default value
-optField :: Read a => String -> String -> Int -> a -> LogState a
-optField f g i x = do
-  b <- lookAhead (isInfixOf f) (isInfixOf g)
-  if b then do 
-      h <- matchLine f
-      return $ field i h
-     else return x
-
--- | Get string field if the first substring matches otherwise return 
--- a default value
-optString :: String -> String -> Int -> Int -> String -> LogState Field
-optString f g i j x = do
-  b <- lookAhead (isInfixOf f) (isInfixOf g)
-  if b then do 
-      h <- matchLine f
-      return $ string i j h
-     else return x
-
--- | Discard the matching lines 
-goto :: [String] -> LogState [Field]
-goto ss = do 
-  mapM_ matchLine ss
-  return []
-
--- | Test the first predicate until the second predicate  
-lookAhead :: (String -> Bool) -> (String -> Bool) -> LogState Bool
-lookAhead p g = do
-   xs <- get
-   let ys = dropWhile (\x -> (not . p) x && (not . g) x) xs
-   if null ys || g (head ys) then return False else return True
diff --git a/Database/Sybase/Sysmon/LogTypes.hs b/Database/Sybase/Sysmon/LogTypes.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/LogTypes.hs
+++ /dev/null
@@ -1,53 +0,0 @@
--- |
--- Module      :  LogTypes
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Generic log objects and types.
-
-module Database.Sybase.Sysmon.LogTypes where
-import Data.IntervalMap.FingerTree
-import Data.ConfigFile (ConfigParser)
-import Data.DateTime
-import Text.Printf
-
--- | Hint is defined as the triple of the rule name, 
--- rule action (text message) and rule conditions
-type Hint = (RuleId, Action, Facts)
-type Facts = [String]
-type Result = (Bool, Facts)
-type RuleId = String
-type Action = String
-
--- | LogTree implemented as IntervalMap.FingerTree  
-type LogTree a = IntervalMap DateTime a
-
--- | The key to look for the data in the LogTree
-type LogInterval = Interval DateTime
-
--- | The nodes of the LogTree
-data LogNode a = LogNode (LogInterval, a)
-
--- | Operations to parse log data, make LogTree and generate hints  
-class LogEntry a where
-  mkNode :: a -> LogNode a
-  mkParse :: String -> a
-  mkHints :: ConfigParser -> a -> [Hint]
-  mkLogTree :: [LogNode a] -> LogTree a
-  mkLogTree = foldr ins empty where
-     ins (LogNode (i, e)) = insert i e
-
--- | Format facts data
-class (Show a) => LogShow a where
-  lshow :: a -> String
-  lshow = show
-
-instance LogShow Int
-instance LogShow Integer
-instance LogShow Bool
-instance LogShow Double where
-  lshow = printf "%.2f"
diff --git a/Database/Sybase/Sysmon/SysmonHints.hs b/Database/Sybase/Sysmon/SysmonHints.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/SysmonHints.hs
+++ /dev/null
@@ -1,319 +0,0 @@
--- |
--- Module      :  SysmonHints
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Generate the Sysmon hints (suggestions) by comparing the data from sysmon 
--- report to the corresponding data from the configuration. 
-
-module Database.Sybase.Sysmon.SysmonHints 
-       (
-         HConfig (..)
-       , sysmonHints
-       ) where
-import Database.Sybase.Sysmon.Log
-import Database.Sybase.Sysmon.LogTypes
-import Database.Sybase.Sysmon.SysmonTypes
-import Text.Printf
-import Statistics.Sample
-import Control.Monad.Reader
-import Data.Vector (fromList)
-import Data.ConfigFile
-import Data.Either.Utils (forceEither)
-
-type HintEnv a = Reader HConfig a
-
--- | Sysmon configuration type
-data HConfig = HConfig {
-  hiCPU :: !Double,
-  hiIO :: !Double,
-  hiIdle :: !Double,
-  hiCheckDiskIO :: !Double,
-  loAvgDiskIO :: !Double,
-  hiStdDeviation :: !Double,
-  hiSwitchPerTransaction :: !Double,
-  hiContextSwitchDue :: !Double,
-  hiDirtyBuffers :: !Double,
-  loCacheHits :: !Double,
-  hiCacheWash :: !Double,
-  loLargeIO :: !Double,
-  hiUlcSemRequests :: !Double,
-  hiLogSemRequests :: !Double,  
-  hiAvgLogWrites :: !Double,
-  hiCommitedTrans :: !Int,
-  hiPageSplits :: !Int,
-  hiLockSummary :: !Double,
-  hiDeadlock :: !Double,
-  hiLastPageLock :: !Double,
-  hiLockPromotions :: !Int,
-  loCacheSpinContention :: !Double,
-  ioDelayBy :: !String
-}
-
--- | Default configuration. To override the default configuration item
--- use ConfigFile package API. 
-defConfig = forceEither $ do 
-  let cp = emptyCP
-  cp <- set cp "DEFAULT" "hiCPU" (show 85.0)
-  cp <- set cp "DEFAULT" "hiIO" (show 50.0)
-  cp <- set cp "DEFAULT" "hiIdle" (show 30.0)
-  cp <- set cp "DEFAULT" "hiCheckDiskIO" (show 50.0)
-  cp <- set cp "DEFAULT" "loCacheHits" (show 90.0)
-  cp <- set cp "DEFAULT" "hiCacheWash" (show 5.0)
-  cp <- set cp "DEFAULT" "loLargeIO" (show 90.0)
-  cp <- set cp "DEFAULT" "loAvgDiskIO" (show 0.005)
-  cp <- set cp "DEFAULT" "hiStdDeviation" (show 30.0)
-  cp <- set cp "DEFAULT" "hiSwitchPerTransaction" (show 60.0)
-  cp <- set cp "DEFAULT" "hiContextSwitchDue" (show 10.0)
-  cp <- set cp "DEFAULT" "hiDirtyBuffers" (show 3.0)
-  cp <- set cp "DEFAULT" "hiUlcSemRequests" (show 10.0)
-  cp <- set cp "DEFAULT" "hiLogSemRequests" (show 10.0)
-  cp <- set cp "DEFAULT" "hiAvgLogWrites" (show 1.0)
-  cp <- set cp "DEFAULT" "hiCommitedTrans" (show 50)
-  cp <- set cp "DEFAULT" "hiPageSplits" (show 10)
-  cp <- set cp "DEFAULT" "hiLockSummary" (show 10.0)
-  cp <- set cp "DEFAULT" "hiDeadlock" (show 10.0)
-  cp <- set cp "DEFAULT" "hiLastPageLock" (show 10.0)
-  cp <- set cp "DEFAULT" "hiLockPromotions" (show 20)
-  cp <- set cp "DEFAULT" "loCacheSpinContention" (show 10.0)
-  cp <- set cp "DEFAULT" "ioDelayBy" "Disk"
-  return cp
-
--- | Create Sysmon configuration from ConfigParser
-mkConfig :: ConfigParser -> HConfig
-mkConfig c = let cp = Data.ConfigFile.merge defConfig c in
-  HConfig {
-    hiCPU = forceEither $ get cp "Sysmon" "hiCPU",
-    hiIO = forceEither $ get cp "Sysmon" "hiIO",
-    hiIdle = forceEither $ get cp "Sysmon" "hiIdle",
-    hiCheckDiskIO = forceEither $ get cp "Sysmon" "hiCheckDiskIO",
-    loCacheHits = forceEither $ get cp "Sysmon" "loCacheHits",
-    hiCacheWash = forceEither $ get cp "Sysmon" "hiCacheWash",
-    loLargeIO = forceEither $ get cp "Sysmon" "loLargeIO",
-    loAvgDiskIO = forceEither $ get cp "Sysmon" "loAvgDiskIO",
-    hiStdDeviation = forceEither $ get cp "Sysmon" "hiStdDeviation",
-    hiSwitchPerTransaction = forceEither $ get cp "Sysmon" "hiSwitchPerTransaction",
-    hiContextSwitchDue = forceEither $ get cp "Sysmon" "hiContextSwitchDue",
-    hiDirtyBuffers = forceEither $ get cp "Sysmon" "hiDirtyBuffers",
-    hiUlcSemRequests = forceEither $ get cp "Sysmon" "hiUlcSemRequests",
-    hiLogSemRequests = forceEither $ get cp "Sysmon" "hiLogSemRequests",
-    hiAvgLogWrites = forceEither $ get cp "Sysmon" "hiAvgLogWrites",
-    hiCommitedTrans = forceEither $ get cp "Sysmon" "hiCommitedTrans",
-    hiPageSplits = forceEither $ get cp "Sysmon" "hiPageSplits",
-    hiLockSummary = forceEither $ get cp "Sysmon" "hiLockSummary",
-    hiDeadlock = forceEither $ get cp "Sysmon" "hiDeadlock",
-    hiLastPageLock = forceEither $ get cp "Sysmon" "hiLastPageLock",
-    hiLockPromotions = forceEither $ get cp "Sysmon" "hiLockPromotions",
-    loCacheSpinContention = forceEither $ get cp "Sysmon" "loCacheSpinContention",
-    ioDelayBy = forceEither $ get cp "Sysmon" "ioDelayBy"
-  }
-
-eval :: Sysmon -> HintEnv [Hint]
-eval s = do
-   e <- ask 
-   let results = [(id, foldResult [r s e | r <- rs] (&&), action) | 
-                  (id, rs, action) <- fs
-                 ]
-   return [(id,action,facts) | (id, (b, facts), action) <- results, b]
-
-sysmonHints :: ConfigParser -> Sysmon -> [Hint]
-sysmonHints cnf s = runReader (eval s) (mkConfig cnf)
-
-percent i t = fromIntegral i / fromIntegral t * 100.0
-
-result :: (LogShow a) => Bool -> [String] -> [a] -> Result
-result b fs ys = (b, [f ++ " = " ++ lshow y | (f,y) <- zip fs ys, b])
-
-foldResult :: [Result] -> (Bool -> Bool -> Bool) -> Result
-foldResult ds cond = foldr1 f ds where
-    f (b, s) (b', s') = (cond b b', if b then s ++ s' else s') 
-
--- | Kernel contention 
-checkCpuBusy s e = 
-     let busy = avgCpuBusy $ kernel s 
-         b = busy >= hiCPU e in
-       result b ["CPU Busy"] [busy]
-
-checkCpuIdle s e = 
-     let busy = avgCpuBusy $ kernel s 
-         b = busy <= 100.0 - hiCPU e in
-       result b ["CPU Idle"] [100.0 - busy]
-
-checkIOEngine s e = 
-     let iobusy = avgIOBusy $ kernel s
-         cpubusy = avgCpuBusy $ kernel s
-         b = iobusy >= hiIO e && cpubusy <= (100.0 - hiCPU e) in
-       result b ["Engine IO Busy", "Engine CPU Busy"] [iobusy, cpubusy]
-
-checkIODisk s e =
-    let checkIO = checkDiskIO $ kernel s
-        avgIO = avgDiskIO $ kernel s
-        b = checkIO >= hiCheckDiskIO e && avgIO <= loAvgDiskIO e in
-     result b ["Check Disk IO", "Average Disk IO"] [checkIO, avgIO]
-
--- | Task contention
-checkEngineBalance s e =
-    let ts = taskSwitch $ task s
-        sd = stdDev $ fromList $ map (fromIntegral.numSwitch) ts
-        b = sd >= hiStdDeviation e in
-     result b ["Standard deviation"] [sd]
-
-checkSwitchesPerTran s e =
-    let ts = totSwitch $ task s
-        tr = commited $ transaction s
-        pt = if tr == 0 then 0 
-               else fromIntegral ts / fromIntegral tr
-        b = pt >= hiSwitchPerTransaction e in
-      result b ["Context switches per transaction"] [pt]
-
-checkContextSwitches s e = 
-     let sw = taskSwitchDue $ task s
-         cs = [(cacheSearchMiss, "Cache Search Misses"), 
-               (diskWrites, "System Disk Writes"), 
-               (batchSize, "Exceeding I/O batch size"), 
-               (logicLockCont, "Logical Lock Contention"),
-               (addrLockCont, "Address Lock Contention"), 
-               (latchCont, "Latch Contention"), 
-               (semCont, "Log Semaphore Contention"), 
-               (plcLockCont, "PLC Lock Contention"),
-               (lastLogPage, "Last Log Page Writes"), 
-               (conflicts, "Modify Conflicts"), 
-               (deviceCont, "I/O Device Contention"), 
-               (netSent, "Network Packet Sent"),
-               (netServices, "Network services"), 
-               (other, "Other Causes")
-              ]
-
-         conv (f, x) = let res = percent (f sw) (totSwitchDue sw) in (x, res)
-         rs = unzip $ filter (\(_,res) -> res >= hiContextSwitchDue e) $ 
-                               map conv cs
-         b = not $ null $ fst rs in
-       uncurry (result b) rs
-     
--- | Transaction contention 
-checkUlcCont s e = 
-     let req = ulsSemReqs $ transaction s
-         cont = percent (waited req) (totReq req) 
-         b = cont >= hiUlcSemRequests e in
-      result b ["ULC Semaphore Contention"] [cont]
-
-checkLogCont s e = 
-     let req = logSemReqs $ transaction s
-         cont = percent (waited req) (totReq req) 
-         b = cont >= hiLogSemRequests e in
-      result b ["Log Semaphore Contention"] [cont]
-
-checkAvgLogWrites s e =
-     let trans = commited $ transaction s
-         avgWrites = avgLogWrites $ transaction s
-         b = trans >= hiCommitedTrans e && avgWrites >= hiAvgLogWrites e in
-      result b ["Avg # Writes per Log Page"] [avgWrites]
-
--- | Index contention 
-checkPageCont s e = 
-     let cont = splits $ index s 
-         b = cont >= hiPageSplits e in
-      result b ["Page Splits"] [cont]
-
--- | Lock contention 
-checkLockCont s e = 
-     let cont = percent (lockCont $ lock s) (lockReqs $ lock s) 
-         b = cont >= hiLockSummary e in
-      result b ["Average Lock Contention"] [cont]
-
-checkDeadlocks s e =
-     let cont = percent (deadlocks $ lock s) (lockReqs $ lock s)
-         b = cont >= hiDeadlock e in
-       result b ["Deadlock Percentage"] [cont]
-
-checkLastPageLocks s e =
-      let cont = percent (waited $ lpLock $ lock s) (totReq $ lpLock $ lock s)
-          b = cont >= hiLastPageLock e in
-       result b ["Last Page Lock"] [cont]
-
-checkLockPromotion s e =
-      let b = promotions (lock s) >= hiLockPromotions e in
-       result b ["Lock Promotions"] [promotions $ lock s]
-     
--- | Cache contention 
-verifyNamedCache cache field valid msg  = 
-     let res c = (cacheName c, field c) 
-         ps = map res (caches cache) 
-         cs = unzip $ filter (\(_, val) -> valid val) ps
-         b = not $ null $ fst cs in
-       result b (map (++ msg) $ fst cs) (snd cs)
-
-checkCacheTurnover s e =
-      let db = (dirtyBuffers.cache) s
-          b = db >= hiDirtyBuffers e in
-        result b ["Buffers Grabbed Dirty"] [db] 
-
-checkSpinCont s e =
-      let valid val = val > 0 && val <= loCacheSpinContention e in
-        verifyNamedCache (cache s) spinContention valid ".Spinlock contention"       
-
-checkCacheHits s e =
-      let valid val = val > 0 && val <= loCacheHits e 
-          field c = percent (hits c) (totHitsMiss c) in  
-         verifyNamedCache (cache s) field valid ".Hits"
-
-checkCacheWash s e =
-      let valid val = val >= hiCacheWash e
-          field c = percent (wash c) (totHitsMiss c) in  
-         verifyNamedCache (cache s) field valid ".Wash"
-
-checkCacheLargeIO s e =
-       let valid val = val <= loLargeIO e 
-           field c = percent (largeIO c) (largeIOTotal c) in  
-         verifyNamedCache (cache s) field valid ".Large IO"
-
--- | Group checks
-checkIOBusy s e =
-     let checkset = [checkIOEngine, checkIODisk] in 
-       foldResult [r s e | r <- checkset] (&&)  
-
-checkResourceCont s e =
-      let checkset = [checkContextSwitches, checkSpinCont, checkUlcCont, 
-                     checkLogCont, checkPageCont, checkLockCont] in 
-       foldResult [r s e | r <- checkset] (||)  
-
--- | Sysmon rules       
-fs = 
-   [
-   ("ruleMoreEngines", 
-     [checkCpuBusy, checkResourceCont], 
-     "Consider to increase the number of engines"),
-   ("ruleLessEngines", 
-     [checkCpuIdle], 
-     "Consider to decrease the number of engines"),
-   ("rulesEnginesBalance", 
-     [checkEngineBalance], 
-     "Engines are unbalanced regarding task context switches"),
-   ("ruleSwitchPerTransaction", 
-     [checkSwitchesPerTran], 
-     "The increasing number of the context switches  per transaction"),
-   ("ruleContextSwitchDue", 
-     [checkContextSwitches], 
-     "Consider resources tuning to decrease the context switches due to"),
-   ("ruleIOBusy", 
-     [checkIOBusy], 
-     "The job is IO bound"),
-   ("ruleCacheContention", 
-    [checkCacheTurnover, 
-     checkSpinCont, 
-     checkCacheHits, 
-     checkCacheWash, 
-     checkCacheLargeIO], 
-    "Cache contention"),
-   ("ruleLockContention", 
-     [checkLockCont, 
-      checkDeadlocks, 
-      checkLastPageLocks, 
-      checkLockPromotion], 
-     "Lock contention")
-   ]
-
diff --git a/Database/Sybase/Sysmon/SysmonLog.hs b/Database/Sybase/Sysmon/SysmonLog.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/SysmonLog.hs
+++ /dev/null
@@ -1,285 +0,0 @@
--- |
--- Module      :  SysmonLog
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Parse Sybase 15 Sysmon report 
-
-module Database.Sybase.Sysmon.SysmonLog 
-       ( parseSysmon
-       ) where
-import Database.Sybase.Sysmon.LogTypes
-import Database.Sybase.Sysmon.LogParserPrim
-import Database.Sybase.Sysmon.Log (parse, Interval(..))
-import Database.Sybase.Sysmon.SysmonTypes
-import Database.Sybase.Sysmon.SysmonHints
-import Control.Monad.State
-import Data.List (isInfixOf)
-import Data.Maybe (fromJust)
-import Data.DateTime
-
-instance LogEntry Sysmon where
-  mkNode s = LogNode (sysmonTime s, s)
-  mkParse str = evalState getSysmon (lines str)
-  mkHints = sysmonHints
-
-parseSysmon :: FilePath -> IO (LogTree Sysmon)
-parseSysmon = parse
-
-getTimeInterval :: LogState LogInterval
-getTimeInterval = do
-   start <- matchLine "Sampling Started at:"
-   end <- matchLine "Sampling Ended at:"
-   let parse = fromJust . parseDateTime "%b %d, %Y %H:%M:%S" . concat . drop 3
-   return $ Interval (parse start) (parse end)
-
-getKernel :: LogState Kernel
-getKernel = do
-   goto ["Kernel Utilization", "Engine Busy Utilization", "-"]
-   engBusy <- whileJust getEngineBusy
-
-   avg <- matchLine "Average"
-   let avgCpu = field 1 avg
-   let avgIO = field 3 avg
-
-   goto ["CPU Yields by Engine", "-"]
-   cpuYlds <- whileJust getCpuYield
-   let totYlds = sum $ map yields cpuYlds
-
-   chk <- matchLine "Checks Returning I/O"
-   let checkDiskIO = field 6 chk
-
-   avd <- matchLine "Avg Disk I/Os Returned"
-   let avgDiskIO = field 6 avd
-
-   return $ Kernel engBusy cpuYlds avgCpu avgIO totYlds checkDiskIO avgDiskIO
-
-getEngineBusy :: LogState (Maybe EngineBusy)
-getEngineBusy = do
-   b <- look "Engine " "CPU Yields by Engine"
-   if b then do 
-        eng <- matchLine "Engine "
-        let name = string 0 2 eng
-        let cpu = field 2 eng
-        let io = field 4 eng
-        return $ Just $ EngineBusy name cpu io
-     else return Nothing
-
-getCpuYield :: LogState (Maybe CpuYield)
-getCpuYield = do
-   b <- look "Engine " "Network Checks"
-   if b then do 
-        eng <- matchLine "Engine "
-        let engName = string 0 2 eng 
-        let yields = field 4 eng
-        return $ Just $ CpuYield engName yields
-     else return Nothing
-
-getTask :: LogState Task
-getTask = do
-  goto ["Task Management"]
-  con <- matchField "Connections" 4
-
-  taskSwitch <- whileJust getTaskSwitch
-  switchDue <- getTaskSwitchDue
-
-  let totSwitch = sum $ map numSwitch taskSwitch
-  return $ Task con taskSwitch switchDue totSwitch
-
-getTaskSwitch :: LogState (Maybe TaskSwitch)
-getTaskSwitch = do
-   b <- look "Engine " "Total Task Switches"
-   if b then do 
-        eng <- matchLine "Engine "
-        let name = string 0 2 eng
-        let count = field 4 eng
-        return $ Just $ TaskSwitch name count
-     else return Nothing
-
-getTaskSwitchDue :: LogState TaskSwitchDue
-getTaskSwitchDue = do
-  yields <- matchField "Voluntary Yields" 4
-  misses <- matchField "Cache Search Misses" 5
-  batch  <- matchField "Exceeding I/O batch size" 6
-  disk   <- matchField "System Disk Writes" 5
-  lcont  <- matchField "Logical Lock Contention" 5
-  acont  <- matchField "Address Lock Contention" 5
-  latch  <- matchField "Latch Contention" 4
-  sem    <- matchField "Log Semaphore Contention" 5
-  plc    <- matchField "PLC Lock Contention" 5
-  sleeps <- matchField "Group Commit Sleeps" 5
-  last   <- matchField "Last Log Page Writes" 6
-  confts <- matchField "Modify Conflicts" 4
-  device <- matchField "I/O Device Contention" 5
-  rcvd   <- matchField "Network Packet Received" 5
-  sent   <- matchField "Network Packet Sent" 5
-  srvs   <- matchField "Network services" 4
-  other  <- matchField "Other Causes" 4
-
-  let totSwitchDue = yields + misses + batch + disk + lcont + acont +
-                     latch + sem + plc + sleeps + last + confts + device +
-                     rcvd + sent + srvs + other
-
-  return $ TaskSwitchDue yields misses batch disk lcont acont latch sem plc
-                         sleeps last confts device rcvd sent srvs other totSwitchDue
-
-getTransaction :: LogState Transaction
-getTransaction = do
-  goto ["Transaction Profile"]
-
-  commits <- optField "Committed Xacts" "Transaction Detail" 4 0
-  inserts <- matchField "Total Rows Inserted" 5
-  updates <- matchField "Total Rows Updated" 5
-  deletes <- matchField "Total Rows Deleted" 5
-  flushes <- getUlcFlush 
- 
-  ulsReqs <- getRequest "ULC Semaphore Requests"
-  logReqs <- getRequest "Log Semaphore Requests"
-
-  logWrites <- optField "Avg # Writes per Log Page" "Index Management" 8 0
-  return $ Transaction commits inserts updates deletes flushes ulsReqs logReqs logWrites
-
-getUlcFlush :: LogState UlcFlush
-getUlcFlush = do
-  ulc <- matchField "by Full ULC" 5
-  tran <- matchField "by End Transaction" 5
-  db <- matchField "by Change of Database" 6
-  log <- matchField "by Single Log Record" 6
-  unpin <- matchField "by Unpin" 4
-  other <- matchField "by Other" 4
-
-  let totFlush = ulc + tran + db + log + unpin + other
-  return $ UlcFlush ulc tran db log unpin other totFlush
- 
-getRequest :: String -> LogState Request
-getRequest label = do
-  goto [label]
-  granted <- optField "Granted" "Total" 3 0
-  waited <- optField "Waited" "Total" 3 0
-  return $ Request granted waited (granted + waited)
-  
-getIndex :: LogState Index
-getIndex = do
-  goto ["Index Management"]
-  splits <- matchField "Page Splits" 4
-  shrinks <- matchField "Page Shrinks" 4
-  return $ Index splits shrinks
-
-getLock :: LogState Lock
-getLock = do
-  goto ["Lock Management"]
-  lockReqs <- matchField "Total Lock Requests" 5
-  lockCont <- matchField "Avg Lock Contention" 5
-  dlocks <- matchField "Deadlock Percentage" 4
-  exTable <- getRequest "Exclusive Table"
-  shTable <- getRequest "Shared Table"
-  exIntent <- getRequest "Exclusive Intent"
-  shIntent <- getRequest "Shared Intent"
-  exPage <- getRequest "Exclusive Page"
-  upPage <- getRequest "Update Page"
-  shPage <- getRequest "Shared Page"
-  exRow <- getRequest "Exclusive Row"
-  upRow <- getRequest "Update Row"
-  shRow <- getRequest "Shared Row"
-  exAddress <- getRequest "Exclusive Address"
-  shAddress <- getRequest "Shared Address"
-  lpLock <- getRequest "Last Page Locks on Heaps"
-
-  prom <- matchField "Total Lock Promotions" 5
-  tout <- matchField "Total Timeouts" 4
-
-  return $ Lock lockReqs lockCont dlocks exTable shTable exIntent shIntent exPage
-                upPage shPage exRow upRow shRow exAddress shAddress lpLock prom tout
-
-getCache :: LogState Cache
-getCache = do  
-  hits <- optField "Total Cache Hits" "Total Cache Searches" 5 0
-  misses <- optField "Total Cache Misses" "Total Cache Searches" 5 0 
-  dirtyBuffers <- optField "Buffers Grabbed Dirty" "Cache Strategy Summary" 6 0
-  caches <- whileJust getNamedCache
-
-  return $ Cache hits misses dirtyBuffers (hits+misses) caches --totCache caches
-
-getNamedCache :: LogState (Maybe NamedCache)
-getNamedCache = do
-  cache <- optString "Cache: " "Procedure Cache Management" 1 2 ""
-  if null cache then return Nothing
-   else do    
-    spin <- matchField "Spinlock Contention" 5
-    util <- matchField "Utilization" 4 
-    hits <- optField "Cache Hits" "Total Cache Searches" 4 0
-    wash <- optField "Found in Wash" "Total Cache Searches" 5 0
-    miss <- optField "Cache Misses" "Total Cache Searches" 4 0
-    perf <- optField "Large I/Os Performed" "Total Large I/O Requests" 5 0
-    reqs <- matchField "Total Large I/O Requests" 6    
-    return $ Just $ NamedCache cache spin util hits wash miss (hits + miss) perf reqs
-
-getDisk :: LogState Disk
-getDisk = do
-    goto ["Disk I/O Management"]
-    engIO <- whileJust getEngineIO
-
-    diskIO <- matchField "Disk I/O Structures" 5
-    server <- matchField "Server Config Limit" 5
-    engine <- matchField "Engine Config Limit" 5
-    os <- matchField "Operating System Limit" 5
-    reqIO <- matchField "Total Requested Disk I/Os" 6
-
-    goto ["-"]
-    comIO <- matchField "Total Completed I/Os" 5
-    dev <- whileJust getDevice
-
-    return $ Disk engIO diskIO server engine os reqIO comIO dev
-
-getEngineIO :: LogState (Maybe EngineIO)
-getEngineIO = do
-    b <- look "Engine " "I/Os Delayed by"
-    if b then do 
-        engIO <- matchLine "Engine "
-        let name = string 0 2 engIO
-        let outIO = field 4 engIO
-        return $ Just $ EngineIO name outIO
-     else return Nothing
-
-getDevice :: LogState (Maybe Device)
-getDevice = do
-     name <- optString "Device: " "Network I/O Management" 0 1 ""
-     if null name then return Nothing
-      else do    
-        totIO <- matchField "Total I/Os" 4
-        return $ Just $ Device name totIO
-
-getSysmon :: LogState Sysmon
-getSysmon = do
-   time <- getTimeInterval
-   kernel <- getKernel
-   task <- getTask
-   transaction <- getTransaction
-   index <- getIndex
-   lock <- getLock
-   cache <- getCache
-   disk <- getDisk
-
-   return $ Sysmon time kernel task transaction 
-                   index lock cache disk 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Database/Sybase/Sysmon/SysmonTypes.hs b/Database/Sybase/Sysmon/SysmonTypes.hs
deleted file mode 100644
--- a/Database/Sybase/Sysmon/SysmonTypes.hs
+++ /dev/null
@@ -1,196 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-
--- |
--- Module      :  SysmonTypes
--- Copyright   :  (c) Vitaliy Rukavishnikov 2011
--- License     :  BSD-style (see the file LICENSE)
--- 
--- Maintainer  :  virukav@gmail.com
--- Stability   :  experimental
--- Portability :  non-portable
---
--- Sysmon report types
-
-module Database.Sybase.Sysmon.SysmonTypes where
-import Database.Sybase.Sysmon.Log
-import Database.Sybase.Sysmon.LogTypes
-import Database.Sybase.Sysmon.Average
-import Database.Sybase.Sysmon.Derive
-import Data.List (transpose) 
-
-data EngineBusy = EngineBusy {
-  name :: String,
-  cpuBusy :: Double,
-  ioBusy :: Double
-} deriving (Show)
-
-data CpuYield = CpuYield {
-  engName :: String,
-  yields :: Int
-} deriving (Show)
-
-data Kernel = Kernel {
-  engBusy :: [EngineBusy],
-  cpuYlds :: [CpuYield], 
-  avgCpuBusy :: Double,
-  avgIOBusy :: Double,  
-  totYlds :: Int,
-  checkDiskIO :: Double,
-  avgDiskIO :: Double
-} deriving (Show)
-
-data TaskSwitch = TaskSwitch {
-  byEngine :: String,
-  numSwitch :: Int
-} deriving (Show)
-
-data TaskSwitchDue = TaskSwitchDue {
-  volYields :: Int,
-  cacheSearchMiss :: Int,
-  batchSize :: Int,
-  diskWrites :: Int,
-  logicLockCont :: Int,
-  addrLockCont :: Int,
-  latchCont :: Int,
-  semCont :: Int,
-  plcLockCont :: Int,
-  comtSleeps :: Int,
-  lastLogPage :: Int,
-  conflicts :: Int,
-  deviceCont :: Int,
-  netReceived :: Int,
-  netSent :: Int,
-  netServices :: Int,
-  other :: Int,
-  totSwitchDue :: Int
-} deriving (Show)
-
-data Task = Task {
-  connections :: Int,
-  taskSwitch :: [TaskSwitch],
-  taskSwitchDue :: TaskSwitchDue,
-  totSwitch :: Int
-} deriving (Show)
-
-data Transaction = Transaction {
-  commited :: Int,
-  inserts :: Int,
-  updates :: Int,
-  deletes :: Int,  
-  flushes :: UlcFlush,
-  ulsSemReqs :: Request,
-  logSemReqs :: Request,
-  avgLogWrites :: Double
-} deriving (Show)
-
-data Request = Request {
-  granted :: Int,
-  waited :: Int,
-  totReq :: Int
-} deriving (Show)
-
-data UlcFlush = UlcFlush {
-  fullUlc :: Int,
-  endTran :: Int,
-  changeDB :: Int,
-  logRecord :: Int,
-  byUnpin :: Int,
-  byOther :: Int,
-  totFlush :: Int
-} deriving (Show)
-
-data Index = Index {
-  splits :: Int,
-  shrinks :: Int    
-} deriving (Show)
-
-data Lock = Lock {
-  lockReqs :: Int,
-  lockCont :: Int,
-  deadlocks :: Int,
-  exTable :: Request,
-  shTable :: Request,  
-  exIntent :: Request,
-  shIntent :: Request,
-  exPage :: Request,
-  upPage :: Request,
-  shPage :: Request,
-  exRow :: Request,
-  upRow :: Request,
-  shRow :: Request,
-  exAddress :: Request,
-  shAddress :: Request,
-  lpLock :: Request,
-  promotions :: Int,
-  timeouts :: Int
-} deriving (Show)
-
-data Cache = Cache {
-  cacheHits :: Int,
-  cacheMisses :: Int,
-  dirtyBuffers :: Double,
-  totCache :: Int,
-  caches :: [NamedCache]
-} deriving (Show)
-
-data NamedCache = NamedCache {
-  cacheName :: String,
-  spinContention :: Double,
-  utilization :: Double,
-  hits :: Int,
-  wash :: Int,
-  misses :: Int,
-  totHitsMiss :: Int,
-  largeIO :: Int,
-  largeIOTotal :: Int 
-} deriving (Show)
-
-data Disk = Disk {
-  enginesIO :: [EngineIO],
-  delayByDiskIO :: Int,
-  delayByServer :: Int,
-  delayByEngine :: Int,
-  delayByOS :: Int,
-  requestedIO :: Int,
-  completedIO :: Int,
-  devices :: [Device]
-} deriving (Show)
-
-data EngineIO = EngineIO {
-  engineName :: String,
-  outstandIO :: Int
-} deriving (Show)
-
-data Device = Device {
-  deviceName :: String,
-  totalIO :: Int
-} deriving (Show)
-
-data Sysmon = Sysmon {
-  sysmonTime :: LogInterval,
-  kernel :: Kernel,
-  task :: Task,
-  transaction :: Transaction,
-  index :: Index,
-  lock :: Lock,
-  cache :: Cache,
-  disk :: Disk 
-} deriving (Show)
-
-$(deriveAverage ''EngineBusy)
-$(deriveAverage ''CpuYield)
-$(deriveAverage ''Kernel)
-$(deriveAverage ''TaskSwitch)
-$(deriveAverage ''TaskSwitchDue)
-$(deriveAverage ''Task)
-$(deriveAverage ''Transaction)
-$(deriveAverage ''Request)
-$(deriveAverage ''UlcFlush)
-$(deriveAverage ''Index)
-$(deriveAverage ''Lock)
-$(deriveAverage ''Cache)
-$(deriveAverage ''NamedCache)
-$(deriveAverage ''Disk)
-$(deriveAverage ''EngineIO)
-$(deriveAverage ''Device)
-$(deriveAverage ''Sysmon)
diff --git a/README b/README
--- a/README
+++ b/README
@@ -1,8 +1,13 @@
-The Sysmon package is a library for processing Sybase 15 sysmon reports. Sysmon parses and stores the reports in the interval map. The interval is defined by the report's time range. 
+The Sysmon package is a library for processing Sybase 15 sysmon reports. Sysmon parses 
+and stores the reports in the interval map. The interval is defined by the report's 
+time range. 
 
-The library main features are parsing sysmon reports, querying the time interval, aggregating the multiple sysmon reports covered by the requested time interval, providing some hints. The hints properties are configured.
+The library main features are parsing sysmon reports, querying the time interval, 
+aggregating the multiple sysmon reports covered by the requested time interval, 
+providing some hints. The hints properties are configured.
  
-See the Log.hs for the exported functions and examples/Sample.hs for the usage example.   
+See the Log.hs for the exported functions and examples/Sample.hs for 
+the usage example.   
 
 
 
diff --git a/Sysmon.cabal b/Sysmon.cabal
--- a/Sysmon.cabal
+++ b/Sysmon.cabal
@@ -1,15 +1,13 @@
 Name:                Sysmon
-Version:             0.1.1
-Description:         A library for processing Sysbase 15 sysmon reports.
-                     Sysmon parses and stores the reports in the interval map. 
-                     The interval is defined by the report's time range. 
-
-                     The library main features are parsing sysmon reports, querying the 
-                     time interval, aggregating the multiple sysmon reports covered by the 
-                     requested time interval, providing some hints. The hints properties are 
-                     configured.
- 
-                     See the Log.hs for the exported functions and examples/Sample.hs for the 
+Version:             0.1.2
+Description:         A library for processing Sybase 15 sysmon reports.
+                     .
+                     The library provides an interface to parse sysmon reports, to query the data, 
+                     to aggregate the multiple sysmon reports, to generate the optimization hints. 
+                     The hints parameters can be configured.
+                     . 
+                     See the Database.Sybase.Sysmon.Log package for the exported functions and 
+                     Sample.hs for the 
                      usage example.
 License:             BSD3
 License-File:        LICENSE
@@ -21,13 +19,14 @@
 Tested-with:	     GHC==6.12.3
 Category:            Database
 Synopsis:            Sybase 15 sysmon reports processor
-Data-Dir:            examples
-Data-Files:	     sysmon_100310_0952.out
+Data-Dir:            data
+Data-Files:	     sysmon_1.out,sysmon_2.out
 Cabal-Version:       >=1.2
 Extra-Source-Files:  README,
-                     examples/Sample.hs
+                     src/Sample.hs
 
 Library
+    Hs-Source-Dirs:      src
     Exposed-Modules:     Database.Sybase.Sysmon.LogTypes, 
                          Database.Sybase.Sysmon.Log, 
                          Database.Sybase.Sysmon.LogParserPrim, 
@@ -39,7 +38,8 @@
     Build-Depends:       base >= 3.0.3.2 && < 5, 
                          Glob >= 0.5.1,
                          ConfigFile >= 1.0.6,
-                         datetime >= 0.2,
+                         time,
+                         old-locale,
                          fingertree >= 0.0.1.0,
                          pretty >= 1.0.1.1,
                          filepath,
diff --git a/data/sysmon_1.out b/data/sysmon_1.out
new file mode 100644
--- /dev/null
+++ b/data/sysmon_1.out
@@ -0,0 +1,904 @@
+=============================================================================== 
+      Sybase Adaptive Server Enterprise System Performance Report
+=============================================================================== 
+ 
+Server Version:        Adaptive Server Enterprise/15.0.3/EBF 16548 ESD#1/P/Sun_ 
+Server Name:           Test                                                
+Run Date:              Jan 27, 2010                                             
+Sampling Started at:   Jan 27, 2010 15:40:56                                    
+Sampling Ended at:     Jan 27, 2010 15:41:56                                    
+Sample Interval:       00:01:00                                                 
+Sample Mode:           No Clear                                                 
+Counters Last Cleared: Jan 20, 2010 11:35:53                                    
+ 
+=============================================================================== 
+ 
+Kernel Utilization
+------------------                        
+ 
+  Engine Busy Utilization        CPU Busy   I/O Busy       Idle                 
+  ------------------------       --------   --------   --------    
+    Engine 0                        0.2 %      0.0 %     99.8 %              
+    Engine 1                        0.2 %      0.0 %     99.8 %              
+    Engine 2                        0.0 %      0.0 %    100.0 %              
+    Engine 3                        0.2 %      0.2 %     99.7 %              
+    Engine 4                        0.2 %      1.3 %     98.5 %              
+    Engine 5                        0.0 %      0.2 %     99.8 %              
+    Engine 6                        0.0 %      0.0 %    100.0 %              
+    Engine 7                        2.5 %     46.3 %     51.2 %              
+    Engine 8                        0.0 %      0.0 %    100.0 %              
+    Engine 9                        0.0 %      0.0 %    100.0 %              
+    Engine 10                       0.0 %      0.0 %    100.0 %              
+    Engine 11                       0.0 %      0.0 %    100.0 %              
+  ------------------------       --------   --------   --------    
+  Summary           Total           3.2 %     48.0 %   1148.8 %              
+                  Average           0.3 %      4.0 %     95.7 %              
+ 
+  CPU Yields by Engine            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                         73.1          28.3        4385      10.2 %
+    Engine 1                         69.1          26.7        4146       9.7 %
+    Engine 2                         59.0          22.8        3538       8.2 %
+    Engine 3                         72.0          27.9        4318      10.1 %
+    Engine 4                         58.1          22.5        3484       8.1 %
+    Engine 5                         58.9          22.8        3533       8.2 %
+    Engine 6                         59.0          22.8        3539       8.2 %
+    Engine 7                         30.9          12.0        1854       4.3 %
+    Engine 8                         59.0          22.8        3537       8.2 %
+    Engine 9                         59.2          22.9        3550       8.3 %
+    Engine 10                        59.1          22.9        3548       8.3 %
+    Engine 11                        58.9          22.8        3531       8.2 %
+  -------------------------  ------------  ------------  ----------
+  Total CPU Yields                  716.1         277.2       42963             
+ 
+  Network Checks
+    Non-Blocking                 223674.6       86583.7    13420473      99.7 %
+    Blocking                        714.9         276.7       42894       0.3 %
+  -------------------------  ------------  ------------  ----------
+  Total Network I/O Checks       224389.5       86860.4    13463367             
+  Avg Net I/Os per Check              n/a           n/a     0.00008       n/a   
+ 
+  Disk I/O Checks
+    Total Disk I/O Checks        225442.9       87268.2    13526571       n/a   
+    Checks Returning I/O         201521.5       78008.3    12091292      89.4 %
+    Avg Disk I/Os Returned            n/a           n/a     0.00091       n/a   
+ 
+  Tuning Recommendations for Kernel Utilization                                 
+  ---------------------------------------------                                 
+  - Consider decreasing the 'runnable process search count'
+    configuration parameter if you require the CPU's on
+    the machine to be used for other applications.
+ 
+ 
+=============================================================================== 
+ 
+Worker Process Management
+-------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ---------- 
+ Worker Process Requests
+   Total Requests                     0.0           0.0           0       n/a   
+ 
+ Worker Process Usage
+   Total Used                         0.0           0.0           0       n/a   
+   Max Ever Used During Sample        0.0           0.0           0       n/a   
+ 
+ Memory Requests for Worker Processes
+   Total Requests                     0.0           0.0           0       n/a   
+ 
+ Tuning Recommendations for Worker Processes                                    
+ -------------------------------------------                                    
+  - Consider decreasing the 'number of worker processes'
+    configuration parameter.
+ 
+ 
+=============================================================================== 
+ 
+Parallel Query Management
+-------------------------
+ 
+  Parallel Query Usage            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Parallel Queries              0.0           0.0           0       n/a   
+ 
+  Merge Lock Requests             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total # of Requests                 0.0           0.0           0       n/a   
+ 
+  Sort Buffer Waits               per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total # of Waits                    0.0           0.0           0       n/a   
+ 
+=============================================================================== 
+ 
+Task Management                   per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+ 
+  Connections Opened                  0.2           0.1           9       n/a   
+ 
+  Task Context Switches by Engine
+    Engine 0                          3.7           1.4         223       2.1 %
+    Engine 1                          1.7           0.7         102       1.0 %
+    Engine 2                          1.2           0.5          71       0.7 %
+    Engine 3                          4.5           1.7         267       2.5 %
+    Engine 4                          2.8           1.1         169       1.6 %
+    Engine 5                          1.7           0.7         102       1.0 %
+    Engine 6                          1.7           0.7         101       1.0 %
+    Engine 7                        144.7          56.0        8680      82.1 %
+    Engine 8                          0.7           0.3          44       0.4 %
+    Engine 9                          6.4           2.5         381       3.6 %
+    Engine 10                         5.3           2.1         319       3.0 %
+    Engine 11                         1.8           0.7         110       1.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Task Switches:            176.2          68.2       10569             
+ 
+  Task Context Switches Due To:
+    Voluntary Yields                  8.7           3.4         520       4.9 %
+    Cache Search Misses               4.2           1.6         250       2.4 %
+    Exceeding I/O batch size          0.0           0.0           0       0.0 %
+    System Disk Writes                1.7           0.7         101       1.0 %
+    Logical Lock Contention           0.0           0.0           0       0.0 %
+    Address Lock Contention           0.0           0.0           0       0.0 %
+    Latch Contention                  0.0           0.0           0       0.0 %
+    Log Semaphore Contention          0.0           0.0           0       0.0 %
+    PLC Lock Contention               0.0           0.0           0       0.0 %
+    Group Commit Sleeps               0.1           0.0           7       0.1 %
+    Last Log Page Writes              1.1           0.4          67       0.6 %
+    Modify Conflicts                  0.0           0.0           0       0.0 %
+    I/O Device Contention             0.0           0.0           0       0.0 %
+    Network Packet Received           8.5           3.3         510       4.8 %
+    Network Packet Sent               0.7           0.3          44       0.4 %
+    Network services                  9.2           3.6         552       5.2 %
+    Other Causes                    142.0          55.0        8518      80.6 %
+ 
+ 
+=============================================================================== 
+ 
+Application Management
+----------------------
+ 
+  Application Statistics Summary (All Applications)
+  -------------------------------------------------
+  Priority Changes                per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    To High Priority                  0.0           0.0           0       0.0 %
+    To Medium Priority                0.6           0.2          37      54.4 %
+    To Low Priority                   0.5           0.2          31      45.6 %
+  -------------------------  ------------  ------------  ----------
+  Total Priority Changes              1.1           0.4          68             
+ 
+  Allotted Slices Exhausted       per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Slices Exhausted              0.0           0.0           0       n/a   
+ 
+  Skipped Tasks By Engine         per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Engine Skips                  0.0           0.0           0       n/a   
+ 
+  Engine Scope Changes                0.0           0.0           0       n/a   
+ 
+=============================================================================== 
+ 
+ESP Management                    per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  ESP Requests                        0.0           0.0           0       n/a   
+=============================================================================== 
+ 
+Housekeeper Task Activity
+-------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------             
+Buffer Cache Washes                                                             
+  Clean                            120.0          46.5        7202      99.2 % 
+  Dirty                              1.0           0.4          59       0.8 % 
+                             ------------  ------------  ----------             
+Total Washes                       121.0          46.8        7261              
+ 
+Garbage Collections                  2.8           1.1         168       n/a    
+Pages Processed in GC                0.0           0.0           0       n/a    
+ 
+Statistics Updates                   0.4           0.2          24       n/a    
+ 
+  Tuning Recommendations for Housekeeper                                        
+  --------------------------------------                                        
+  - Consider increasing the 'housekeeper free write percent'
+    configuration parameter.
+ 
+=============================================================================== 
+ 
+Monitor Access to Executing SQL
+-------------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ---------- 
+ Waits on Execution Plans            0.0           0.0           0       n/a    
+ Number of SQL Text Overflows        0.0           0.0           0       n/a    
+ Maximum SQL Text Requested          n/a           n/a        1655       n/a    
+  (since beginning of sample)                                                   
+ 
+ 
+ Tuning Recommendations for Monitor Access to Executing SQL                     
+ ----------------------------------------------------------                     
+ - Consider decreasing the 'max SQL text monitored' parameter 
+   to 4923 (i.e., half way from its current value to Maximum 
+   SQL Text Requested).
+ 
+=============================================================================== 
+ 
+Transaction Profile
+-------------------
+ 
+  Transaction Summary             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Committed Xacts                   2.6           n/a         155     n/a     
+ 
+  Transaction Detail              per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Inserts
+      APL Heap Table                 23.7           9.2        1419      12.7 %
+      APL Clustered Table             0.0           0.0           0       0.0 %
+      Data Only Lock Table          162.0          62.7        9722      87.3 %
+      Fast Bulk Insert                0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total Rows Inserted             185.7          71.9       11141      98.8 %
+ 
+    Updates
+      APL Deferred                    0.0           0.0           0       0.0 %
+      APL Direct In-place             0.0           0.0           0       0.0 %
+      APL Direct Cheap                0.0           0.0           0       0.0 %
+      APL Direct Expensive            0.0           0.0           0       0.0 %
+      DOL Deferred                    0.0           0.0           0       0.0 %
+      DOL Direct                      0.2           0.1          14     100.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total Rows Updated                0.2           0.1          14       0.1 %
+ 
+    Data Only Locked Updates
+      DOL Replace                     0.2           0.1          14     100.0 %
+      DOL Shrink                      0.0           0.0           0       0.0 %
+      DOL Cheap Expand                0.0           0.0           0       0.0 %
+      DOL Expensive Expand            0.0           0.0           0       0.0 %
+      DOL Expand & Forward            0.0           0.0           0       0.0 %
+      DOL Fwd Row Returned            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total DOL Rows Updated            0.2           0.1          14       0.1 %
+ 
+    Deletes
+      APL Deferred                    0.0           0.0           0       0.0 %
+      APL Direct                      0.0           0.0           0       0.0 %
+      DOL                             2.0           0.8         120     100.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total Rows Deleted                2.0           0.8         120       1.1 %
+  =========================  ============  ============  ==========
+    Total Rows Affected             187.9          72.7       11275             
+ 
+=============================================================================== 
+ 
+Transaction Management
+----------------------
+ 
+  ULC Flushes to Xact Log         per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    by Full ULC                       0.7           0.3          42      28.0 %
+    by End Transaction                0.8           0.3          49      32.7 %
+    by Change of Database             0.1           0.0           4       2.7 %
+    by Single Log Record              0.3           0.1          17      11.3 %
+    by Unpin                          0.6           0.2          38      25.3 %
+    by Other                          0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Flushes                   2.5           1.0         150             
+ 
+  ULC Flushes Skipped             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    by PLC Discards                   2.0           0.8         118     100.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Discards                  2.0           0.8         118             
+ 
+  ULC Log Records                    60.4          23.4        3623       n/a   
+  Max ULC Size During Sample          n/a           n/a           0       n/a   
+ 
+  ULC Semaphore Requests
+    Granted                          90.2          34.9        5413     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Semaphore Req            90.2          34.9        5413             
+ 
+  Log Semaphore Requests
+    Granted                           3.6           1.4         213     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total Log Semaphore Req             3.6           1.4         213             
+ 
+  Transaction Log Writes              1.9           0.7         111       n/a   
+  Transaction Log Alloc               2.8           1.1         168       n/a   
+  Avg # Writes per Log Page           n/a           n/a     0.66071       n/a   
+ 
+  Tuning Recommendations for Transaction Management                             
+  -------------------------------------------------                             
+  - Consider increasing the 'user log cache size'
+    configuration parameter.
+ 
+=============================================================================== 
+ 
+Index Management
+----------------
+ 
+  Nonclustered Maintenance        per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Ins/Upd Requiring Maint           0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    Deletes Requiring Maint           0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    RID Upd from Clust Split          0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    Upd/Del DOL Req Maint             2.2           0.9         134       n/a   
+      # of DOL Ndx Maint              2.6           1.0         156       n/a   
+      Avg DOL Ndx Maint / Op          n/a           n/a     1.16418       n/a   
+ 
+  Page Splits                         0.0           0.0           0       n/a   
+ 
+  Page Shrinks                        0.0           0.0           0       n/a   
+ 
+  Index Scans                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Ascending Scans                  34.7          13.4        2082      47.0 %
+    DOL Ascending Scans              38.8          15.0        2329      52.6 %
+    Descending Scans                  0.2           0.1          14       0.3 %
+    DOL Descending Scans              0.0           0.0           1       0.0 %
+                             ------------  ------------  ----------             
+    Total Scans                      73.8          28.6        4426             
+ 
+=============================================================================== 
+ 
+Lock Management
+---------------
+ 
+  Lock Summary                    per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Lock Requests               175.8          68.0       10546       n/a   
+  Avg Lock Contention                 0.0           0.0           0       0.0 %
+  Deadlock Percentage                 0.0           0.0           0       0.0 %
+ 
+  Lock Detail                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+ 
+  Table Lock Hashtable
+    Lookups                          40.1          15.5        2406       n/a   
+    Avg Chain Length                  n/a           n/a     0.01081       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Table
+    Total EX-Table Requests           0.0           0.0           0       n/a   
+ 
+  Shared Table
+    Total SH-Table Requests           0.0           0.0           0       n/a   
+ 
+  Exclusive Intent
+    Granted                           3.0           1.2         180     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Intent Requests            3.0           1.2         180       1.7 %
+ 
+  Shared Intent
+    Granted                          36.7          14.2        2200     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Intent Requests           36.7          14.2        2200      20.9 %
+ 
+  Page & Row Lock HashTable
+    Lookups                          75.9          29.4        4555       n/a   
+    Avg Chain Length                  n/a           n/a     0.01537       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Page
+    Granted                           0.8           0.3          46     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Page Requests              0.8           0.3          46       0.4 %
+ 
+  Update Page
+    Total UP-Page Requests            0.0           0.0           0       n/a   
+ 
+  Shared Page
+    Granted                          33.0          12.8        1980     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Page Requests             33.0          12.8        1980      18.8 %
+ 
+ 
+  Exclusive Row
+    Granted                           2.3           0.9         139     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Row Requests               2.3           0.9         139       1.3 %
+ 
+  Update Row
+    Granted                           0.7           0.3          41     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total UP-Row Requests               0.7           0.3          41       0.4 %
+ 
+  Shared Row
+    Granted                          29.5          11.4        1770     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Row Requests              29.5          11.4        1770      16.8 %
+ 
+ 
+  Next-Key
+    Total Next-Key Requests           0.0           0.0           0       n/a   
+ 
+  Address Lock Hashtable
+    Lookups                          69.8          27.0        4190       n/a   
+    Avg Chain Length                  n/a           n/a     0.00000       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Address
+    Granted                           0.5           0.2          27     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Address Requests           0.5           0.2          27       0.3 %
+ 
+  Shared Address
+    Granted                          69.4          26.9        4163     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Address Requests          69.4          26.9        4163      39.5 %
+ 
+ 
+  Last Page Locks on Heaps
+    Granted                          23.7           9.2        1419     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Last Pg Locks                23.7           9.2        1419     100.0 %
+ 
+ 
+  Deadlocks by Lock Type          per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Deadlocks                     0.0           0.0           0       n/a   
+ 
+ 
+  Deadlock Detection
+    Deadlock Searches                 0.0           0.0           0       n/a   
+ 
+ 
+  Lock Promotions
+    Total Lock Promotions             0.0           0.0           0       n/a   
+ 
+ 
+  Lock Timeouts by Lock Type      per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Timeouts                      0.0           0.0           0       n/a   
+ 
+ 
+=============================================================================== 
+ 
+Data Cache Management
+---------------------
+ 
+  Cache Statistics Summary (All Caches)
+  -------------------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ----------
+ 
+    Cache Search Summary
+      Total Cache Hits             1744.9         675.5      104696      84.0 %
+      Total Cache Misses            332.2         128.6       19929      16.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches           2077.1         804.0      124625             
+ 
+    Cache Turnover
+      Buffers Grabbed               809.3         313.3       48560       n/a   
+      Buffers Grabbed Dirty           0.0           0.0           0       0.0 %
+ 
+    Cache Strategy Summary
+      Cached (LRU) Buffers         1554.3         601.7       93259      99.4 %
+      Discarded (MRU) Buffers         9.7           3.8         582       0.6 %
+ 
+    Large I/O Usage
+      Large I/Os Performed           40.8          15.8        2445       8.5 %
+ 
+      Large I/Os Denied due to                                                  
+        Pool < Prefetch Size        435.9         168.7       26154      91.5 %
+        Pages Requested                                                         
+        Reside in Another                                                       
+        Buffer Pool                   0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Large I/O Requests        476.7         184.5       28599             
+ 
+    Large I/O Effectiveness
+      Pages by Lrg I/O Cached       317.5         122.9       19050       n/a   
+      Pages by Lrg I/O Used         183.7          71.1       11021      57.9 %
+ 
+    Asynchronous Prefetch Activity
+      APFs Issued                   174.8          67.7       10490      28.8 %
+      APFs Denied Due To                                                        
+        APF I/O Overloads             0.0           0.0           0       0.0 %
+        APF Limit Overloads           0.0           0.0           0       0.0 %
+        APF Reused Overloads          0.0           0.0           0       0.0 %
+      APF Buffers Found in Cache                                                
+        With Spinlock Held            0.1           0.0           3       0.0 %
+        W/o Spinlock Held           433.0         167.6       25977      71.2 %
+  -------------------------  ------------  ------------  ----------
+    Total APFs Requested            607.8         235.3       36470             
+ 
+    Other Asynchronous Prefetch Statistics
+      APFs Used                     173.4          67.1       10402       n/a   
+      APF Waits for I/O             140.2          54.3        8414       n/a   
+      APF Discards                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+      Page Requests                   0.0           0.0           0       n/a   
+ 
+------------------------------------------------------------------------------- 
+  Cache: dbcc_cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a       0.0 %
+ 
+    Cache Searches
+      Total Cache Searches            0.0           0.0           0       n/a
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches              0.0           0.0           0
+ 
+    Pool Turnover                     0.0           0.0           0       n/a
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Statistics Not Available - No Buffers Displaced Yet
+ 
+    Large I/O Usage
+      Total Large I/O Requests        0.0           0.0           0       n/a
+ 
+    Large I/O Detail
+     16  Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+    Tuning Recommendations for Data cache : dbcc_cache
+    -------------------------------------                                       
+    - Consider removing the 16k pool for this cache.
+ 
+------------------------------------------------------------------------------- 
+  Cache: default data cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a     100.0 %
+ 
+    Cache Searches
+      Cache Hits                   1744.9         675.5      104696      84.0 %
+         Found in Wash                2.4           0.9         145       0.1 %
+      Cache Misses                  332.2         128.6       19929      16.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches           2077.1         804.0      124625
+ 
+    Pool Turnover
+      2  Kb Pool
+          LRU Buffer Grab           768.6         297.5       46115      95.0 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+      4  Kb Pool
+          LRU Buffer Grab             1.4           0.5          85       0.2 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+      16 Kb Pool
+          LRU Buffer Grab            39.3          15.2        2360       4.9 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Turnover            809.3         313.3       48560
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Cached (LRU) Buffers         1554.3         601.7       93259      99.4 %
+      Discarded (MRU) Buffers         9.7           3.8         582       0.6 %
+ 
+    Large I/O Usage
+      Large I/Os Performed           40.8          15.8        2445       8.5 %
+ 
+      Large I/Os Denied due to
+        Pool < Prefetch Size         14.8           5.7         888       3.1 %
+        Pages Requested
+        Reside in Another
+        Buffer Pool                 421.1         163.0       25266      88.3 %
+  -------------------------  ------------  ------------  ----------
+    Total Large I/O Requests        476.7         184.5       28599
+ 
+    Large I/O Detail
+     4   Kb Pool
+        Pages Cached                  2.8           1.1         170       n/a
+        Pages Used                    2.8           1.1         167      98.2 %
+     16  Kb Pool
+        Pages Cached                314.7         121.8       18880       n/a
+        Pages Used                  180.9          70.0       10854      57.5 %
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+------------------------------------------------------------------------------- 
+  Cache: tempdb_cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a       0.0 %
+ 
+    Cache Searches
+      Total Cache Searches            0.0           0.0           0       n/a
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches              0.0           0.0           0
+ 
+    Pool Turnover                     0.0           0.0           0       n/a
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Statistics Not Available - No Buffers Displaced Yet
+ 
+    Large I/O Usage
+      Total Large I/O Requests        0.0           0.0           0       n/a
+ 
+    Large I/O Detail
+     4   Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+     16  Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+    Tuning Recommendations for Data cache : tempdb_cache
+    -------------------------------------                                       
+    - Consider removing the 4k pool for this cache.
+ 
+    - Consider removing the 16k pool for this cache.
+ 
+=============================================================================== 
+ 
+Procedure Cache Management        per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  Procedure Requests                  5.7           2.2         339       n/a   
+  Procedure Reads from Disk           0.0           0.0           0       0.0 %
+  Procedure Writes to Disk            0.0           0.0           0       0.0 %
+  Procedure Removals                  0.1           0.1           8       n/a   
+  Procedure Recompilations            0.0           0.0           0       n/a   
+ 
+  SQL Statement Cache:
+    Statements Cached                 0.1           0.0           3       n/a   
+    Statements Found in Cache         0.2           0.1          10       n/a   
+    Statements Not Found              0.1           0.0           3       n/a   
+    Statements Dropped                0.0           0.0           0       n/a   
+    Statements Restored               0.0           0.0           0       n/a   
+    Statements Not Cached             0.0           0.0           0       n/a   
+ 
+ 
+=============================================================================== 
+ 
+Memory Management                 per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  Pages Allocated                     1.3           0.5          75       n/a   
+  Pages Released                      1.3           0.5          75       n/a   
+ 
+=============================================================================== 
+ 
+Recovery Management
+-------------------
+ 
+  Checkpoints                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    # of Normal Checkpoints           0.1           0.0           4     100.0 %
+    # of Free Checkpoints             0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Checkpoints                   0.1           0.0           4             
+ 
+  Avg Time per Normal Chkpt       0.00000 seconds                               
+ 
+=============================================================================== 
+ 
+Disk I/O Management
+-------------------
+ 
+  Max Outstanding I/Os            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Server                            n/a           n/a         255       n/a   
+    Engine 0                          n/a           n/a         352       n/a   
+    Engine 1                          n/a           n/a         396       n/a   
+    Engine 2                          n/a           n/a         425       n/a   
+    Engine 3                          n/a           n/a         389       n/a   
+    Engine 4                          n/a           n/a         198       n/a   
+    Engine 5                          n/a           n/a         218       n/a   
+    Engine 6                          n/a           n/a         263       n/a   
+    Engine 7                          n/a           n/a         215       n/a   
+    Engine 8                          n/a           n/a         263       n/a   
+    Engine 9                          n/a           n/a         236       n/a   
+    Engine 10                         n/a           n/a         403       n/a   
+    Engine 11                         n/a           n/a         181       n/a   
+ 
+ 
+  I/Os Delayed by
+    Disk I/O Structures               n/a           n/a           0       n/a   
+    Server Config Limit               n/a           n/a           0       n/a   
+    Engine Config Limit               n/a           n/a           0       n/a   
+    Operating System Limit            n/a           n/a           0       n/a   
+ 
+ 
+  Total Requested Disk I/Os         183.3          71.0       11000             
+ 
+  Completed Disk I/O's
+    Asynchronous I/O's
+      Engine 0                        0.0           0.0           0       0.0 %
+      Engine 1                        0.1           0.0           4       0.0 %
+      Engine 2                        0.0           0.0           0       0.0 %
+      Engine 3                        1.0           0.4          57       0.5 %
+      Engine 4                        1.9           0.7         116       1.1 %
+      Engine 5                        1.4           0.5          83       0.8 %
+      Engine 6                        0.7           0.3          43       0.4 %
+      Engine 7                      177.4          68.7       10645      96.7 %
+      Engine 8                        0.0           0.0           0       0.0 %
+      Engine 9                        0.0           0.0           1       0.0 %
+      Engine 10                       0.0           0.0           0       0.0 %
+      Engine 11                       1.0           0.4          59       0.5 %
+    Synchronous I/O's
+      Total Completed I/Os            0.0           0.0           0       n/a   
+  -------------------------  ------------  ------------  ----------             
+  Total Completed I/Os              183.5          71.0       11008             
+ 
+ 
+  Device Activity Detail
+  ----------------------
+ 
+    Device:                                                                       
+    /sybase/data_01.dat                           
+    data_01                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                            83.9          32.5        5033      97.0 %
+      Non-APF                         2.3           0.9         138       2.7 %
+    Writes                            0.3           0.1          16       0.3 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                         86.5          33.5        5187      47.1 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_02.dat                           
+    data_02                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                            50.3          19.5        3017      98.5 %
+      Non-APF                         0.8           0.3          46       1.5 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                         51.1          19.8        3063      27.8 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_03.dat                           
+    data_03                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                            36.7          14.2        2204      98.8 %
+      Non-APF                         0.4           0.2          26       1.2 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                         37.2          14.4        2230      20.2 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_04.dat                           
+    data_04                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                             1.0           0.4          58      85.3 %
+      Non-APF                         0.2           0.1          10      14.7 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                          1.1           0.4          68       0.6 % 
+ 
+ 
+=============================================================================== 
+ 
+Network I/O Management
+----------------------
+ 
+  Total Network I/O Requests          9.2           3.6         554       n/a   
+    Network I/Os Delayed              0.0           0.0           0       0.0 %
+ 
+ 
+  Total TDS Packets Received      per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.0           0.0           0       0.0 %
+    Engine 1                          0.5           0.2          27       5.3 %
+    Engine 2                          0.4           0.2          26       5.1 %
+    Engine 3                          1.4           0.5          84      16.5 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                          0.5           0.2          29       5.7 %
+    Engine 8                          0.2           0.1          12       2.4 %
+    Engine 9                          3.0           1.2         180      35.4 %
+    Engine 10                         2.5           1.0         150      29.5 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total TDS Packets Rec'd             8.5           3.3         508             
+ 
+ 
+  Total Bytes Received            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.0           0.0           0       0.0 %
+    Engine 1                         86.7          33.6        5203      11.7 %
+    Engine 2                         32.5          12.6        1948       4.4 %
+    Engine 3                        163.3          63.2        9799      22.0 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                         70.7          27.3        4239       9.5 %
+    Engine 8                         16.9           6.5        1012       2.3 %
+    Engine 9                        200.0          77.4       12000      26.9 %
+    Engine 10                       173.0          67.0       10380      23.3 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Bytes Rec'd                 743.0         287.6       44581             
+ 
+ 
+   Avg Bytes Rec'd per Packet          n/a           n/a          87       n/a  
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Total TDS Packets Sent          per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.0           0.0           0       0.0 %
+    Engine 1                          0.4           0.1          22       3.9 %
+    Engine 2                          0.4           0.2          26       4.6 %
+    Engine 3                          1.4           0.5          82      14.6 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                          1.5           0.6          89      15.9 %
+    Engine 8                          0.2           0.1          12       2.1 %
+    Engine 9                          3.0           1.2         180      32.1 %
+    Engine 10                         2.5           1.0         150      26.7 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total TDS Packets Sent              9.4           3.6         561             
+ 
+ 
+  Total Bytes Sent                per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.0           0.0           0       0.0 %
+    Engine 1                         39.9          15.4        2394       0.2 %
+    Engine 2                        113.0          43.7        6778       0.7 %
+    Engine 3                        162.1          62.7        9723       1.0 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                      13856.2        5363.7      831374      83.9 %
+    Engine 8                         47.5          18.4        2848       0.3 %
+    Engine 9                        693.0         268.3       41580       4.2 %
+    Engine 10                      1605.0         621.3       96300       9.7 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Bytes Sent                16516.6        6393.5      990997             
+ 
+ 
+  Avg Bytes Sent per Packet           n/a           n/a        1766       n/a   
+ 
+===============================================================================
+ 
diff --git a/data/sysmon_2.out b/data/sysmon_2.out
new file mode 100644
--- /dev/null
+++ b/data/sysmon_2.out
@@ -0,0 +1,913 @@
+=============================================================================== 
+      Sybase Adaptive Server Enterprise System Performance Report
+=============================================================================== 
+ 
+Server Version:        Adaptive Server Enterprise/15.0.3/EBF 16548 ESD#1/P/Sun_ 
+Server Name:           Test                                                
+Run Date:              Jan 27, 2010                                             
+Sampling Started at:   Jan 27, 2010 15:42:27                                    
+Sampling Ended at:     Jan 27, 2010 15:43:27                                    
+Sample Interval:       00:01:00                                                 
+Sample Mode:           No Clear                                                 
+Counters Last Cleared: Jan 20, 2010 11:35:52                                    
+ 
+=============================================================================== 
+ 
+Kernel Utilization
+------------------
+ 
+  Your Runnable Process Search Count is set to 2000                             
+  and I/O Polling Process Count is set to 10                                    
+ 
+  Engine Busy Utilization        CPU Busy   I/O Busy       Idle                 
+  ------------------------       --------   --------   --------    
+    Engine 0                        0.0 %      0.0 %    100.0 %              
+    Engine 1                        0.0 %      0.0 %    100.0 %              
+    Engine 2                        0.0 %      0.0 %    100.0 %              
+    Engine 3                        0.0 %      0.0 %    100.0 %              
+    Engine 4                        0.0 %      0.0 %    100.0 %              
+    Engine 5                        0.2 %      0.0 %     99.8 %              
+    Engine 6                        0.0 %      0.0 %    100.0 %              
+    Engine 7                       12.5 %     77.9 %      9.6 %              
+    Engine 8                        0.0 %      0.2 %     99.8 %              
+    Engine 9                        0.0 %      0.0 %    100.0 %              
+    Engine 10                       0.0 %      0.0 %    100.0 %              
+    Engine 11                       0.0 %      1.8 %     98.2 %              
+  ------------------------       --------   --------   --------    
+  Summary           Total          12.6 %     79.9 %   1107.5 %              
+                  Average           1.1 %      6.7 %     92.3 %              
+ 
+  CPU Yields by Engine            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                         58.5          24.2        3512       8.8 %
+    Engine 1                         58.9          24.4        3536       8.9 %
+    Engine 2                         58.9          24.4        3534       8.9 %
+    Engine 3                         58.9          24.4        3536       8.9 %
+    Engine 4                         58.9          24.4        3532       8.9 %
+    Engine 5                         58.8          24.3        3530       8.9 %
+    Engine 6                         58.9          24.4        3531       8.9 %
+    Engine 7                          5.5           2.3         332       0.8 %
+    Engine 8                         58.9          24.4        3534       8.9 %
+    Engine 9                         69.9          28.9        4193      10.5 %
+    Engine 10                        59.1          24.5        3546       8.9 %
+    Engine 11                        58.2          24.1        3494       8.8 %
+  -------------------------  ------------  ------------  ----------
+  Total CPU Yields                  663.5         274.6       39810             
+ 
+  Network Checks
+    Non-Blocking                 343984.4      142338.4    20639065      99.8 %
+    Blocking                        662.8         274.3       39770       0.2 %
+  -------------------------  ------------  ------------  ----------
+  Total Network I/O Checks       344647.3      142612.7    20678835             
+  Avg Net I/Os per Check              n/a           n/a     0.00010       n/a   
+ 
+  Disk I/O Checks
+    Total Disk I/O Checks        345442.4      142941.7    20726542       n/a   
+    Checks Returning I/O         325037.2      134498.2    19502231      94.1 %
+    Avg Disk I/Os Returned            n/a           n/a     0.00216       n/a   
+ 
+  Tuning Recommendations for Kernel Utilization                                 
+  ---------------------------------------------                                 
+  - Consider decreasing the 'runnable process search count'
+    configuration parameter if you require the CPU's on
+    the machine to be used for other applications.
+ 
+ 
+=============================================================================== 
+ 
+Worker Process Management
+-------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ---------- 
+ Worker Process Requests
+   Total Requests                     0.0           0.0           0       n/a   
+ 
+ Worker Process Usage
+   Total Used                         0.0           0.0           0       n/a   
+   Max Ever Used During Sample        0.0           0.0           0       n/a   
+ 
+ Memory Requests for Worker Processes
+   Total Requests                     0.0           0.0           0       n/a   
+ 
+ Tuning Recommendations for Worker Processes                                    
+ -------------------------------------------                                    
+  - Consider decreasing the 'number of worker processes'
+    configuration parameter.
+ 
+ 
+=============================================================================== 
+ 
+Parallel Query Management
+-------------------------
+ 
+  Parallel Query Usage            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Parallel Queries              0.0           0.0           0       n/a   
+ 
+  Merge Lock Requests             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total # of Requests                 0.0           0.0           0       n/a   
+ 
+  Sort Buffer Waits               per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total # of Waits                    0.0           0.0           0       n/a   
+ 
+=============================================================================== 
+ 
+Task Management                   per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+ 
+  Connections Opened                  0.1           0.0           4       n/a   
+ 
+  Task Context Switches by Engine
+    Engine 0                          3.5           1.4         207       0.8 %
+    Engine 1                          0.6           0.2          33       0.1 %
+    Engine 2                          1.3           0.5          75       0.3 %
+    Engine 3                          3.0           1.2         181       0.7 %
+    Engine 4                          0.6           0.2          34       0.1 %
+    Engine 5                          1.6           0.7          97       0.4 %
+    Engine 6                          1.8           0.7         105       0.4 %
+    Engine 7                        411.4         170.2       24683      93.4 %
+    Engine 8                          0.7           0.3          42       0.2 %
+    Engine 9                          7.1           2.9         427       1.6 %
+    Engine 10                         5.6           2.3         336       1.3 %
+    Engine 11                         3.5           1.5         211       0.8 %
+  -------------------------  ------------  ------------  ----------
+    Total Task Switches:            440.5         182.3       26431             
+ 
+  Task Context Switches Due To:
+    Voluntary Yields                  8.1           3.4         487       1.8 %
+    Cache Search Misses              32.7          13.5        1959       7.4 %
+    Exceeding I/O batch size          0.0           0.0           0       0.0 %
+    System Disk Writes                1.9           0.8         113       0.4 %
+    Logical Lock Contention           0.0           0.0           0       0.0 %
+    Address Lock Contention           0.0           0.0           0       0.0 %
+    Latch Contention                  0.0           0.0           0       0.0 %
+    Log Semaphore Contention          0.0           0.0           0       0.0 %
+    PLC Lock Contention               0.0           0.0           0       0.0 %
+    Group Commit Sleeps               0.1           0.0           5       0.0 %
+    Last Log Page Writes              1.2           0.5          72       0.3 %
+    Modify Conflicts                  0.0           0.0           0       0.0 %
+    I/O Device Contention             0.0           0.0           0       0.0 %
+    Network Packet Received           8.4           3.5         503       1.9 %
+    Network Packet Sent               0.8           0.3          46       0.2 %
+    Network services                  9.2           3.8         549       2.1 %
+    Other Causes                    378.3         156.5       22697      85.9 %
+ 
+ 
+=============================================================================== 
+ 
+Application Management
+----------------------
+ 
+  Application Statistics Summary (All Applications)
+  -------------------------------------------------
+  Priority Changes                per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    To High Priority                  0.0           0.0           0       0.0 %
+    To Medium Priority                2.1           0.8         123      50.4 %
+    To Low Priority                   2.0           0.8         121      49.6 %
+  -------------------------  ------------  ------------  ----------
+  Total Priority Changes              4.1           1.7         244             
+ 
+  Allotted Slices Exhausted       per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    High Priority                     0.0           0.0           0       0.0 %
+    Medium Priority                   0.1           0.0           4     100.0 %
+    Low Priority                      0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total Slices Exhausted              0.1           0.0           4             
+ 
+  Skipped Tasks By Engine         per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Engine Skips                  0.0           0.0           0       n/a   
+ 
+  Engine Scope Changes                0.0           0.0           0       n/a   
+ 
+=============================================================================== 
+ 
+ESP Management                    per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  ESP Requests                        0.0           0.0           0       n/a   
+=============================================================================== 
+ 
+Housekeeper Task Activity
+-------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------             
+Buffer Cache Washes                                                             
+  Clean                            291.2         120.5       17470      97.5 % 
+  Dirty                              7.5           3.1         450       2.5 % 
+                             ------------  ------------  ----------             
+Total Washes                       298.7         123.6       17920              
+ 
+Garbage Collections                  2.4           1.0         144       n/a    
+Pages Processed in GC                0.0           0.0           0       n/a    
+ 
+Statistics Updates                   0.4           0.2          24       n/a    
+ 
+  Tuning Recommendations for Housekeeper                                        
+  --------------------------------------                                        
+  - Consider increasing the 'housekeeper free write percent'
+    configuration parameter.
+ 
+=============================================================================== 
+ 
+Monitor Access to Executing SQL
+-------------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ---------- 
+ Waits on Execution Plans            0.0           0.0           0       n/a    
+ Number of SQL Text Overflows        0.0           0.0           0       n/a    
+ Maximum SQL Text Requested          n/a           n/a        1655       n/a    
+  (since beginning of sample)                                                   
+ 
+ 
+ Tuning Recommendations for Monitor Access to Executing SQL                     
+ ----------------------------------------------------------                     
+ - Consider decreasing the 'max SQL text monitored' parameter 
+   to 4923 (i.e., half way from its current value to Maximum 
+   SQL Text Requested).
+ 
+=============================================================================== 
+ 
+Transaction Profile
+-------------------
+ 
+  Transaction Summary             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Committed Xacts                   2.4           n/a         145     n/a     
+ 
+  Transaction Detail              per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Inserts
+      APL Heap Table                 23.1           9.6        1386      11.1 %
+      APL Clustered Table             0.0           0.0           0       0.0 %
+      Data Only Lock Table          184.5          76.3       11067      88.9 %
+      Fast Bulk Insert                0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total Rows Inserted             207.6          85.9       12453      99.9 %
+ 
+    Updates
+      APL Deferred                    0.0           0.0           0       0.0 %
+      APL Direct In-place             0.0           0.0           0       0.0 %
+      APL Direct Cheap                0.0           0.0           0       0.0 %
+      APL Direct Expensive            0.0           0.0           0       0.0 %
+      DOL Deferred                    0.0           0.0           0       0.0 %
+      DOL Direct                      0.2           0.1          12     100.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total Rows Updated                0.2           0.1          12       0.1 %
+ 
+    Data Only Locked Updates
+      DOL Replace                     0.2           0.1          12     100.0 %
+      DOL Shrink                      0.0           0.0           0       0.0 %
+      DOL Cheap Expand                0.0           0.0           0       0.0 %
+      DOL Expensive Expand            0.0           0.0           0       0.0 %
+      DOL Expand & Forward            0.0           0.0           0       0.0 %
+      DOL Fwd Row Returned            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Total DOL Rows Updated            0.2           0.1          12       0.1 %
+ 
+    Deletes
+      Total Rows Deleted              0.0           0.0           0       n/a   
+  =========================  ============  ============  ==========
+    Total Rows Affected             207.8          86.0       12465             
+ 
+=============================================================================== 
+ 
+Transaction Management
+----------------------
+ 
+  ULC Flushes to Xact Log         per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    by Full ULC                       0.7           0.3          39      26.7 %
+    by End Transaction                1.1           0.5          68      46.6 %
+    by Change of Database             0.1           0.0           4       2.7 %
+    by Single Log Record              0.1           0.1           8       5.5 %
+    by Unpin                          0.5           0.2          27      18.5 %
+    by Other                          0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Flushes                   2.4           1.0         146             
+ 
+  ULC Flushes Skipped             per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    by PLC Discards                   2.0           0.8         118     100.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Discards                  2.0           0.8         118             
+ 
+  ULC Log Records                    55.2          22.8        3309       n/a   
+  Max ULC Size During Sample          n/a           n/a           0       n/a   
+ 
+  ULC Semaphore Requests
+    Granted                          81.1          33.6        4866     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total ULC Semaphore Req            81.1          33.6        4866             
+ 
+  Log Semaphore Requests
+    Granted                           3.4           1.4         206     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+  Total Log Semaphore Req             3.4           1.4         206             
+ 
+  Transaction Log Writes              2.0           0.8         122       n/a   
+  Transaction Log Alloc               3.0           1.2         177       n/a   
+  Avg # Writes per Log Page           n/a           n/a     0.68927       n/a   
+ 
+  Tuning Recommendations for Transaction Management                             
+  -------------------------------------------------                             
+  - Consider increasing the 'user log cache size'
+    configuration parameter.
+ 
+=============================================================================== 
+ 
+Index Management
+----------------
+ 
+  Nonclustered Maintenance        per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Ins/Upd Requiring Maint           0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    Deletes Requiring Maint           0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    RID Upd from Clust Split          0.0           0.0           0       n/a   
+      # of NC Ndx Maint               0.0           0.0           0       n/a   
+ 
+    Upd/Del DOL Req Maint             0.2           0.1          12       n/a   
+      # of DOL Ndx Maint              0.6           0.2          36       n/a   
+      Avg DOL Ndx Maint / Op          n/a           n/a     3.00000       n/a   
+ 
+  Page Splits                         0.0           0.0           2       n/a   
+    Retries                           0.0           0.0           0       0.0 %
+    Deadlocks                         0.0           0.0           0       0.0 %
+    Add Index Level                   0.0           0.0           0       0.0 %
+ 
+  Page Shrinks                        0.0           0.0           0       n/a   
+ 
+  Index Scans                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Ascending Scans                  24.0           9.9        1439      12.7 %
+    DOL Ascending Scans             165.1          68.3        9907      87.1 %
+    Descending Scans                  0.1           0.0           5       0.0 %
+    DOL Descending Scans              0.4           0.2          23       0.2 %
+                             ------------  ------------  ----------             
+    Total Scans                     189.6          78.4       11374             
+ 
+=============================================================================== 
+ 
+Lock Management
+---------------
+ 
+  Lock Summary                    per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Lock Requests               137.3          56.8        8240       n/a   
+  Avg Lock Contention                 0.0           0.0           0       0.0 %
+  Deadlock Percentage                 0.0           0.0           0       0.0 %
+ 
+  Lock Detail                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+ 
+  Table Lock Hashtable
+    Lookups                          38.3          15.9        2300       n/a   
+    Avg Chain Length                  n/a           n/a     0.00043       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Table
+    Total EX-Table Requests           0.0           0.0           0       n/a   
+ 
+  Shared Table
+    Total SH-Table Requests           0.0           0.0           0       n/a   
+ 
+  Exclusive Intent
+    Granted                           2.7           1.1         160     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Intent Requests            2.7           1.1         160       1.9 %
+ 
+  Shared Intent
+    Granted                          35.0          14.5        2101     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Intent Requests           35.0          14.5        2101      25.5 %
+ 
+  Page & Row Lock HashTable
+    Lookups                          54.2          22.4        3253       n/a   
+    Avg Chain Length                  n/a           n/a     0.00338       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Page
+    Granted                           0.7           0.3          44     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Page Requests              0.7           0.3          44       0.5 %
+ 
+  Update Page
+    Total UP-Page Requests            0.0           0.0           0       n/a   
+ 
+  Shared Page
+    Granted                          21.9           9.0        1312     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Page Requests             21.9           9.0        1312      15.9 %
+ 
+ 
+  Exclusive Row
+    Granted                           0.6           0.3          38     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Row Requests               0.6           0.3          38       0.5 %
+ 
+  Update Row
+    Granted                           0.4           0.2          22     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total UP-Row Requests               0.4           0.2          22       0.3 %
+ 
+  Shared Row
+    Granted                          21.8           9.0        1310     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Row Requests              21.8           9.0        1310      15.9 %
+ 
+ 
+  Next-Key
+    Total Next-Key Requests           0.0           0.0           0       n/a   
+ 
+  Address Lock Hashtable
+    Lookups                          54.2          22.4        3253       n/a   
+    Avg Chain Length                  n/a           n/a     0.00000       n/a   
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+  Exclusive Address
+    Granted                           0.3           0.1          15     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total EX-Address Requests           0.3           0.1          15       0.2 %
+ 
+  Shared Address
+    Granted                          54.0          22.3        3238     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total SH-Address Requests          54.0          22.3        3238      39.3 %
+ 
+ 
+  Last Page Locks on Heaps
+    Granted                          23.1           9.6        1386     100.0 %
+    Waited                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Last Pg Locks                23.1           9.6        1386     100.0 %
+ 
+ 
+  Deadlocks by Lock Type          per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Deadlocks                     0.0           0.0           0       n/a   
+ 
+ 
+  Deadlock Detection
+    Deadlock Searches                 0.0           0.0           0       n/a   
+ 
+ 
+  Lock Promotions
+    Total Lock Promotions             0.0           0.0           0       n/a   
+ 
+ 
+  Lock Timeouts by Lock Type      per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total Timeouts                      0.0           0.0           0       n/a   
+ 
+ 
+=============================================================================== 
+ 
+Data Cache Management
+---------------------
+ 
+  Cache Statistics Summary (All Caches)
+  -------------------------------------
+                                  per sec      per xact       count  % of total
+                             ------------  ------------  ----------  ----------
+ 
+    Cache Search Summary
+      Total Cache Hits             6347.2        2626.4      380833      91.4 %
+      Total Cache Misses            594.6         246.0       35675       8.6 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches           6941.8        2872.5      416508             
+ 
+    Cache Turnover
+      Buffers Grabbed              1525.3         631.2       91520       n/a   
+      Buffers Grabbed Dirty           0.0           0.0           0       0.0 %
+ 
+    Cache Strategy Summary
+      Cached (LRU) Buffers         6554.0        2712.0      393238      94.7 %
+      Discarded (MRU) Buffers       363.4         150.4       21806       5.3 %
+ 
+    Large I/O Usage
+      Large I/Os Performed          103.2          42.7        6194      10.9 %
+ 
+      Large I/Os Denied due to                                                  
+        Pool < Prefetch Size        848.1         350.9       50883      89.1 %
+        Pages Requested                                                         
+        Reside in Another                                                       
+        Buffer Pool                   0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Large I/O Requests        951.3         393.6       57077             
+ 
+    Large I/O Effectiveness
+      Pages by Lrg I/O Cached       817.1         338.1       49026       n/a   
+      Pages by Lrg I/O Used         822.7         340.4       49359     100.7 %
+ 
+    Asynchronous Prefetch Activity
+      APFs Issued                   658.3         272.4       39498      23.3 %
+      APFs Denied Due To                                                        
+        APF I/O Overloads             0.0           0.0           0       0.0 %
+        APF Limit Overloads           0.0           0.0           0       0.0 %
+        APF Reused Overloads          0.0           0.0           0       0.0 %
+      APF Buffers Found in Cache                                                
+        With Spinlock Held            0.2           0.1          12       0.0 %
+        W/o Spinlock Held          2170.2         898.0      130210      76.7 %
+  -------------------------  ------------  ------------  ----------
+    Total APFs Requested           2828.7        1170.5      169720             
+ 
+    Other Asynchronous Prefetch Statistics
+      APFs Used                     656.9         271.8       39414       n/a   
+      APF Waits for I/O             375.5         155.4       22528       n/a   
+      APF Discards                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+      Page Requests                   0.0           0.0           0       n/a   
+ 
+------------------------------------------------------------------------------- 
+  Cache: dbcc_cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a       0.0 %
+ 
+    Cache Searches
+      Total Cache Searches            0.0           0.0           0       n/a
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches              0.0           0.0           0
+ 
+    Pool Turnover                     0.0           0.0           0       n/a
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Statistics Not Available - No Buffers Displaced Yet
+ 
+    Large I/O Usage
+      Total Large I/O Requests        0.0           0.0           0       n/a
+ 
+    Large I/O Detail
+     16  Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+    Tuning Recommendations for Data cache : dbcc_cache
+    -------------------------------------                                       
+    - Consider removing the 16k pool for this cache.
+ 
+------------------------------------------------------------------------------- 
+  Cache: default data cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a     100.0 %
+ 
+    Cache Searches
+      Cache Hits                   6347.2        2626.4      380833      91.4 %
+         Found in Wash              112.5          46.5        6747       1.8 %
+      Cache Misses                  594.6         246.0       35675       8.6 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches           6941.8        2872.5      416508
+ 
+    Pool Turnover
+      2  Kb Pool
+          LRU Buffer Grab          1422.1         588.4       85325      93.2 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+      4  Kb Pool
+          LRU Buffer Grab             1.5           0.6          89       0.1 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+      16 Kb Pool
+          LRU Buffer Grab           101.8          42.1        6106       6.7 %
+            Grabbed Dirty             0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------
+    Total Cache Turnover           1525.3         631.2       91520
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Cached (LRU) Buffers         6554.0        2712.0      393238      94.7 %
+      Discarded (MRU) Buffers       363.4         150.4       21806       5.3 %
+ 
+    Large I/O Usage
+      Large I/Os Performed          103.2          42.7        6194      10.9 %
+ 
+      Large I/Os Denied due to
+        Pool < Prefetch Size         56.2          23.3        3374       5.9 %
+        Pages Requested
+        Reside in Another
+        Buffer Pool                 791.8         327.6       47509      83.2 %
+  -------------------------  ------------  ------------  ----------
+    Total Large I/O Requests        951.3         393.6       57077
+ 
+    Large I/O Detail
+     4   Kb Pool
+        Pages Cached                  3.0           1.2         178       n/a
+        Pages Used                    3.0           1.2         178     100.0 %
+     16  Kb Pool
+        Pages Cached                814.1         336.9       48848       n/a
+        Pages Used                  819.7         339.2       49181     100.7 %
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+------------------------------------------------------------------------------- 
+  Cache: tempdb_cache
+                                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Spinlock Contention               n/a           n/a         n/a       0.0 %
+ 
+    Utilization                       n/a           n/a         n/a       0.0 %
+ 
+    Cache Searches
+      Total Cache Searches            0.0           0.0           0       n/a
+  -------------------------  ------------  ------------  ----------
+    Total Cache Searches              0.0           0.0           0
+ 
+    Pool Turnover                     0.0           0.0           0       n/a
+ 
+    Buffer Wash Behavior
+      Statistics Not Available - No Buffers Entered Wash Section Yet
+ 
+    Cache Strategy
+      Statistics Not Available - No Buffers Displaced Yet
+ 
+    Large I/O Usage
+      Total Large I/O Requests        0.0           0.0           0       n/a
+ 
+    Large I/O Detail
+     4   Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+     16  Kb Pool
+        Pages Cached                  0.0           0.0           0       n/a   
+        Pages Used                    0.0           0.0           0       n/a   
+ 
+    Dirty Read Behavior
+	  Page Requests               0.0           0.0           0       n/a
+ 
+    Tuning Recommendations for Data cache : tempdb_cache
+    -------------------------------------                                       
+    - Consider removing the 4k pool for this cache.
+ 
+    - Consider removing the 16k pool for this cache.
+ 
+=============================================================================== 
+ 
+Procedure Cache Management        per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  Procedure Requests                  6.1           2.5         364       n/a   
+  Procedure Reads from Disk           0.0           0.0           0       0.0 %
+  Procedure Writes to Disk            0.0           0.0           0       0.0 %
+  Procedure Removals                  0.0           0.0           1       n/a   
+  Procedure Recompilations            0.0           0.0           0       n/a   
+ 
+  SQL Statement Cache:
+    Statements Cached                 0.0           0.0           1       n/a   
+    Statements Found in Cache         0.1           0.0           6       n/a   
+    Statements Not Found              0.0           0.0           1       n/a   
+    Statements Dropped                0.0           0.0           0       n/a   
+    Statements Restored               0.0           0.0           0       n/a   
+    Statements Not Cached             0.0           0.0           0       n/a   
+ 
+ 
+=============================================================================== 
+ 
+Memory Management                 per sec      per xact       count  % of total
+---------------------------  ------------  ------------  ----------  ---------- 
+  Pages Allocated                     1.1           0.5          67       n/a   
+  Pages Released                      1.1           0.5          67       n/a   
+ 
+=============================================================================== 
+ 
+Recovery Management
+-------------------
+ 
+  Checkpoints                     per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    # of Normal Checkpoints           0.1           0.0           4     100.0 %
+    # of Free Checkpoints             0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Checkpoints                   0.1           0.0           4             
+ 
+  Avg Time per Normal Chkpt       0.00000 seconds                               
+ 
+=============================================================================== 
+ 
+Disk I/O Management
+-------------------
+ 
+  Max Outstanding I/Os            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Server                            n/a           n/a         255       n/a   
+    Engine 0                          n/a           n/a         352       n/a   
+    Engine 1                          n/a           n/a         396       n/a   
+    Engine 2                          n/a           n/a         425       n/a   
+    Engine 3                          n/a           n/a         389       n/a   
+    Engine 4                          n/a           n/a         198       n/a   
+    Engine 5                          n/a           n/a         218       n/a   
+    Engine 6                          n/a           n/a         263       n/a   
+    Engine 7                          n/a           n/a         215       n/a   
+    Engine 8                          n/a           n/a         263       n/a   
+    Engine 9                          n/a           n/a         236       n/a   
+    Engine 10                         n/a           n/a         403       n/a   
+    Engine 11                         n/a           n/a         181       n/a   
+ 
+ 
+  I/Os Delayed by
+    Disk I/O Structures               n/a           n/a           0       n/a   
+    Server Config Limit               n/a           n/a           0       n/a   
+    Engine Config Limit               n/a           n/a           0       n/a   
+    Operating System Limit            n/a           n/a           0       n/a   
+ 
+ 
+  Total Requested Disk I/Os         701.8         290.4       42107             
+ 
+  Completed Disk I/O's
+    Asynchronous I/O's
+      Engine 0                        0.0           0.0           0       0.0 %
+      Engine 1                        0.0           0.0           0       0.0 %
+      Engine 2                        0.1           0.0           4       0.0 %
+      Engine 3                        0.4           0.2          26       0.1 %
+      Engine 4                        0.4           0.2          22       0.1 %
+      Engine 5                        1.4           0.6          82       0.2 %
+      Engine 6                        0.4           0.2          23       0.1 %
+      Engine 7                      691.1         286.0       41468      98.5 %
+      Engine 8                        0.0           0.0           1       0.0 %
+      Engine 9                        0.3           0.1          19       0.0 %
+      Engine 10                       0.2           0.1          10       0.0 %
+      Engine 11                       7.6           3.2         458       1.1 %
+    Synchronous I/O's
+      Total Completed I/Os            0.0           0.0           0       n/a   
+  -------------------------  ------------  ------------  ----------             
+  Total Completed I/Os              701.9         290.4       42113             
+ 
+ 
+  Device Activity Detail
+  ----------------------
+                                                                     
+  Device:                                                                       
+    /sybase/data_01.dat                           
+    data_01                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                           508.6         210.5       30516      95.1 %
+      Non-APF                        26.3          10.9        1577       4.9 %
+    Writes                            0.2           0.1           9       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                        535.0         221.4       32102      76.2 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_02.dat                           
+    data_02                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                            66.4          27.5        3986      98.3 %
+      Non-APF                         1.1           0.5          68       1.7 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                         67.6          28.0        4054       9.6 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_03.dat                           
+    data_03                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                            55.1          22.8        3305      96.0 %
+      Non-APF                         2.3           1.0         138       4.0 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                         57.4          23.7        3443       8.2 %
+ 
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Device:                                                                       
+    /sybase/data_04.dat                           
+    data_04                  per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Reads                                                                       
+      APF                             0.8           0.3          48     100.0 %
+      Non-APF                         0.0           0.0           0       0.0 %
+    Writes                            0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------  ---------- 
+  Total I/Os                          0.8           0.3          48       0.1 %
+  
+  ----------------------------------------------------------------------------- 
+ 
+ 
+ 
+=============================================================================== 
+ 
+Network I/O Management
+----------------------
+ 
+  Total Network I/O Requests          9.2           3.8         549       n/a   
+    Network I/Os Delayed              0.0           0.0           0       0.0 %
+ 
+ 
+  Total TDS Packets Received      per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.1           0.1           8       1.6 %
+    Engine 1                          0.1           0.0           4       0.8 %
+    Engine 2                          0.4           0.2          26       5.2 %
+    Engine 3                          1.0           0.4          60      11.9 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                          0.9           0.4          55      10.9 %
+    Engine 8                          0.2           0.1          12       2.4 %
+    Engine 9                          3.1           1.3         188      37.4 %
+    Engine 10                         2.5           1.0         150      29.8 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total TDS Packets Rec'd             8.4           3.5         503             
+ 
+ 
+  Total Bytes Received            per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                         49.4          20.4        2962       6.0 %
+    Engine 1                          1.5           0.6          88       0.2 %
+    Engine 2                         32.5          13.4        1948       3.9 %
+    Engine 3                         97.6          40.4        5856      11.8 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                        211.8          87.7       12710      25.7 %
+    Engine 8                         16.9           7.0        1012       2.0 %
+    Engine 9                        241.7         100.0       14500      29.3 %
+    Engine 10                       173.0          71.6       10380      21.0 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Bytes Rec'd                 824.3         341.1       49456             
+ 
+ 
+   Avg Bytes Rec'd per Packet          n/a           n/a          98       n/a  
+ 
+  ----------------------------------------------------------------------------- 
+ 
+  Total TDS Packets Sent          per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                          0.1           0.0           6       0.4 %
+    Engine 1                          0.1           0.0           4       0.3 %
+    Engine 2                          0.4           0.2          26       1.7 %
+    Engine 3                          1.0           0.4          60       3.8 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                         18.6           7.7        1117      71.6 %
+    Engine 8                          0.2           0.1          12       0.8 %
+    Engine 9                          3.1           1.3         186      11.9 %
+    Engine 10                         2.5           1.0         150       9.6 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total TDS Packets Sent             26.0          10.8        1561             
+ 
+ 
+  Total Bytes Sent                per sec      per xact       count  % of total
+  -------------------------  ------------  ------------  ----------  ---------- 
+    Engine 0                         24.9          10.3        1493       0.0 %
+    Engine 1                          2.5           1.0         148       0.0 %
+    Engine 2                        113.0          46.7        6778       0.0 %
+    Engine 3                        130.2          53.9        7812       0.0 %
+    Engine 4                          0.0           0.0           0       0.0 %
+    Engine 5                          0.0           0.0           0       0.0 %
+    Engine 6                          0.0           0.0           0       0.0 %
+    Engine 7                     287701.8      119049.0    17262110      99.1 %
+    Engine 8                         47.5          19.6        2848       0.0 %
+    Engine 9                        717.1         296.7       43028       0.2 %
+    Engine 10                      1605.0         664.1       96300       0.6 %
+    Engine 11                         0.0           0.0           0       0.0 %
+  -------------------------  ------------  ------------  ----------             
+  Total Bytes Sent               290342.0      120141.5    17420517             
+ 
+ 
+  Avg Bytes Sent per Packet           n/a           n/a       11159       n/a   
+ 
+===============================================================================
+ 
diff --git a/examples/Sample.hs b/examples/Sample.hs
deleted file mode 100644
--- a/examples/Sample.hs
+++ /dev/null
@@ -1,20 +0,0 @@
-import Data.ConfigFile
-import Data.DateTime
-import Database.Sybase.Sysmon.Log
-import Database.Sybase.Sysmon.LogTypes
-import Database.Sybase.Sysmon.SysmonLog
-import System.IO
-
-main = do
-  tree <- parseSysmon "sysmon_100310_0952.out"
-  print $ "Sysmon log has interval: " ++ show (hasInterval interval tree)
-  print $ "Sysmon log intervals: " ++ show (intervals interval tree)
-  print $ fmtHints $ hints Nothing emptyCP tree  
-
-interval :: LogRequest
-interval = Just $ mkInterval start end where
-   y  = 2010 :: Integer
-   start = fromGregorian y 3 10 09 52 37
-   end   = fromGregorian y 3 10 09 53 37
-
-
diff --git a/examples/sysmon_100310_0952.out b/examples/sysmon_100310_0952.out
deleted file mode 100644
--- a/examples/sysmon_100310_0952.out
+++ /dev/null
@@ -1,1421 +0,0 @@
-=============================================================================== 
-      Sybase Adaptive Server Enterprise System Performance Report
-=============================================================================== 
- 
-Server Version:        Adaptive Server Enterprise/15.0.3/EBF 16548 ESD#1/P/Sun_ 
-Server Name:           GPAS_PERF                                                
-Run Date:              Mar 10, 2010                                             
-Sampling Started at:   Mar 10, 2010 09:52:37                                    
-Sampling Ended at:     Mar 10, 2010 09:53:37                                    
-Sample Interval:       00:01:00                                                 
-Sample Mode:           No Clear                                                 
-Counters Last Cleared: Mar 09, 2010 14:34:07                                    
- 
-=============================================================================== 
- 
-Kernel Utilization
-------------------
- 
-  Your Runnable Process Search Count is set to 2000                             
-  and I/O Polling Process Count is set to 10                                    
- 
-  Engine Busy Utilization        CPU Busy   I/O Busy       Idle                 
-  ------------------------       --------   --------   --------    
-    Engine 0                        0.0 %      0.0 %    100.0 %              
-    Engine 1                        0.0 %      0.0 %    100.0 %              
-    Engine 2                        0.0 %      0.0 %    100.0 %              
-    Engine 3                        0.0 %      0.0 %    100.0 %              
-    Engine 4                        0.0 %      0.0 %    100.0 %              
-    Engine 5                        0.0 %      0.0 %    100.0 %              
-    Engine 6                        0.0 %      0.0 %    100.0 %              
-    Engine 7                        0.0 %      0.0 %    100.0 %              
-    Engine 8                        0.3 %      0.2 %     99.5 %              
-    Engine 9                        0.0 %      0.0 %    100.0 %              
-    Engine 10                       0.0 %      0.0 %    100.0 %              
-    Engine 11                       0.0 %      0.0 %    100.0 %              
-    Engine 12                       0.0 %      0.0 %    100.0 %              
-    Engine 13                       0.0 %      0.0 %    100.0 %              
-    Engine 14                       0.0 %      0.0 %    100.0 %              
-  ------------------------       --------   --------   --------    
-  Summary           Total           0.3 %      0.2 %   1499.5 %              
-                  Average           0.0 %      0.0 %    100.0 %              
- 
-  CPU Yields by Engine            per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Engine 0                         58.6         270.4        3515       6.6 %
-    Engine 1                         59.2         273.1        3550       6.7 %
-    Engine 2                         59.1         272.8        3547       6.7 %
-    Engine 3                         59.1         272.9        3548       6.7 %
-    Engine 4                         59.1         272.8        3547       6.7 %
-    Engine 5                         59.1         272.8        3547       6.7 %
-    Engine 6                         59.1         272.9        3548       6.7 %
-    Engine 7                         59.2         273.2        3551       6.7 %
-    Engine 8                         58.9         272.0        3536       6.6 %
-    Engine 9                         59.2         273.2        3551       6.7 %
-    Engine 10                        59.2         273.2        3551       6.7 %
-    Engine 11                        59.2         273.1        3550       6.7 %
-    Engine 12                        59.2         273.1        3550       6.7 %
-    Engine 13                        59.2         273.2        3551       6.7 %
-    Engine 14                        59.2         273.0        3549       6.7 %
-  -------------------------  ------------  ------------  ----------
-  Total CPU Yields                  886.5        4091.6       53191             
- 
-  Network Checks
-    Non-Blocking                  19724.6       91036.8     1183478      95.7 %
-    Blocking                        885.4        4086.2       53121       4.3 %
-  -------------------------  ------------  ------------  ----------
-  Total Network I/O Checks        20610.0       95123.0     1236599             
-  Avg Net I/Os per Check              n/a           n/a     0.00000       n/a   
- 
-  Disk I/O Checks
-    Total Disk I/O Checks         21218.8       97933.1     1273130       n/a   
-    Checks Returning I/O           1343.3        6199.6       80595       6.3 %
-    Avg Disk I/Os Returned            n/a           n/a     0.00293       n/a   
- 
-  Tuning Recommendations for Kernel Utilization                                 
-  ---------------------------------------------                                 
-  - Consider decreasing the 'runnable process search count'
-    configuration parameter if you require the CPU's on
-    the machine to be used for other applications.
- 
- 
-=============================================================================== 
- 
-Worker Process Management
--------------------------
-                                  per sec      per xact       count  % of total
-                             ------------  ------------  ----------  ---------- 
- Worker Process Requests
-   Total Requests                     0.0           0.0           0       n/a   
- 
- Worker Process Usage
-   Total Used                         0.0           0.0           0       n/a   
-   Max Ever Used During Sample        0.0           0.0           0       n/a   
- 
- Memory Requests for Worker Processes
-   Total Requests                     0.0           0.0           0       n/a   
- 
- Tuning Recommendations for Worker Processes                                    
- -------------------------------------------                                    
-  - Consider decreasing the 'number of worker processes'
-    configuration parameter.
- 
- 
-=============================================================================== 
- 
-Parallel Query Management
--------------------------
- 
-  Parallel Query Usage            per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Parallel Queries              0.0           0.0           0       n/a   
- 
-  Merge Lock Requests             per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total # of Requests                 0.0           0.0           0       n/a   
- 
-  Sort Buffer Waits               per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total # of Waits                    0.0           0.0           0       n/a   
- 
-=============================================================================== 
- 
-Task Management                   per sec      per xact       count  % of total
----------------------------  ------------  ------------  ----------  ---------- 
- 
-  Connections Opened                  0.0           0.0           0       n/a   
- 
-  Task Context Switches by Engine
-    Engine 0                          3.7          17.2         223      33.8 %
-    Engine 1                          0.3           1.3          17       2.6 %
-    Engine 2                          0.3           1.3          17       2.6 %
-    Engine 3                          1.9           8.9         116      17.6 %
-    Engine 4                          0.4           1.9          25       3.8 %
-    Engine 5                          0.3           1.3          17       2.6 %
-    Engine 6                          0.3           1.3          17       2.6 %
-    Engine 7                          0.3           1.4          18       2.7 %
-    Engine 8                          1.7           8.0         104      15.8 %
-    Engine 9                          0.3           1.4          18       2.7 %
-    Engine 10                         0.3           1.3          17       2.6 %
-    Engine 11                         0.3           1.3          17       2.6 %
-    Engine 12                         0.3           1.3          17       2.6 %
-    Engine 13                         0.3           1.4          18       2.7 %
-    Engine 14                         0.3           1.4          18       2.7 %
-  -------------------------  ------------  ------------  ----------
-    Total Task Switches:             11.0          50.7         659             
- 
-  Task Context Switches Due To:
-    Voluntary Yields                  8.2          37.7         490      74.4 %
-    Cache Search Misses               0.3           1.5          19       2.9 %
-    Exceeding I/O batch size          0.0           0.0           0       0.0 %
-    System Disk Writes                0.4           2.0          26       3.9 %
-    Logical Lock Contention           0.0           0.0           0       0.0 %
-    Address Lock Contention           0.0           0.0           0       0.0 %
-    Latch Contention                  0.0           0.0           0       0.0 %
-    Log Semaphore Contention          0.0           0.0           0       0.0 %
-    PLC Lock Contention               0.0           0.0           0       0.0 %
-    Group Commit Sleeps               0.0           0.0           0       0.0 %
-    Last Log Page Writes              0.1           0.5           6       0.9 %
-    Modify Conflicts                  0.0           0.0           0       0.0 %
-    I/O Device Contention             0.0           0.0           0       0.0 %
-    Network Packet Received           0.0           0.0           0       0.0 %
-    Network Packet Sent               0.0           0.0           0       0.0 %
-    Network services                  0.0           0.0           0       0.0 %
-    Other Causes                      2.0           9.1         118      17.9 %
- 
- 
-=============================================================================== 
- 
-Application Management
-----------------------
- 
-  Application Statistics Summary (All Applications)
-  -------------------------------------------------
-  Priority Changes                per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    To High Priority                  0.0           0.0           0       0.0 %
-    To Medium Priority                0.5           2.2          29      50.0 %
-    To Low Priority                   0.5           2.2          29      50.0 %
-  -------------------------  ------------  ------------  ----------
-  Total Priority Changes              1.0           4.5          58             
- 
-  Allotted Slices Exhausted       per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Slices Exhausted              0.0           0.0           0       n/a   
- 
-  Skipped Tasks By Engine         per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Engine Skips                  0.0           0.0           0       n/a   
- 
-  Engine Scope Changes                0.0           0.0           0       n/a   
- 
-=============================================================================== 
- 
-ESP Management                    per sec      per xact       count  % of total
----------------------------  ------------  ------------  ----------  ---------- 
-  ESP Requests                        0.0           0.0           0       n/a   
-=============================================================================== 
- 
-Housekeeper Task Activity
--------------------------
-                                  per sec      per xact       count  % of total
-                             ------------  ------------  ----------             
-Buffer Cache Washes                                                             
-  Clean                            114.1         526.4        6843      99.2 % 
-  Dirty                              0.9           4.0          52       0.8 % 
-                             ------------  ------------  ----------             
-Total Washes                       114.9         530.4        6895              
- 
-Garbage Collections                  3.0          13.8         180       n/a    
-Pages Processed in GC                0.0           0.0           0       n/a    
- 
-Statistics Updates                   0.5           2.3          30       n/a    
- 
-  Tuning Recommendations for Housekeeper                                        
-  --------------------------------------                                        
-  - Consider increasing the 'housekeeper free write percent'
-    configuration parameter.
- 
-=============================================================================== 
- 
-Monitor Access to Executing SQL
--------------------------------
-                                  per sec      per xact       count  % of total
-                             ------------  ------------  ----------  ---------- 
- Waits on Execution Plans            0.0           0.0           0       n/a    
- Number of SQL Text Overflows        0.0           0.0           0       n/a    
- Maximum SQL Text Requested          n/a           n/a           0       n/a    
-  (since beginning of sample)                                                   
- 
- 
- Tuning Recommendations for Monitor Access to Executing SQL                     
- ----------------------------------------------------------                     
- - Consider decreasing the 'max SQL text monitored' parameter 
-   to 4096 (i.e., half way from its current value to Maximum 
-   SQL Text Requested).
- 
-=============================================================================== 
- 
-Transaction Profile
--------------------
- 
-  Transaction Summary             per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Committed Xacts                   0.2           n/a          13     n/a     
- 
-  Transaction Detail              per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Inserts
-      APL Heap Table                381.1        1758.8       22865      50.7 %
-      APL Clustered Table             0.0           0.0           0       0.0 %
-      Data Only Lock Table          370.0        1707.7       22200      49.3 %
-      Fast Bulk Insert                0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Total Rows Inserted             751.1        3466.5       45065     100.0 %
- 
-    Updates
-      Total Rows Updated              0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Total Rows Updated                0.0           0.0           0       0.0 %
- 
-    Data Only Locked Updates
-      Total Rows Updated              0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Total DOL Rows Updated            0.0           0.0           0       0.0 %
- 
-    Deletes
-      Total Rows Deleted              0.0           0.0           0       n/a   
-  =========================  ============  ============  ==========
-    Total Rows Affected             751.1        3466.5       45065             
- 
-=============================================================================== 
- 
-Transaction Management
-----------------------
- 
-  ULC Flushes to Xact Log         per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    by Full ULC                       0.0           0.1           1       7.1 %
-    by End Transaction                0.1           0.5           7      50.0 %
-    by Change of Database             0.0           0.2           2      14.3 %
-    by Single Log Record              0.0           0.2           2      14.3 %
-    by Unpin                          0.0           0.2           2      14.3 %
-    by Other                          0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-  Total ULC Flushes                   0.2           1.1          14             
- 
-  ULC Flushes Skipped             per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    by PLC Discards                   0.2           0.7           9     100.0 %
-  -------------------------  ------------  ------------  ----------
-  Total ULC Discards                  0.2           0.7           9             
- 
-  ULC Log Records                     1.4           6.3          82       n/a   
-  Max ULC Size During Sample          n/a           n/a           0       n/a   
- 
-  ULC Semaphore Requests
-    Granted                           2.8          12.8         166     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-  Total ULC Semaphore Req             2.8          12.8         166             
- 
-  Log Semaphore Requests
-    Granted                           0.5           2.2          28     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-  Total Log Semaphore Req             0.5           2.2          28             
- 
-  Transaction Log Writes              0.1           0.6           8       n/a   
-  Transaction Log Alloc               0.1           0.2           3       n/a   
-  Avg # Writes per Log Page           n/a           n/a     2.66667       n/a   
- 
-=============================================================================== 
- 
-Index Management
-----------------
- 
-  Nonclustered Maintenance        per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Ins/Upd Requiring Maint           0.0           0.0           0       n/a   
-      # of NC Ndx Maint               0.0           0.0           0       n/a   
- 
-    Deletes Requiring Maint           0.0           0.0           0       n/a   
-      # of NC Ndx Maint               0.0           0.0           0       n/a   
- 
-    RID Upd from Clust Split          0.0           0.0           0       n/a   
-      # of NC Ndx Maint               0.0           0.0           0       n/a   
- 
-    Upd/Del DOL Req Maint             0.0           0.0           0       n/a   
-      # of DOL Ndx Maint              0.0           0.0           0       n/a   
- 
-  Page Splits                         0.0           0.0           0       n/a   
- 
-  Page Shrinks                        0.0           0.0           0       n/a   
- 
-  Index Scans                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Ascending Scans                  20.9          96.3        1252      90.3 %
-    DOL Ascending Scans               2.2          10.1         131       9.5 %
-    Descending Scans                  0.1           0.2           3       0.2 %
-    DOL Descending Scans              0.0           0.0           0       0.0 %
-                             ------------  ------------  ----------             
-    Total Scans                      23.1         106.6        1386             
- 
-Msg 11039, Level 16, State 1:
-Server 'GPAS_PERF', Procedure 'sp_exec_SQL', Line 49:
-Another Execute Immediate statement cannot be executed inside an Execute
-Immediate statement.
-(0 rows affected)
- 
-=============================================================================== 
- 
-Lock Management
----------------
- 
-  Lock Summary                    per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Lock Requests                81.4         375.8        4885       n/a   
-  Avg Lock Contention                 0.0           0.0           0       0.0 %
-  Deadlock Percentage                 0.0           0.0           0       0.0 %
- 
-  Lock Detail                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
- 
-  Table Lock Hashtable
-    Lookups                           2.4          11.0         143       n/a   
-    Avg Chain Length                  n/a           n/a     0.41259       n/a   
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-  Exclusive Table
-    Total EX-Table Requests           0.0           0.0           0       n/a   
- 
-  Shared Table
-    Total SH-Table Requests           0.0           0.0           0       n/a   
- 
-  Exclusive Intent
-    Granted                           0.2           1.0          13     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total EX-Intent Requests            0.2           1.0          13       0.3 %
- 
-  Shared Intent
-    Granted                           2.2          10.0         130     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total SH-Intent Requests            2.2          10.0         130       2.7 %
- 
-  Page & Row Lock HashTable
-    Lookups                          33.1         152.7        1985       n/a   
-    Avg Chain Length                  n/a           n/a     0.00151       n/a   
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-  Exclusive Page
-    Granted                           0.2           0.8          10     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total EX-Page Requests              0.2           0.8          10       0.2 %
- 
-  Update Page
-    Total UP-Page Requests            0.0           0.0           0       n/a   
- 
-  Shared Page
-    Granted                          21.0          97.1        1262     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total SH-Page Requests             21.0          97.1        1262      25.8 %
- 
- 
-  Exclusive Row
-    Granted                           0.0           0.1           1     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total EX-Row Requests               0.0           0.1           1       0.0 %
- 
-  Update Row
-    Granted                           0.1           0.2           3     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total UP-Row Requests               0.1           0.2           3       0.1 %
- 
-  Shared Row
-    Granted                          11.6          53.3         693     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total SH-Row Requests              11.6          53.3         693      14.2 %
- 
- 
-  Next-Key
-    Total Next-Key Requests           0.0           0.0           0       n/a   
- 
-  Address Lock Hashtable
-    Lookups                          46.2         213.3        2773       n/a   
-    Avg Chain Length                  n/a           n/a     0.00000       n/a   
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-  Exclusive Address
-    Granted                           0.2           0.9          12     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total EX-Address Requests           0.2           0.9          12       0.2 %
- 
-  Shared Address
-    Granted                          46.0         212.4        2761     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total SH-Address Requests          46.0         212.4        2761      56.5 %
- 
- 
-  Last Page Locks on Heaps
-    Granted                         381.1        1758.8       22865     100.0 %
-    Waited                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Last Pg Locks               381.1        1758.8       22865     100.0 %
- 
- 
-  Deadlocks by Lock Type          per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Deadlocks                     0.0           0.0           0       n/a   
- 
- 
-  Deadlock Detection
-    Deadlock Searches                 0.0           0.0           0       n/a   
- 
- 
-  Lock Promotions
-    Total Lock Promotions             0.0           0.0           0       n/a   
- 
- 
-  Lock Timeouts by Lock Type      per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Timeouts                      0.0           0.0           0       n/a   
- 
- 
-=============================================================================== 
- 
-Data Cache Management
----------------------
- 
-  Cache Statistics Summary (All Caches)
-  -------------------------------------
-                                  per sec      per xact       count  % of total
-                             ------------  ------------  ----------  ----------
- 
-    Cache Search Summary
-      Total Cache Hits              945.7        4364.5       56739     100.0 %
-      Total Cache Misses              0.3           1.5          20       0.0 %
-  -------------------------  ------------  ------------  ----------
-    Total Cache Searches            946.0        4366.1       56759             
- 
-    Cache Turnover
-      Buffers Grabbed                 3.4          15.8         206       n/a   
-      Buffers Grabbed Dirty           0.0           0.0           0       0.0 %
- 
-    Cache Strategy Summary
-      Cached (LRU) Buffers          975.0        4500.1       58501     100.0 %
-      Discarded (MRU) Buffers         0.0           0.0           0       0.0 %
- 
-    Large I/O Usage
-      Large I/Os Performed            0.9           4.1          53     100.0 %
- 
-      Large I/Os Denied due to                                                  
-        Pool < Prefetch Size          0.0           0.0           0       0.0 %
-        Pages Requested                                                         
-        Reside in Another                                                       
-        Buffer Pool                   0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-    Total Large I/O Requests          0.9           4.1          53             
- 
-    Large I/O Effectiveness
-      Pages by Lrg I/O Cached         7.0          32.2         418       n/a   
-      Pages by Lrg I/O Used           7.0          32.2         418     100.0 %
- 
-    Asynchronous Prefetch Activity
-      APFs Issued                     2.2          10.2         132      95.0 %
-      APFs Denied Due To                                                        
-        APF I/O Overloads             0.0           0.0           0       0.0 %
-        APF Limit Overloads           0.0           0.0           0       0.0 %
-        APF Reused Overloads          0.0           0.0           0       0.0 %
-      APF Buffers Found in Cache                                                
-        With Spinlock Held            0.0           0.0           0       0.0 %
-        W/o Spinlock Held             0.1           0.5           7       5.0 %
-  -------------------------  ------------  ------------  ----------
-    Total APFs Requested              2.3          10.7         139             
- 
-    Other Asynchronous Prefetch Statistics
-      APFs Used                       2.2          10.2         132       n/a   
-      APF Waits for I/O               0.9           4.0          52       n/a   
-      APF Discards                    0.0           0.0           0       n/a   
- 
-    Dirty Read Behavior
-      Page Requests                   0.0           0.0           0       n/a   
- 
-------------------------------------------------------------------------------- 
-  Cache: dbcc_cache
-                                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-    Utilization                       n/a           n/a         n/a       0.0 %
- 
-    Cache Searches
-      Total Cache Searches            0.0           0.0           0       n/a
-  -------------------------  ------------  ------------  ----------
-    Total Cache Searches              0.0           0.0           0
- 
-    Pool Turnover                     0.0           0.0           0       n/a
- 
-    Buffer Wash Behavior
-      Statistics Not Available - No Buffers Entered Wash Section Yet
- 
-    Cache Strategy
-      Statistics Not Available - No Buffers Displaced Yet
- 
-    Large I/O Usage
-      Total Large I/O Requests        0.0           0.0           0       n/a
- 
-    Large I/O Detail
-     16  Kb Pool
-        Pages Cached                  0.0           0.0           0       n/a   
-        Pages Used                    0.0           0.0           0       n/a   
- 
-    Dirty Read Behavior
-	  Page Requests               0.0           0.0           0       n/a
- 
-    Tuning Recommendations for Data cache : dbcc_cache
-    -------------------------------------                                       
-    - Consider removing the 16k pool for this cache.
- 
-------------------------------------------------------------------------------- 
-  Cache: default data cache
-                                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-    Utilization                       n/a           n/a         n/a     100.0 %
- 
-    Cache Searches
-      Cache Hits                    945.7        4364.5       56739     100.0 %
-         Found in Wash                0.1           0.4           5       0.0 %
-      Cache Misses                    0.3           1.5          20       0.0 %
-  -------------------------  ------------  ------------  ----------
-    Total Cache Searches            946.0        4366.1       56759
- 
-    Pool Turnover
-      2  Kb Pool
-          LRU Buffer Grab             2.6          11.8         153      74.3 %
-            Grabbed Dirty             0.0           0.0           0       0.0 %
-      4  Kb Pool
-          LRU Buffer Grab             0.0           0.1           1       0.5 %
-            Grabbed Dirty             0.0           0.0           0       0.0 %
-      16 Kb Pool
-          LRU Buffer Grab             0.9           4.0          52      25.2 %
-            Grabbed Dirty             0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-    Total Cache Turnover              3.4          15.8         206
- 
-    Buffer Wash Behavior
-      Statistics Not Available - No Buffers Entered Wash Section Yet
- 
-    Cache Strategy
-      Cached (LRU) Buffers          975.0        4500.1       58501     100.0 %
-      Discarded (MRU) Buffers         0.0           0.0           0       0.0 %
- 
-    Large I/O Usage
-      Large I/Os Performed            0.9           4.1          53     100.0 %
- 
-      Large I/Os Denied due to
-        Pool < Prefetch Size          0.0           0.0           0       0.0 %
-        Pages Requested
-        Reside in Another
-        Buffer Pool                   0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------
-    Total Large I/O Requests          0.9           4.1          53
- 
-    Large I/O Detail
-     4   Kb Pool
-        Pages Cached                  0.0           0.2           2       n/a
-        Pages Used                    0.1           0.2           3     150.0 %
-     16  Kb Pool
-        Pages Cached                  6.9          32.0         416       n/a
-        Pages Used                    6.9          31.9         415      99.8 %
- 
-    Dirty Read Behavior
-	  Page Requests               0.0           0.0           0       n/a
- 
-    Tuning Recommendations for Data cache : default data cache
-    -------------------------------------                                       
-    - Consider using 'relaxed LRU replacement policy'
-      for this cache.
- 
-------------------------------------------------------------------------------- 
-  Cache: tempdb_cache
-                                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Spinlock Contention               n/a           n/a         n/a       0.0 %
- 
-    Utilization                       n/a           n/a         n/a       0.0 %
- 
-    Cache Searches
-      Total Cache Searches            0.0           0.0           0       n/a
-  -------------------------  ------------  ------------  ----------
-    Total Cache Searches              0.0           0.0           0
- 
-    Pool Turnover                     0.0           0.0           0       n/a
- 
-    Buffer Wash Behavior
-      Statistics Not Available - No Buffers Entered Wash Section Yet
- 
-    Cache Strategy
-      Statistics Not Available - No Buffers Displaced Yet
- 
-    Large I/O Usage
-      Total Large I/O Requests        0.0           0.0           0       n/a
- 
-    Large I/O Detail
-     4   Kb Pool
-        Pages Cached                  0.0           0.0           0       n/a   
-        Pages Used                    0.0           0.0           0       n/a   
-     16  Kb Pool
-        Pages Cached                  0.0           0.0           0       n/a   
-        Pages Used                    0.0           0.0           0       n/a   
- 
-    Dirty Read Behavior
-	  Page Requests               0.0           0.0           0       n/a
- 
-    Tuning Recommendations for Data cache : tempdb_cache
-    -------------------------------------                                       
-    - Consider using 'relaxed LRU replacement policy'
-      for this cache.
- 
-    - Consider removing the 4k pool for this cache.
- 
-    - Consider removing the 16k pool for this cache.
- 
-=============================================================================== 
- 
-Procedure Cache Management        per sec      per xact       count  % of total
----------------------------  ------------  ------------  ----------  ---------- 
-  Procedure Requests                  0.0           0.1           1       n/a   
-  Procedure Reads from Disk           0.0           0.1           1     100.0 %
-  Procedure Writes to Disk            0.0           0.0           0       0.0 %
-  Procedure Removals                  0.0           0.1           1       n/a   
-  Procedure Recompilations            0.0           0.0           0       n/a   
- 
-  SQL Statement Cache:
-    Statements Cached                 0.0           0.0           0       n/a   
-    Statements Found in Cache         0.0           0.0           0       n/a   
-    Statements Not Found              0.0           0.0           0       n/a   
-    Statements Dropped                0.0           0.0           0       n/a   
-    Statements Restored               0.0           0.0           0       n/a   
-    Statements Not Cached             0.0           0.0           0       n/a   
- 
-  Tuning Recommendations for Procedure cache management                         
-  -----------------------------------------------------                         
-  - Consider increasing the 'procedure cache size'
-    configuration parameter.
- 
- 
-=============================================================================== 
- 
-Memory Management                 per sec      per xact       count  % of total
----------------------------  ------------  ------------  ----------  ---------- 
-  Pages Allocated                     1.2           5.5          72       n/a   
-  Pages Released                      1.2           5.5          72       n/a   
- 
-=============================================================================== 
- 
-Recovery Management
--------------------
- 
-  Checkpoints                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    # of Normal Checkpoints           0.0           0.2           2     100.0 %
-    # of Free Checkpoints             0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------             
-  Total Checkpoints                   0.0           0.2           2             
- 
-  Avg Time per Normal Chkpt       0.00000 seconds                               
- 
-=============================================================================== 
- 
-Disk I/O Management
--------------------
- 
-  Max Outstanding I/Os            per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Server                            n/a           n/a          30       n/a   
-    Engine 0                          n/a           n/a          50       n/a   
-    Engine 1                          n/a           n/a          41       n/a   
-    Engine 2                          n/a           n/a          34       n/a   
-    Engine 3                          n/a           n/a         200       n/a   
-    Engine 4                          n/a           n/a          35       n/a   
-    Engine 5                          n/a           n/a          59       n/a   
-    Engine 6                          n/a           n/a          36       n/a   
-    Engine 7                          n/a           n/a          45       n/a   
-    Engine 8                          n/a           n/a          39       n/a   
-    Engine 9                          n/a           n/a         216       n/a   
-    Engine 10                         n/a           n/a          39       n/a   
-    Engine 11                         n/a           n/a          39       n/a   
-    Engine 12                         n/a           n/a          34       n/a   
-    Engine 13                         n/a           n/a          31       n/a   
-    Engine 14                         n/a           n/a          27       n/a   
- 
- 
-  I/Os Delayed by
-    Disk I/O Structures               n/a           n/a           0       n/a   
-    Server Config Limit               n/a           n/a           0       n/a   
-    Engine Config Limit               n/a           n/a           0       n/a   
-    Operating System Limit            n/a           n/a           0       n/a   
- 
- 
-  Total Requested Disk I/Os           3.9          18.1         235             
- 
-  Completed Disk I/O's
-    Asynchronous I/O's
-      Engine 0                        0.0           0.0           0       0.0 %
-      Engine 1                        0.0           0.0           0       0.0 %
-      Engine 2                        0.0           0.0           0       0.0 %
-      Engine 3                        1.3           6.2          80      33.9 %
-      Engine 4                        0.1           0.3           4       1.7 %
-      Engine 5                        0.0           0.0           0       0.0 %
-      Engine 6                        0.0           0.0           0       0.0 %
-      Engine 7                        0.0           0.0           0       0.0 %
-      Engine 8                        2.5          11.7         152      64.4 %
-      Engine 9                        0.0           0.0           0       0.0 %
-      Engine 10                       0.0           0.0           0       0.0 %
-      Engine 11                       0.0           0.0           0       0.0 %
-      Engine 12                       0.0           0.0           0       0.0 %
-      Engine 13                       0.0           0.0           0       0.0 %
-      Engine 14                       0.0           0.0           0       0.0 %
-    Synchronous I/O's
-      Total Completed I/Os            0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------             
-  Total Completed I/Os                3.9          18.2         236             
- 
- 
-  Device Activity Detail
-  ----------------------
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/dbccdb_data_01.dat                            
-    dbccdb_data_01                per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.0           0.1           1     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.1           1       0.4 %
- 
-  Mirror Semaphore Granted            0.0           0.1           1     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/dbccdb_data_02.dat                            
-    dbccdb_data_02                per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/devdata_01.dat                                
-    devdata_01                    per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.0           0.1           1     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.1           1       0.4 %
- 
-  Mirror Semaphore Granted            0.0           0.1           1     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/devdata_02.dat                                
-    devdata_02                    per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.0           0.1           1     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.1           1       0.4 %
- 
-  Mirror Semaphore Granted            0.0           0.1           1     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/devdata_03.dat                                
-    devdata_03                    per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.1           0.2           3     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.1           0.2           3       1.3 %
- 
-  Mirror Semaphore Granted            0.1           0.2           3     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/master.dat                                    
-    master                        per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.1           1       1.6 %
-    Writes                            1.0           4.6          60      98.4 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          1.0           4.7          61      25.8 %
- 
-  Mirror Semaphore Granted            1.0           4.7          61     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/sybsecurity_data_01.dat                       
-    sybsecurity_data_01           per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.1           0.5           6     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.1           0.5           6       2.5 %
- 
-  Mirror Semaphore Granted            0.1           0.5           6     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/sybsecurity_data_02.dat                       
-    sybsecurity_data_02           per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.0           0.2           2     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.2           2       0.8 %
- 
-  Mirror Semaphore Granted            0.0           0.2           2     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/sybsecurity_data_03.dat                       
-    sybsecurity_data_03           per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.1           0.6           8     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.1           0.6           8       3.4 %
- 
-  Mirror Semaphore Granted            0.1           0.6           8     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dbdat01/sysprocsdev.dat                               
-    sysprocsdev                   per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             2.2          10.2         132      90.4 %
-      Non-APF                         0.2           1.0          13       8.9 %
-    Writes                            0.0           0.1           1       0.7 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          2.4          11.2         146      61.9 %
- 
-  Mirror Semaphore Granted            2.4          11.2         146     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/dbccdb_log_01.dat                             
-    dbccdb_log_01                 per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_01.dat                                 
-    devlog_01                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_02.dat                                 
-    devlog_02                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_03.dat                                 
-    devlog_03                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_04.dat                                 
-    devlog_04                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_05.dat                                 
-    devlog_05                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/devlog_06.dat                                 
-    devlog_06                     per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/dblog01/sybsecurity_log_01.dat                        
-    sybsecurity_log_01            per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_01.dat                           
-    hperfdata_01                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.0           0.0           0       0.0 %
-    Writes                            0.0           0.1           1     100.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.1           1       0.4 %
- 
-  Mirror Semaphore Granted            0.0           0.1           1     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_02.dat                           
-    hperfdata_02                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_03.dat                           
-    hperfdata_03                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_04.dat                           
-    hperfdata_04                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_05.dat                           
-    hperfdata_05                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_06.dat                           
-    hperfdata_06                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_07.dat                           
-    hperfdata_07                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_08.dat                           
-    hperfdata_08                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_09.dat                           
-    hperfdata_09                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_10.dat                           
-    hperfdata_10                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_11.dat                           
-    hperfdata_11                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_12.dat                           
-    hperfdata_12                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_13.dat                           
-    hperfdata_13                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_14.dat                           
-    hperfdata_14                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_15.dat                           
-    hperfdata_15                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_16.dat                           
-    hperfdata_16                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_17.dat                           
-    hperfdata_17                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperfdat01/hperfdata_18.dat                           
-    hperfdata_18                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperflog01/hperflog_01.dat                            
-    hperflog_01                   per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperflog01/hperflog_02.dat                            
-    hperflog_02                   per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/hperflog01/hperflog_03.dat                            
-    hperflog_03                   per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdbdat01/tempdbdata_01.dat                         
-    tempdbdata_01                 per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-    Reads                                                                       
-      APF                             0.0           0.0           0       0.0 %
-      Non-APF                         0.1           0.5           6     100.0 %
-    Writes                            0.0           0.0           0       0.0 %
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.1           0.5           6       2.5 %
- 
-  Mirror Semaphore Granted            0.1           0.5           6     100.0 %
-  Mirror Semaphore Waited             0.0           0.0           0       0.0 %
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdbdat01/tempdbdata_02.dat                         
-    tempdbdata_02                 per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdbdat01/tempdbdata_03.dat                         
-    tempdbdata_03                 per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdbdat01/tempdbdbadatm01.dat                       
-    tempdbdbadatm01               per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdblog01/tempdbdbalogm01.dat                       
-    tempdbdbalogm01               per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdblog01/tempdblog_01.dat                          
-    tempdblog_01                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Device:                                                                       
-    /sybase/syb-gpas-perf/tempdblog01/tempdblog_02.dat                          
-    tempdblog_02                  per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       n/a   
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total I/Os                          0.0           0.0           0       0.0 %
- 
- 
-  ----------------------------------------------------------------------------- 
- 
- 
- 
-=============================================================================== 
- 
-Network I/O Management
-----------------------
- 
-  Total Network I/O Requests          0.0           0.0           0       n/a   
- 
- 
-  Total TDS Packets Received      per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total TDS Packets Rec'd             0.0           0.0           0       n/a   
- 
- 
-  Total Bytes Received            per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Bytes Rec'd                   0.0           0.0           0       n/a   
- 
- 
-  ----------------------------------------------------------------------------- 
- 
-  Total TDS Packets Sent          per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total TDS Packets Sent              0.0           0.0           0       n/a   
- 
- 
-  Total Bytes Sent                per sec      per xact       count  % of total
-  -------------------------  ------------  ------------  ----------  ---------- 
-  Total Bytes Sent                    0.0           0.0           0       n/a   
- 
- 
-===============================================================================
- 
-Replication Agent
------------------
- 
-Replication Agent:  hperf
-Replication Server: REP_GPAS01_PROD
- 
-                                  per sec      per xact       count  % of total
-                             ------------  ------------  ----------  ----------
-Log Scan Summary
-    Log Records Scanned               n/a           n/a           0       n/a
-    Log Records Processed             n/a           n/a           0       n/a
-    Number of Log Scans               n/a           n/a           0       n/a
-    Amount of Time for Log Scans (ms) n/a           n/a           0       n/a
-    Longest Time for Log Scan (ms)    n/a           n/a           0       n/a
-    Average Time per Log Scan (ms)    n/a           n/a         0.0       n/a
- 
-Log Scan Activity
-    Updates                           n/a           n/a           0       n/a
-    Inserts                           n/a           n/a           0       n/a
-    Deletes                           n/a           n/a           0       n/a
-    Store Procedures                  n/a           n/a           0       n/a
-    DDL Log Records                   n/a           n/a           0       n/a
-    Writetext Log Records             n/a           n/a           0       n/a
-    Text/Image Log Records            n/a           n/a           0       n/a
-    CLRs                              n/a           n/a           0       n/a
-    Checkpoints Processed             n/a           n/a           0       n/a
-    SQL Statements Processed          n/a           n/a           0       n/a
- 
-Transaction Activity
-    Opened                            n/a           n/a           0       n/a
-    Commited                          n/a           n/a           0       n/a
-    Aborted                           n/a           n/a           0       n/a
-    Prepared                          n/a           n/a           0       n/a
-    Delayed Commit                    n/a           n/a           0       n/a
-    Maintenance User                  n/a           n/a           0       n/a
- 
-Log Extension Wait
-    Count                             n/a           n/a           0       n/a
-    Amount of time (ms)               n/a           n/a           0       n/a
-    Longest Wait (ms)                 n/a           n/a           0       n/a
-    Average Time (ms)                 n/a           n/a         0.0       n/a
- 
-Schema Cache
- Usage
-Msg 249, Level 16, State 1:
-Server 'GPAS_PERF', Procedure 'sp_sysmon_repagent', Line 401:
-Syntax error during explicit conversion of VARCHAR value 'n/a' to a INT field.
-(return status = -6)
diff --git a/src/Database/Sybase/Sysmon/Average.hs b/src/Database/Sybase/Sysmon/Average.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/Average.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE TypeSynonymInstances #-}
+{-# LANGUAGE BangPatterns #-}
+
+-- |
+-- Module      :  Average
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Defines the class to calculate the average Sysmon report 
+
+module Database.Sybase.Sysmon.Average where
+import Database.Sybase.Sysmon.LogTypes
+import Data.List
+import Data.IntervalMap.FingerTree
+
+class Averageable a where
+  avg :: [a] -> a
+
+instance Averageable Int where
+  avg = fst . foldl' (\(!m, !n) xs -> (m+(xs-m) `div` (n+1),n+1)) (0,0) 
+
+instance Averageable Double where
+  avg = fst . foldl' (\(!m, !n) xs -> (m+(xs-m)/(n+1),n+1)) (0,0)
+
+instance Averageable String where
+  avg [] = ""
+  avg xs = head xs
+
+instance Averageable LogInterval where
+  avg xs = Interval s e where
+   s = foldr1 min $ map low xs
+   e = foldr1 max $ map high xs
diff --git a/src/Database/Sybase/Sysmon/Derive.hs b/src/Database/Sybase/Sysmon/Derive.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/Derive.hs
@@ -0,0 +1,63 @@
+-- |
+-- Module      :  Derive
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Generate average functions for Sysmon data type
+
+module Database.Sybase.Sysmon.Derive where
+import Database.Sybase.Sysmon.Average
+import Language.Haskell.TH
+import Control.Monad
+
+genpe :: String -> Int -> Q ([PatQ],[ExpQ]) 
+genpe s n = do 
+    ns <- replicateM n (newName s)
+    return (map varP ns, map varE ns) 
+ 
+deriveAverage t = do
+  TyConI (DataD _ _ _ constructors _) <- reify t
+  let avgClause (RecC name fields) = do
+        ([xsp], [xsv]) <- genpe "xs" 1
+        (pats, vars) <- genpe "x" (length fields)
+
+        let mkApp [x,y] = appE x y
+            mkApp (x:ys) = appE (mkApp (init (x:ys))) (last ys)
+        
+        let vare s = varE (mkName s)   
+        let dec (vp, fld) = valD 
+             vp 
+             (normalB 
+                (appE
+                    (vare "avg") 
+                    (appE 
+                       (appE (vare "map") (varE fld)) 
+                        xsv)
+                )
+             ) []
+
+        let declst (vp, fld) = valD
+             vp
+             (normalB
+               (appE
+                  (appE (vare "map") (vare "avg"))
+                  (appE (vare "transpose") 
+                     (appE 
+                       (appE (vare "map") (varE fld))
+                       xsv)))) []
+
+        let decl (vp, (fld, _, typ)) = case typ of
+                 AppT _ _ -> declst (vp, fld)
+                 _ -> dec (vp, fld)
+
+        let decls = map decl $ zip pats fields
+        clause [xsp] (normalB $ mkApp (conE name : vars)) decls
+
+  body <- mapM avgClause constructors
+  return [InstanceD [] (AppT (ConT $ mkName "Averageable") (ConT t)) 
+           [FunD (mkName "avg") body]
+         ]
diff --git a/src/Database/Sybase/Sysmon/Log.hs b/src/Database/Sybase/Sysmon/Log.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/Log.hs
@@ -0,0 +1,117 @@
+-- |
+-- Module      :  Log
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- The module provides the generic api to parse the logs, to store the parsed
+-- data in the IntervalMap and to query data from the IntervalMap based on the
+-- given time interval. 
+--   
+
+module Database.Sybase.Sysmon.Log 
+  ( Interval (..) 
+  , LogRequest
+  , merge
+  , parse
+  , hints 
+  , fmtHints
+  , average
+  , list
+  , intervals
+  , hasInterval
+  , mkInterval
+  ) where
+
+import Data.IntervalMap.FingerTree hiding (empty)
+import Data.Time
+import Data.Maybe (fromMaybe)
+import Data.ConfigFile hiding (merge)
+import Control.Monad.State (forM)
+import qualified System.FilePath.Glob as G (compile, globDir1) 
+import System.FilePath (splitFileName)
+import System.IO.Unsafe (unsafePerformIO)
+import System.IO
+import System.Locale (defaultTimeLocale)
+import Text.PrettyPrint
+import Database.Sybase.Sysmon.LogTypes
+import Database.Sybase.Sysmon.Average
+
+-- | The request time interval to query sysmon reports. 
+-- If the value of the request interval is Nothing the default max time
+-- interval request will be used. See function maxInterval below.
+type LogRequest = Maybe LogInterval
+
+-- | Merge two log trees
+merge :: LogEntry a => LogTree a -> LogTree a -> LogTree a
+merge = union
+
+-- | Generic parse the log files and store the data in the log tree. 
+-- To parse sysmon logs use parseSysmon from SysmonLog package.
+-- This package implements Sysmon instance of LogEntry class (see Sample.hs)
+parse :: LogEntry a => FilePath -> IO (LogTree a)
+parse path = do
+    let (dir, fp) = splitFileName path
+    fs <- G.globDir1 (G.compile fp) dir
+    if null fs then error $ fp ++ ": No such file or directory"
+      else do
+         mons <- forM fs $ \name -> do
+           h <- openFile name ReadMode
+           c <- hGetContents h
+           return [mkParse c]
+         return $ mkLogTree $ map mkNode (concat mons)
+
+-- | Max interval to cover all intervals in the log tree 
+maxInterval = mkInterval startOfTime (unsafePerformIO getCurrentTime)
+   where startOfTime = buildTime defaultTimeLocale []
+
+-- | Get hints for the average sysmon report corresponding to the request 
+-- time interval. To override the default hints parameters use ConfigFile
+-- api. See HConfig data type in SysmonTypes package for the list of the
+-- configuartion parameters.
+hints :: (Averageable a, LogEntry a) => LogRequest -> ConfigParser -> LogTree a -> [Hint]
+hints x cp = mkHints cp . average x 
+
+-- | Pretty print the hints
+fmtHints :: [Hint] -> Doc
+fmtHints hs = vcat [text "Hints:", foldr fmtHint empty hs]
+  where
+    fmtHint (ruleId, msg, details) doc = 
+       vcat [doc, 
+             vcat [nest 2 (text msg), 
+                   nest 4 (text $ show details), 
+                   nest 6 (text "Rule Name:" <+> text ruleId) 
+                  ]
+            ]
+
+-- | Average sysmon report corresponding to the requested time interval
+average :: (Averageable a, LogEntry a) => LogRequest -> LogTree a -> a        
+average x = avg . list x
+
+-- | Get log reports which intersecs with the requested time interval
+list :: LogEntry a => LogRequest -> LogTree a -> [a]
+list x = map (\(LogNode x) -> snd x) . find (fromMaybe maxInterval x)
+
+-- | Get intervals which intersect with the requested interval 
+intervals :: LogEntry a => LogRequest -> LogTree a -> [LogInterval]
+intervals x = map (\(LogNode x) -> fst x) . find (fromMaybe maxInterval x)
+
+-- | Check if the log tree contains an interval corresponding to the
+-- requested time interval
+hasInterval :: LogEntry a => LogRequest -> LogTree a -> Bool
+hasInterval x = not . null . intervals x
+
+-- | Create log time interval
+mkInterval :: UTCTime -> UTCTime -> LogInterval
+mkInterval = Interval
+
+-- | All intervals that intersect with the given interval, in 
+-- lexicographical order
+find :: LogEntry a => LogInterval -> LogTree a -> [LogNode a]
+find x = map LogNode . intersections x
+
+
+
diff --git a/src/Database/Sybase/Sysmon/LogParserPrim.hs b/src/Database/Sybase/Sysmon/LogParserPrim.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/LogParserPrim.hs
@@ -0,0 +1,114 @@
+-- |
+-- Module      :  LogParserPrim
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Log files parsing primitives 
+
+module Database.Sybase.Sysmon.LogParserPrim 
+       ( LogState (..)
+       , Field
+       , matchLine
+       , matchField
+       , optLine
+       , optString
+       , optField
+       , string
+       , field
+       , look
+       , lookAhead
+       , whileJust
+       , goto
+       ) where
+import Data.List
+import Control.Monad.State
+
+type LogState a = State [String] a 
+type Field = String
+
+-- | Discard until predicate and split a string to the fields
+line :: (String -> Bool) -> LogState [Field]
+line p = do
+   xs <- get
+   let ys = dropWhile (not . p)  xs   
+   if null ys then do
+      put ys
+      return []
+    else do
+      put $ drop 1 ys
+      return $ (words . head) ys 
+
+-- | Recursively collect values contained in the Just  
+whileJust :: Monad m => m (Maybe a) -> m [a]
+whileJust p = do
+  x <- p
+  case x of
+    Nothing -> return mzero
+    Just x -> do
+      xs <- whileJust p
+      return $ return x `mplus` xs
+
+-- | Get field after discarding the prefix 
+matchField :: Read a => String -> Int -> LogState a
+matchField s i = do
+  ls <- line (isInfixOf s)
+  return $ field i ls
+
+-- | Get fields after discarding the prefix
+matchLine :: String -> LogState [Field]
+matchLine s = line (isInfixOf s) 
+
+-- | Parse string to the field value
+field :: Read a => Int -> [Field] -> a
+field i xs = read $ xs !! i
+
+-- | Concatenate fields to the string value
+string :: Int -> Int -> [Field] -> Field
+string i j = unwords . take (j - i) . drop i
+
+-- | Look ahead for the first substring until the second substring 
+look :: String -> String -> LogState Bool
+look s f = lookAhead (isInfixOf s) (isInfixOf f) 
+
+-- | Get fields if the first substring matches otherwise return empty
+optLine :: String -> String -> LogState [Field]
+optLine f g = do
+  b <- lookAhead (isInfixOf f) (isInfixOf g)
+  if b then matchLine f
+   else return []
+
+-- | Get field if the first substring matches otherwise return a default value
+optField :: Read a => String -> String -> Int -> a -> LogState a
+optField f g i x = do
+  b <- lookAhead (isInfixOf f) (isInfixOf g)
+  if b then do 
+      h <- matchLine f
+      return $ field i h
+     else return x
+
+-- | Get string field if the first substring matches otherwise return 
+-- a default value
+optString :: String -> String -> Int -> Int -> String -> LogState Field
+optString f g i j x = do
+  b <- lookAhead (isInfixOf f) (isInfixOf g)
+  if b then do 
+      h <- matchLine f
+      return $ string i j h
+     else return x
+
+-- | Discard the matching lines 
+goto :: [String] -> LogState [Field]
+goto ss = do 
+  mapM_ matchLine ss
+  return []
+
+-- | Test the first predicate until the second predicate  
+lookAhead :: (String -> Bool) -> (String -> Bool) -> LogState Bool
+lookAhead p g = do
+   xs <- get
+   let ys = dropWhile (\x -> (not . p) x && (not . g) x) xs
+   if null ys || g (head ys) then return False else return True
diff --git a/src/Database/Sybase/Sysmon/LogTypes.hs b/src/Database/Sybase/Sysmon/LogTypes.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/LogTypes.hs
@@ -0,0 +1,53 @@
+-- |
+-- Module      :  LogTypes
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Generic log objects and types.
+
+module Database.Sybase.Sysmon.LogTypes where
+import Data.IntervalMap.FingerTree
+import Data.ConfigFile (ConfigParser)
+import Data.Time
+import Text.Printf
+
+-- | Hint is defined as the triple of the rule name, 
+-- rule action (text message) and rule conditions
+type Hint = (RuleId, Action, Facts)
+type Facts = [String]
+type Result = (Bool, Facts)
+type RuleId = String
+type Action = String
+
+-- | LogTree implemented as IntervalMap.FingerTree  
+type LogTree a = IntervalMap UTCTime a
+
+-- | The key to look for the data in the LogTree
+type LogInterval = Interval UTCTime
+
+-- | The nodes of the LogTree
+data LogNode a = LogNode (LogInterval, a)
+
+-- | Operations to parse log data, make LogTree and generate hints  
+class LogEntry a where
+  mkNode :: a -> LogNode a
+  mkParse :: String -> a
+  mkHints :: ConfigParser -> a -> [Hint]
+  mkLogTree :: [LogNode a] -> LogTree a
+  mkLogTree = foldr ins empty where
+     ins (LogNode (i, e)) = insert i e
+
+-- | Format facts data
+class (Show a) => LogShow a where
+  lshow :: a -> String
+  lshow = show
+
+instance LogShow Int
+instance LogShow Integer
+instance LogShow Bool
+instance LogShow Double where
+  lshow = printf "%.2f"
diff --git a/src/Database/Sybase/Sysmon/SysmonHints.hs b/src/Database/Sybase/Sysmon/SysmonHints.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/SysmonHints.hs
@@ -0,0 +1,289 @@
+-- |
+-- Module      :  SysmonHints
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Generate the Sysmon hints (suggestions) by comparing the data from sysmon 
+-- report to the corresponding data from the configuration. 
+
+module Database.Sybase.Sysmon.SysmonHints where
+import Database.Sybase.Sysmon.Log
+import Database.Sybase.Sysmon.LogTypes
+import Database.Sybase.Sysmon.SysmonTypes
+import Text.Printf
+import Statistics.Sample
+import Control.Monad.Reader
+import Data.Vector (fromList)
+import Data.ConfigFile
+import Data.Either.Utils (forceEither)
+
+type HintEnv a = Reader HConfig a
+
+-- | Default configuration. To override the default configuration item
+-- use ConfigFile package API. 
+defConfig = forceEither $ do 
+  let cp = emptyCP
+  
+  cp <- set cp "DEFAULT" "hiCPU" (show 85.0)
+  cp <- set cp "DEFAULT" "hiIO" (show 50.0)
+  cp <- set cp "DEFAULT" "hiIdle" (show 30.0)
+  cp <- set cp "DEFAULT" "hiCheckDiskIO" (show 50.0)
+  cp <- set cp "DEFAULT" "loCacheHits" (show 90.0)
+  cp <- set cp "DEFAULT" "hiCacheWash" (show 5.0)
+  cp <- set cp "DEFAULT" "loLargeIO" (show 90.0)
+  cp <- set cp "DEFAULT" "loAvgDiskIO" (show 0.005)
+  cp <- set cp "DEFAULT" "hiStdDeviation" (show 30.0)
+  cp <- set cp "DEFAULT" "hiSwitchPerTransaction" (show 60.0)
+  cp <- set cp "DEFAULT" "hiContextSwitchDue" (show 10.0)
+  cp <- set cp "DEFAULT" "hiDirtyBuffers" (show 3.0)
+  cp <- set cp "DEFAULT" "hiUlcSemRequests" (show 10.0)
+  cp <- set cp "DEFAULT" "hiLogSemRequests" (show 10.0)
+  cp <- set cp "DEFAULT" "hiAvgLogWrites" (show 1.0)
+  cp <- set cp "DEFAULT" "hiCommitedTrans" (show 50)
+  cp <- set cp "DEFAULT" "hiPageSplits" (show 10)
+  cp <- set cp "DEFAULT" "hiLockSummary" (show 10.0)
+  cp <- set cp "DEFAULT" "hiDeadlock" (show 10.0)
+  cp <- set cp "DEFAULT" "hiLastPageLock" (show 10.0)
+  cp <- set cp "DEFAULT" "hiLockPromotions" (show 20)
+  cp <- set cp "DEFAULT" "loCacheSpinContention" (show 10.0)
+  cp <- set cp "DEFAULT" "ioDelayBy" "Disk"
+  return cp
+
+-- | Create Sysmon configuration from ConfigParser
+mkConfig :: ConfigParser -> HConfig
+mkConfig c = let cp = Data.ConfigFile.merge defConfig c in
+  HConfig {
+    hiCPU = forceEither $ get cp "Sysmon" "hiCPU",
+    hiIO = forceEither $ get cp "Sysmon" "hiIO",
+    hiIdle = forceEither $ get cp "Sysmon" "hiIdle",
+    hiCheckDiskIO = forceEither $ get cp "Sysmon" "hiCheckDiskIO",
+    loCacheHits = forceEither $ get cp "Sysmon" "loCacheHits",
+    hiCacheWash = forceEither $ get cp "Sysmon" "hiCacheWash",
+    loLargeIO = forceEither $ get cp "Sysmon" "loLargeIO",
+    loAvgDiskIO = forceEither $ get cp "Sysmon" "loAvgDiskIO",
+    hiStdDeviation = forceEither $ get cp "Sysmon" "hiStdDeviation",
+    hiSwitchPerTransaction = forceEither $ get cp "Sysmon" "hiSwitchPerTransaction",
+    hiContextSwitchDue = forceEither $ get cp "Sysmon" "hiContextSwitchDue",
+    hiDirtyBuffers = forceEither $ get cp "Sysmon" "hiDirtyBuffers",
+    hiUlcSemRequests = forceEither $ get cp "Sysmon" "hiUlcSemRequests",
+    hiLogSemRequests = forceEither $ get cp "Sysmon" "hiLogSemRequests",
+    hiAvgLogWrites = forceEither $ get cp "Sysmon" "hiAvgLogWrites",
+    hiCommitedTrans = forceEither $ get cp "Sysmon" "hiCommitedTrans",
+    hiPageSplits = forceEither $ get cp "Sysmon" "hiPageSplits",
+    hiLockSummary = forceEither $ get cp "Sysmon" "hiLockSummary",
+    hiDeadlock = forceEither $ get cp "Sysmon" "hiDeadlock",
+    hiLastPageLock = forceEither $ get cp "Sysmon" "hiLastPageLock",
+    hiLockPromotions = forceEither $ get cp "Sysmon" "hiLockPromotions",
+    loCacheSpinContention = forceEither $ get cp "Sysmon" "loCacheSpinContention",
+    ioDelayBy = forceEither $ get cp "Sysmon" "ioDelayBy"
+  }
+
+eval :: Sysmon -> HintEnv [Hint]
+eval s = do
+   e <- ask 
+   let results = [(id, foldResult [r s e | r <- rs] (&&), action) | 
+                  (id, rs, action) <- fs
+                 ]
+   return [(id,action,facts) | (id, (b, facts), action) <- results, b]
+
+sysmonHints :: ConfigParser -> Sysmon -> [Hint]
+sysmonHints cnf s = runReader (eval s) (mkConfig cnf)
+
+percent i t = fromIntegral i / fromIntegral t * 100.0
+
+result :: (LogShow a) => Bool -> [String] -> [a] -> Result
+result b fs ys = (b, [f ++ " = " ++ lshow y | (f,y) <- zip fs ys, b])
+
+foldResult :: [Result] -> (Bool -> Bool -> Bool) -> Result
+foldResult ds cond = foldr1 f ds where
+    f (b, s) (b', s') = (cond b b', if b then s ++ s' else s') 
+
+-- | Kernel contention 
+checkCpuBusy s e = 
+     let busy = avgCpuBusy $ kernel s 
+         b = busy >= hiCPU e in
+       result b ["CPU Busy"] [busy]
+
+checkCpuIdle s e = 
+     let busy = avgCpuBusy $ kernel s 
+         b = busy <= 100.0 - hiCPU e in
+       result b ["CPU Idle"] [100.0 - busy]
+
+checkIOEngine s e = 
+     let iobusy = avgIOBusy $ kernel s
+         cpubusy = avgCpuBusy $ kernel s
+         b = iobusy >= hiIO e && cpubusy <= (100.0 - hiCPU e) in
+       result b ["Engine IO Busy", "Engine CPU Busy"] [iobusy, cpubusy]
+
+checkIODisk s e =
+    let checkIO = checkDiskIO $ kernel s
+        avgIO = avgDiskIO $ kernel s
+        b = checkIO >= hiCheckDiskIO e && avgIO <= loAvgDiskIO e in
+     result b ["Check Disk IO", "Average Disk IO"] [checkIO, avgIO]
+
+-- | Task contention
+checkEngineBalance s e =
+    let ts = taskSwitch $ task s
+        sd = stdDev $ fromList $ map (fromIntegral.numSwitch) ts
+        b = sd >= hiStdDeviation e in
+     result b ["Standard deviation"] [sd]
+
+checkSwitchesPerTran s e =
+    let ts = totSwitch $ task s
+        tr = commited $ transaction s
+        pt = if tr == 0 then 0 
+               else fromIntegral ts / fromIntegral tr
+        b = pt >= hiSwitchPerTransaction e in
+      result b ["Context switches per transaction"] [pt]
+
+checkContextSwitches s e = 
+     let sw = taskSwitchDue $ task s
+         cs = [(cacheSearchMiss, "Cache Search Misses"), 
+               (diskWrites, "System Disk Writes"), 
+               (batchSize, "Exceeding I/O batch size"), 
+               (logicLockCont, "Logical Lock Contention"),
+               (addrLockCont, "Address Lock Contention"), 
+               (latchCont, "Latch Contention"), 
+               (semCont, "Log Semaphore Contention"), 
+               (plcLockCont, "PLC Lock Contention"),
+               (lastLogPage, "Last Log Page Writes"), 
+               (conflicts, "Modify Conflicts"), 
+               (deviceCont, "I/O Device Contention"), 
+               (netSent, "Network Packet Sent"),
+               (netServices, "Network services"), 
+               (other, "Other Causes")
+              ]
+
+         conv (f, x) = let res = percent (f sw) (totSwitchDue sw) in (x, res)
+         rs = unzip $ filter (\(_,res) -> res >= hiContextSwitchDue e) $ 
+                               map conv cs
+         b = not $ null $ fst rs in
+       uncurry (result b) rs
+     
+-- | Transaction contention 
+checkUlcCont s e = 
+     let req = ulsSemReqs $ transaction s
+         cont = percent (waited req) (totReq req) 
+         b = cont >= hiUlcSemRequests e in
+      result b ["ULC Semaphore Contention"] [cont]
+
+checkLogCont s e = 
+     let req = logSemReqs $ transaction s
+         cont = percent (waited req) (totReq req) 
+         b = cont >= hiLogSemRequests e in
+      result b ["Log Semaphore Contention"] [cont]
+
+checkAvgLogWrites s e =
+     let trans = commited $ transaction s
+         avgWrites = avgLogWrites $ transaction s
+         b = trans >= hiCommitedTrans e && avgWrites >= hiAvgLogWrites e in
+      result b ["Avg # Writes per Log Page"] [avgWrites]
+
+-- | Index contention 
+checkPageCont s e = 
+     let cont = splits $ index s 
+         b = cont >= hiPageSplits e in
+      result b ["Page Splits"] [cont]
+
+-- | Lock contention 
+checkLockCont s e = 
+     let cont = percent (lockCont $ lock s) (lockReqs $ lock s) 
+         b = cont >= hiLockSummary e in
+      result b ["Average Lock Contention"] [cont]
+
+checkDeadlocks s e =
+     let cont = percent (deadlocks $ lock s) (lockReqs $ lock s)
+         b = cont >= hiDeadlock e in
+       result b ["Deadlock Percentage"] [cont]
+
+checkLastPageLocks s e =
+      let cont = percent (waited $ lpLock $ lock s) (totReq $ lpLock $ lock s)
+          b = cont >= hiLastPageLock e in
+       result b ["Last Page Lock"] [cont]
+
+checkLockPromotion s e =
+      let b = promotions (lock s) >= hiLockPromotions e in
+       result b ["Lock Promotions"] [promotions $ lock s]
+     
+-- | Cache contention 
+verifyNamedCache cache field valid msg  = 
+     let res c = (cacheName c, field c) 
+         ps = map res (caches cache) 
+         cs = unzip $ filter (\(_, val) -> valid val) ps
+         b = not $ null $ fst cs in
+       result b (map (++ msg) $ fst cs) (snd cs)
+
+checkCacheTurnover s e =
+      let db = (dirtyBuffers.cache) s
+          b = db >= hiDirtyBuffers e in
+        result b ["Buffers Grabbed Dirty"] [db] 
+
+checkSpinCont s e =
+      let valid val = val > 0 && val <= loCacheSpinContention e in
+        verifyNamedCache (cache s) spinContention valid ".Spinlock contention"       
+
+checkCacheHits s e =
+      let valid val = val > 0 && val <= loCacheHits e 
+          field c = percent (hits c) (totHitsMiss c) in  
+         verifyNamedCache (cache s) field valid ".Hits"
+
+checkCacheWash s e =
+      let valid val = val >= hiCacheWash e
+          field c = percent (wash c) (totHitsMiss c) in  
+         verifyNamedCache (cache s) field valid ".Wash"
+
+checkCacheLargeIO s e =
+       let valid val = val <= loLargeIO e 
+           field c = percent (largeIO c) (largeIOTotal c) in  
+         verifyNamedCache (cache s) field valid ".Large IO"
+
+-- | Group checks
+checkIOBusy s e =
+     let checkset = [checkIOEngine, checkIODisk] in 
+       foldResult [r s e | r <- checkset] (&&)  
+
+checkResourceCont s e =
+      let checkset = [checkContextSwitches, checkSpinCont, checkUlcCont, 
+                     checkLogCont, checkPageCont, checkLockCont] in 
+       foldResult [r s e | r <- checkset] (||)  
+
+-- | Sysmon rules       
+fs = 
+   [
+   ("ruleMoreEngines", 
+     [checkCpuBusy, checkResourceCont], 
+     "Consider to increase the number of engines"),
+   ("ruleLessEngines", 
+     [checkCpuIdle], 
+     "Consider to decrease the number of engines"),
+   ("rulesEnginesBalance", 
+     [checkEngineBalance], 
+     "Engines are unbalanced regarding task context switches"),
+   ("ruleSwitchPerTransaction", 
+     [checkSwitchesPerTran], 
+     "The increasing number of the context switches  per transaction"),
+   ("ruleContextSwitchDue", 
+     [checkContextSwitches], 
+     "Consider resources tuning to decrease the context switches due to"),
+   ("ruleIOBusy", 
+     [checkIOBusy], 
+     "The job is IO bound"),
+   ("ruleCacheContention", 
+    [checkCacheTurnover, 
+     checkSpinCont, 
+     checkCacheHits, 
+     checkCacheWash, 
+     checkCacheLargeIO], 
+    "Cache contention"),
+   ("ruleLockContention", 
+     [checkLockCont, 
+      checkDeadlocks, 
+      checkLastPageLocks, 
+      checkLockPromotion], 
+     "Lock contention")
+   ]
+
diff --git a/src/Database/Sybase/Sysmon/SysmonLog.hs b/src/Database/Sybase/Sysmon/SysmonLog.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/SysmonLog.hs
@@ -0,0 +1,287 @@
+-- |
+-- Module      :  SysmonLog
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Parse Sybase 15 Sysmon report 
+
+module Database.Sybase.Sysmon.SysmonLog 
+       ( parseSysmon 
+       ) where
+import Database.Sybase.Sysmon.LogTypes
+import Database.Sybase.Sysmon.LogParserPrim
+import Database.Sybase.Sysmon.Log (parse, Interval(..))
+import Database.Sybase.Sysmon.SysmonTypes
+import Database.Sybase.Sysmon.SysmonHints
+import Control.Monad.State
+import Data.List (isInfixOf)
+import Data.Maybe (fromJust)
+import Data.Time
+import System.Locale (defaultTimeLocale)
+
+instance LogEntry Sysmon where
+  mkNode s = LogNode (sysmonTime s, s)
+  mkParse str = evalState getSysmon (lines str)
+  mkHints = sysmonHints
+
+parseSysmon :: FilePath -> IO (LogTree Sysmon)
+parseSysmon = parse
+
+getTimeInterval :: LogState LogInterval
+getTimeInterval = do
+   start <- matchLine "Sampling Started at:"
+   end <- matchLine "Sampling Ended at:"
+   let parse = readTime defaultTimeLocale timeFormat . concat . drop 3
+   return $ Interval (parse start) (parse end)
+   where timeFormat = "%b %d, %Y %H:%M:%S"
+
+getKernel :: LogState Kernel
+getKernel = do
+   goto ["Kernel Utilization", "Engine Busy Utilization", "-"]
+   engBusy <- whileJust getEngineBusy
+
+   avg <- matchLine "Average"
+   let avgCpu = field 1 avg
+   let avgIO = field 3 avg
+
+   goto ["CPU Yields by Engine", "-"]
+   cpuYlds <- whileJust getCpuYield
+   let totYlds = sum $ map yields cpuYlds
+
+   chk <- matchLine "Checks Returning I/O"
+   let checkDiskIO = field 6 chk
+
+   avd <- matchLine "Avg Disk I/Os Returned"
+   let avgDiskIO = field 6 avd
+
+   return $ Kernel engBusy cpuYlds avgCpu avgIO totYlds checkDiskIO avgDiskIO
+
+getEngineBusy :: LogState (Maybe EngineBusy)
+getEngineBusy = do
+   b <- look "Engine " "CPU Yields by Engine"
+   if b then do 
+        eng <- matchLine "Engine "
+        let name = string 0 2 eng
+        let cpu = field 2 eng
+        let io = field 4 eng
+        return $ Just $ EngineBusy name cpu io
+     else return Nothing
+
+getCpuYield :: LogState (Maybe CpuYield)
+getCpuYield = do
+   b <- look "Engine " "Network Checks"
+   if b then do 
+        eng <- matchLine "Engine "
+        let engName = string 0 2 eng 
+        let yields = field 4 eng
+        return $ Just $ CpuYield engName yields
+     else return Nothing
+
+getTask :: LogState Task
+getTask = do
+  goto ["Task Management"]
+  con <- matchField "Connections" 4
+
+  taskSwitch <- whileJust getTaskSwitch
+  switchDue <- getTaskSwitchDue
+
+  let totSwitch = sum $ map numSwitch taskSwitch
+  return $ Task con taskSwitch switchDue totSwitch
+
+getTaskSwitch :: LogState (Maybe TaskSwitch)
+getTaskSwitch = do
+   b <- look "Engine " "Total Task Switches"
+   if b then do 
+        eng <- matchLine "Engine "
+        let name = string 0 2 eng
+        let count = field 4 eng
+        return $ Just $ TaskSwitch name count
+     else return Nothing
+
+getTaskSwitchDue :: LogState TaskSwitchDue
+getTaskSwitchDue = do
+  yields <- matchField "Voluntary Yields" 4
+  misses <- matchField "Cache Search Misses" 5
+  batch  <- matchField "Exceeding I/O batch size" 6
+  disk   <- matchField "System Disk Writes" 5
+  lcont  <- matchField "Logical Lock Contention" 5
+  acont  <- matchField "Address Lock Contention" 5
+  latch  <- matchField "Latch Contention" 4
+  sem    <- matchField "Log Semaphore Contention" 5
+  plc    <- matchField "PLC Lock Contention" 5
+  sleeps <- matchField "Group Commit Sleeps" 5
+  last   <- matchField "Last Log Page Writes" 6
+  confts <- matchField "Modify Conflicts" 4
+  device <- matchField "I/O Device Contention" 5
+  rcvd   <- matchField "Network Packet Received" 5
+  sent   <- matchField "Network Packet Sent" 5
+  srvs   <- matchField "Network services" 4
+  other  <- matchField "Other Causes" 4
+
+  let totSwitchDue = yields + misses + batch + disk + lcont + acont +
+                     latch + sem + plc + sleeps + last + confts + device +
+                     rcvd + sent + srvs + other
+
+  return $ TaskSwitchDue yields misses batch disk lcont acont latch sem plc
+                         sleeps last confts device rcvd sent srvs other totSwitchDue
+
+getTransaction :: LogState Transaction
+getTransaction = do
+  goto ["Transaction Profile"]
+
+  commits <- optField "Committed Xacts" "Transaction Detail" 4 0
+  inserts <- matchField "Total Rows Inserted" 5
+  updates <- matchField "Total Rows Updated" 5
+  deletes <- matchField "Total Rows Deleted" 5
+  flushes <- getUlcFlush 
+ 
+  ulsReqs <- getRequest "ULC Semaphore Requests"
+  logReqs <- getRequest "Log Semaphore Requests"
+
+  logWrites <- optField "Avg # Writes per Log Page" "Index Management" 8 0
+  return $ Transaction commits inserts updates deletes flushes ulsReqs logReqs logWrites
+
+getUlcFlush :: LogState UlcFlush
+getUlcFlush = do
+  ulc <- matchField "by Full ULC" 5
+  tran <- matchField "by End Transaction" 5
+  db <- matchField "by Change of Database" 6
+  log <- matchField "by Single Log Record" 6
+  unpin <- matchField "by Unpin" 4
+  other <- matchField "by Other" 4
+
+  let totFlush = ulc + tran + db + log + unpin + other
+  return $ UlcFlush ulc tran db log unpin other totFlush
+ 
+getRequest :: String -> LogState Request
+getRequest label = do
+  goto [label]
+  granted <- optField "Granted" "Total" 3 0
+  waited <- optField "Waited" "Total" 3 0
+  return $ Request granted waited (granted + waited)
+  
+getIndex :: LogState Index
+getIndex = do
+  goto ["Index Management"]
+  splits <- matchField "Page Splits" 4
+  shrinks <- matchField "Page Shrinks" 4
+  return $ Index splits shrinks
+
+getLock :: LogState Lock
+getLock = do
+  goto ["Lock Management"]
+  lockReqs <- matchField "Total Lock Requests" 5
+  lockCont <- matchField "Avg Lock Contention" 5
+  dlocks <- matchField "Deadlock Percentage" 4
+  exTable <- getRequest "Exclusive Table"
+  shTable <- getRequest "Shared Table"
+  exIntent <- getRequest "Exclusive Intent"
+  shIntent <- getRequest "Shared Intent"
+  exPage <- getRequest "Exclusive Page"
+  upPage <- getRequest "Update Page"
+  shPage <- getRequest "Shared Page"
+  exRow <- getRequest "Exclusive Row"
+  upRow <- getRequest "Update Row"
+  shRow <- getRequest "Shared Row"
+  exAddress <- getRequest "Exclusive Address"
+  shAddress <- getRequest "Shared Address"
+  lpLock <- getRequest "Last Page Locks on Heaps"
+
+  prom <- matchField "Total Lock Promotions" 5
+  tout <- matchField "Total Timeouts" 4
+
+  return $ Lock lockReqs lockCont dlocks exTable shTable exIntent shIntent exPage
+                upPage shPage exRow upRow shRow exAddress shAddress lpLock prom tout
+
+getCache :: LogState Cache
+getCache = do  
+  hits <- optField "Total Cache Hits" "Total Cache Searches" 5 0
+  misses <- optField "Total Cache Misses" "Total Cache Searches" 5 0 
+  dirtyBuffers <- optField "Buffers Grabbed Dirty" "Cache Strategy Summary" 6 0
+  caches <- whileJust getNamedCache
+
+  return $ Cache hits misses dirtyBuffers (hits+misses) caches --totCache caches
+
+getNamedCache :: LogState (Maybe NamedCache)
+getNamedCache = do
+  cache <- optString "Cache: " "Procedure Cache Management" 1 2 ""
+  if null cache then return Nothing
+   else do    
+    spin <- matchField "Spinlock Contention" 5
+    util <- matchField "Utilization" 4 
+    hits <- optField "Cache Hits" "Total Cache Searches" 4 0
+    wash <- optField "Found in Wash" "Total Cache Searches" 5 0
+    miss <- optField "Cache Misses" "Total Cache Searches" 4 0
+    perf <- optField "Large I/Os Performed" "Total Large I/O Requests" 5 0
+    reqs <- matchField "Total Large I/O Requests" 6    
+    return $ Just $ NamedCache cache spin util hits wash miss (hits + miss) perf reqs
+
+getDisk :: LogState Disk
+getDisk = do
+    goto ["Disk I/O Management"]
+    engIO <- whileJust getEngineIO
+
+    diskIO <- matchField "Disk I/O Structures" 5
+    server <- matchField "Server Config Limit" 5
+    engine <- matchField "Engine Config Limit" 5
+    os <- matchField "Operating System Limit" 5
+    reqIO <- matchField "Total Requested Disk I/Os" 6
+
+    goto ["-"]
+    comIO <- matchField "Total Completed I/Os" 5
+    dev <- whileJust getDevice
+
+    return $ Disk engIO diskIO server engine os reqIO comIO dev
+
+getEngineIO :: LogState (Maybe EngineIO)
+getEngineIO = do
+    b <- look "Engine " "I/Os Delayed by"
+    if b then do 
+        engIO <- matchLine "Engine "
+        let name = string 0 2 engIO
+        let outIO = field 4 engIO
+        return $ Just $ EngineIO name outIO
+     else return Nothing
+
+getDevice :: LogState (Maybe Device)
+getDevice = do
+     name <- optString "Device: " "Network I/O Management" 0 1 ""
+     if null name then return Nothing
+      else do    
+        totIO <- matchField "Total I/Os" 4
+        return $ Just $ Device name totIO
+
+getSysmon :: LogState Sysmon
+getSysmon = do
+   time <- getTimeInterval
+   kernel <- getKernel
+   task <- getTask
+   transaction <- getTransaction
+   index <- getIndex
+   lock <- getLock
+   cache <- getCache
+   disk <- getDisk
+
+   return $ Sysmon time kernel task transaction 
+                   index lock cache disk 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Database/Sybase/Sysmon/SysmonTypes.hs b/src/Database/Sybase/Sysmon/SysmonTypes.hs
new file mode 100644
--- /dev/null
+++ b/src/Database/Sybase/Sysmon/SysmonTypes.hs
@@ -0,0 +1,223 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- |
+-- Module      :  SysmonTypes
+-- Copyright   :  (c) Vitaliy Rukavishnikov 2011
+-- License     :  BSD-style (see the file LICENSE)
+-- 
+-- Maintainer  :  virukav@gmail.com
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Sysmon report types
+
+module Database.Sybase.Sysmon.SysmonTypes where
+import Database.Sybase.Sysmon.Log
+import Database.Sybase.Sysmon.LogTypes
+import Database.Sybase.Sysmon.Average
+import Database.Sybase.Sysmon.Derive
+import Data.List (transpose) 
+
+-- | Sysmon configuration type
+data HConfig = HConfig {
+  hiCPU :: !Double,
+  hiIO :: !Double,
+  hiIdle :: !Double,
+  hiCheckDiskIO :: !Double,
+  loAvgDiskIO :: !Double,
+  hiStdDeviation :: !Double,
+  hiSwitchPerTransaction :: !Double,
+  hiContextSwitchDue :: !Double,
+  hiDirtyBuffers :: !Double,
+  loCacheHits :: !Double,
+  hiCacheWash :: !Double,
+  loLargeIO :: !Double,
+  hiUlcSemRequests :: !Double,
+  hiLogSemRequests :: !Double,  
+  hiAvgLogWrites :: !Double,
+  hiCommitedTrans :: !Int,
+  hiPageSplits :: !Int,
+  hiLockSummary :: !Double,
+  hiDeadlock :: !Double,
+  hiLastPageLock :: !Double,
+  hiLockPromotions :: !Int,
+  loCacheSpinContention :: !Double,
+  ioDelayBy :: !String
+}
+
+data EngineBusy = EngineBusy {
+  name :: String,
+  cpuBusy :: Double,
+  ioBusy :: Double
+} deriving (Show)
+
+data CpuYield = CpuYield {
+  engName :: String,
+  yields :: Int
+} deriving (Show)
+
+data Kernel = Kernel {
+  engBusy :: [EngineBusy],
+  cpuYlds :: [CpuYield], 
+  avgCpuBusy :: Double,
+  avgIOBusy :: Double,  
+  totYlds :: Int,
+  checkDiskIO :: Double,
+  avgDiskIO :: Double
+} deriving (Show)
+
+data TaskSwitch = TaskSwitch {
+  byEngine :: String,
+  numSwitch :: Int
+} deriving (Show)
+
+data TaskSwitchDue = TaskSwitchDue {
+  volYields :: Int,
+  cacheSearchMiss :: Int,
+  batchSize :: Int,
+  diskWrites :: Int,
+  logicLockCont :: Int,
+  addrLockCont :: Int,
+  latchCont :: Int,
+  semCont :: Int,
+  plcLockCont :: Int,
+  comtSleeps :: Int,
+  lastLogPage :: Int,
+  conflicts :: Int,
+  deviceCont :: Int,
+  netReceived :: Int,
+  netSent :: Int,
+  netServices :: Int,
+  other :: Int,
+  totSwitchDue :: Int
+} deriving (Show)
+
+data Task = Task {
+  connections :: Int,
+  taskSwitch :: [TaskSwitch],
+  taskSwitchDue :: TaskSwitchDue,
+  totSwitch :: Int
+} deriving (Show)
+
+data Transaction = Transaction {
+  commited :: Int,
+  inserts :: Int,
+  updates :: Int,
+  deletes :: Int,  
+  flushes :: UlcFlush,
+  ulsSemReqs :: Request,
+  logSemReqs :: Request,
+  avgLogWrites :: Double
+} deriving (Show)
+
+data Request = Request {
+  granted :: Int,
+  waited :: Int,
+  totReq :: Int
+} deriving (Show)
+
+data UlcFlush = UlcFlush {
+  fullUlc :: Int,
+  endTran :: Int,
+  changeDB :: Int,
+  logRecord :: Int,
+  byUnpin :: Int,
+  byOther :: Int,
+  totFlush :: Int
+} deriving (Show)
+
+data Index = Index {
+  splits :: Int,
+  shrinks :: Int    
+} deriving (Show)
+
+data Lock = Lock {
+  lockReqs :: Int,
+  lockCont :: Int,
+  deadlocks :: Int,
+  exTable :: Request,
+  shTable :: Request,  
+  exIntent :: Request,
+  shIntent :: Request,
+  exPage :: Request,
+  upPage :: Request,
+  shPage :: Request,
+  exRow :: Request,
+  upRow :: Request,
+  shRow :: Request,
+  exAddress :: Request,
+  shAddress :: Request,
+  lpLock :: Request,
+  promotions :: Int,
+  timeouts :: Int
+} deriving (Show)
+
+data Cache = Cache {
+  cacheHits :: Int,
+  cacheMisses :: Int,
+  dirtyBuffers :: Double,
+  totCache :: Int,
+  caches :: [NamedCache]
+} deriving (Show)
+
+data NamedCache = NamedCache {
+  cacheName :: String,
+  spinContention :: Double,
+  utilization :: Double,
+  hits :: Int,
+  wash :: Int,
+  misses :: Int,
+  totHitsMiss :: Int,
+  largeIO :: Int,
+  largeIOTotal :: Int 
+} deriving (Show)
+
+data Disk = Disk {
+  enginesIO :: [EngineIO],
+  delayByDiskIO :: Int,
+  delayByServer :: Int,
+  delayByEngine :: Int,
+  delayByOS :: Int,
+  requestedIO :: Int,
+  completedIO :: Int,
+  devices :: [Device]
+} deriving (Show)
+
+data EngineIO = EngineIO {
+  engineName :: String,
+  outstandIO :: Int
+} deriving (Show)
+
+data Device = Device {
+  deviceName :: String,
+  totalIO :: Int
+} deriving (Show)
+
+data Sysmon = Sysmon {
+  sysmonTime :: LogInterval,
+  kernel :: Kernel,
+  task :: Task,
+  transaction :: Transaction,
+  index :: Index,
+  lock :: Lock,
+  cache :: Cache,
+  disk :: Disk 
+} deriving (Show)
+
+$(deriveAverage ''EngineBusy)
+$(deriveAverage ''CpuYield)
+$(deriveAverage ''Kernel)
+$(deriveAverage ''TaskSwitch)
+$(deriveAverage ''TaskSwitchDue)
+$(deriveAverage ''Task)
+$(deriveAverage ''Transaction)
+$(deriveAverage ''Request)
+$(deriveAverage ''UlcFlush)
+$(deriveAverage ''Index)
+$(deriveAverage ''Lock)
+$(deriveAverage ''Cache)
+$(deriveAverage ''NamedCache)
+$(deriveAverage ''Disk)
+$(deriveAverage ''EngineIO)
+$(deriveAverage ''Device)
+$(deriveAverage ''Sysmon)
diff --git a/src/Sample.hs b/src/Sample.hs
new file mode 100644
--- /dev/null
+++ b/src/Sample.hs
@@ -0,0 +1,39 @@
+import Data.ConfigFile
+import Data.Time
+import Database.Sybase.Sysmon.Log
+import Database.Sybase.Sysmon.SysmonLog (parseSysmon)
+import Database.Sybase.Sysmon.SysmonTypes
+import Data.Either.Utils (forceEither)
+import Control.Monad (when)
+
+import System.IO
+import System.Locale (defaultTimeLocale)
+
+-- | Simple application to parse the sysmon report files,
+-- to execute simple queries against parsed data, to generate the
+-- the hints potentially to consider. See defConfig in SysmonHints
+-- module for the default hints configuration. ConfigFile package api
+-- is used to change one of the threshold confifuration parameters
+--      
+main = do
+  tree <- parseSysmon "../data/sysmon_*.out"
+  when (hasInterval logRequest tree) $ do
+    print $ "Time interval: " ++ show (timeInterval tree)
+    print $ "Transactions: " ++ show (numTrans tree)
+    print $ fmtHints $ hints Nothing hintsCfg tree   
+  where
+    timeInterval = sysmonTime . average logRequest
+    numTrans = sum . map (commited . transaction) . list logRequest
+    hintsCfg = forceEither $ do
+         let cp = emptyCP
+         cp <- set cp "DEFAULT" "hiContextSwitchDue" "30.0"
+         return cp
+
+-- | Request time interval to query
+logRequest :: LogRequest
+logRequest = Just $ mkInterval start end where
+   start = readTime defaultTimeLocale timeFormat "Jan 27, 2010 10:00:00"
+   end = readTime defaultTimeLocale timeFormat "Jan 27, 2010 18:00:00"
+   timeFormat = "%b %d, %Y %H:%M:%S"
+
+
