-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Sybase 15 sysmon reports processor -- -- 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. @package Sysmon @version 0.1.2 -- | Log files parsing primitives module Database.Sybase.Sysmon.LogParserPrim type LogState a = State [String] a type Field = String -- | Get fields after discarding the prefix matchLine :: String -> LogState [Field] -- | Get field after discarding the prefix matchField :: Read a => String -> Int -> LogState a -- | Get fields if the first substring matches otherwise return empty optLine :: String -> String -> LogState [Field] -- | Get string field if the first substring matches otherwise return a -- default value optString :: String -> String -> Int -> Int -> String -> LogState Field -- | Get field if the first substring matches otherwise return a default -- value optField :: Read a => String -> String -> Int -> a -> LogState a -- | Concatenate fields to the string value string :: Int -> Int -> [Field] -> Field -- | Parse string to the field value field :: Read a => Int -> [Field] -> a -- | Look ahead for the first substring until the second substring look :: String -> String -> LogState Bool -- | Test the first predicate until the second predicate lookAhead :: (String -> Bool) -> (String -> Bool) -> LogState Bool -- | Recursively collect values contained in the Just whileJust :: Monad m => m (Maybe a) -> m [a] -- | Discard the matching lines goto :: [String] -> LogState [Field] -- | Generic log objects and types. module Database.Sybase.Sysmon.LogTypes -- | 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) -> LogNode a -- | Operations to parse log data, make LogTree and generate hints class LogEntry a mkNode :: LogEntry a => a -> LogNode a mkParse :: LogEntry a => String -> a mkHints :: LogEntry a => ConfigParser -> a -> [Hint] mkLogTree :: LogEntry a => [LogNode a] -> LogTree a -- | Format facts data class Show a => LogShow a lshow :: LogShow a => a -> String instance LogShow Double instance LogShow Bool instance LogShow Integer instance LogShow Int -- | 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 -- | A closed interval. The lower bound should be less than or equal to the -- higher bound. data Interval v :: * -> * Interval :: v -> v -> Interval v low :: Interval v -> v high :: Interval v -> v -- | 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 -- | 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) -- | Max interval to cover all intervals in the log tree -- -- 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] -- | Pretty print the hints fmtHints :: [Hint] -> Doc -- | Average sysmon report corresponding to the requested time interval average :: (Averageable a, LogEntry a) => LogRequest -> LogTree a -> a -- | Get log reports which intersecs with the requested time interval list :: LogEntry a => LogRequest -> LogTree a -> [a] -- | Get intervals which intersect with the requested interval intervals :: LogEntry a => LogRequest -> LogTree a -> [LogInterval] -- | Check if the log tree contains an interval corresponding to the -- requested time interval hasInterval :: LogEntry a => LogRequest -> LogTree a -> Bool -- | Create log time interval mkInterval :: UTCTime -> UTCTime -> LogInterval -- | Sysmon report types module Database.Sybase.Sysmon.SysmonTypes -- | Sysmon configuration type data HConfig HConfig :: !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Int -> !Int -> !Double -> !Double -> !Double -> !Int -> !Double -> !String -> HConfig hiCPU :: HConfig -> !Double hiIO :: HConfig -> !Double hiIdle :: HConfig -> !Double hiCheckDiskIO :: HConfig -> !Double loAvgDiskIO :: HConfig -> !Double hiStdDeviation :: HConfig -> !Double hiSwitchPerTransaction :: HConfig -> !Double hiContextSwitchDue :: HConfig -> !Double hiDirtyBuffers :: HConfig -> !Double loCacheHits :: HConfig -> !Double hiCacheWash :: HConfig -> !Double loLargeIO :: HConfig -> !Double hiUlcSemRequests :: HConfig -> !Double hiLogSemRequests :: HConfig -> !Double hiAvgLogWrites :: HConfig -> !Double hiCommitedTrans :: HConfig -> !Int hiPageSplits :: HConfig -> !Int hiLockSummary :: HConfig -> !Double hiDeadlock :: HConfig -> !Double hiLastPageLock :: HConfig -> !Double hiLockPromotions :: HConfig -> !Int loCacheSpinContention :: HConfig -> !Double ioDelayBy :: HConfig -> !String data EngineBusy EngineBusy :: String -> Double -> Double -> EngineBusy name :: EngineBusy -> String cpuBusy :: EngineBusy -> Double ioBusy :: EngineBusy -> Double data CpuYield CpuYield :: String -> Int -> CpuYield engName :: CpuYield -> String yields :: CpuYield -> Int data Kernel Kernel :: [EngineBusy] -> [CpuYield] -> Double -> Double -> Int -> Double -> Double -> Kernel engBusy :: Kernel -> [EngineBusy] cpuYlds :: Kernel -> [CpuYield] avgCpuBusy :: Kernel -> Double avgIOBusy :: Kernel -> Double totYlds :: Kernel -> Int checkDiskIO :: Kernel -> Double avgDiskIO :: Kernel -> Double data TaskSwitch TaskSwitch :: String -> Int -> TaskSwitch byEngine :: TaskSwitch -> String numSwitch :: TaskSwitch -> Int data TaskSwitchDue TaskSwitchDue :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> TaskSwitchDue volYields :: TaskSwitchDue -> Int cacheSearchMiss :: TaskSwitchDue -> Int batchSize :: TaskSwitchDue -> Int diskWrites :: TaskSwitchDue -> Int logicLockCont :: TaskSwitchDue -> Int addrLockCont :: TaskSwitchDue -> Int latchCont :: TaskSwitchDue -> Int semCont :: TaskSwitchDue -> Int plcLockCont :: TaskSwitchDue -> Int comtSleeps :: TaskSwitchDue -> Int lastLogPage :: TaskSwitchDue -> Int conflicts :: TaskSwitchDue -> Int deviceCont :: TaskSwitchDue -> Int netReceived :: TaskSwitchDue -> Int netSent :: TaskSwitchDue -> Int netServices :: TaskSwitchDue -> Int other :: TaskSwitchDue -> Int totSwitchDue :: TaskSwitchDue -> Int data Task Task :: Int -> [TaskSwitch] -> TaskSwitchDue -> Int -> Task connections :: Task -> Int taskSwitch :: Task -> [TaskSwitch] taskSwitchDue :: Task -> TaskSwitchDue totSwitch :: Task -> Int data Transaction Transaction :: Int -> Int -> Int -> Int -> UlcFlush -> Request -> Request -> Double -> Transaction commited :: Transaction -> Int inserts :: Transaction -> Int updates :: Transaction -> Int deletes :: Transaction -> Int flushes :: Transaction -> UlcFlush ulsSemReqs :: Transaction -> Request logSemReqs :: Transaction -> Request avgLogWrites :: Transaction -> Double data Request Request :: Int -> Int -> Int -> Request granted :: Request -> Int waited :: Request -> Int totReq :: Request -> Int data UlcFlush UlcFlush :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> UlcFlush fullUlc :: UlcFlush -> Int endTran :: UlcFlush -> Int changeDB :: UlcFlush -> Int logRecord :: UlcFlush -> Int byUnpin :: UlcFlush -> Int byOther :: UlcFlush -> Int totFlush :: UlcFlush -> Int data Index Index :: Int -> Int -> Index splits :: Index -> Int shrinks :: Index -> Int data Lock Lock :: Int -> Int -> Int -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Request -> Int -> Int -> Lock lockReqs :: Lock -> Int lockCont :: Lock -> Int deadlocks :: Lock -> Int exTable :: Lock -> Request shTable :: Lock -> Request exIntent :: Lock -> Request shIntent :: Lock -> Request exPage :: Lock -> Request upPage :: Lock -> Request shPage :: Lock -> Request exRow :: Lock -> Request upRow :: Lock -> Request shRow :: Lock -> Request exAddress :: Lock -> Request shAddress :: Lock -> Request lpLock :: Lock -> Request promotions :: Lock -> Int timeouts :: Lock -> Int data Cache Cache :: Int -> Int -> Double -> Int -> [NamedCache] -> Cache cacheHits :: Cache -> Int cacheMisses :: Cache -> Int dirtyBuffers :: Cache -> Double totCache :: Cache -> Int caches :: Cache -> [NamedCache] data NamedCache NamedCache :: String -> Double -> Double -> Int -> Int -> Int -> Int -> Int -> Int -> NamedCache cacheName :: NamedCache -> String spinContention :: NamedCache -> Double utilization :: NamedCache -> Double hits :: NamedCache -> Int wash :: NamedCache -> Int misses :: NamedCache -> Int totHitsMiss :: NamedCache -> Int largeIO :: NamedCache -> Int largeIOTotal :: NamedCache -> Int data Disk Disk :: [EngineIO] -> Int -> Int -> Int -> Int -> Int -> Int -> [Device] -> Disk enginesIO :: Disk -> [EngineIO] delayByDiskIO :: Disk -> Int delayByServer :: Disk -> Int delayByEngine :: Disk -> Int delayByOS :: Disk -> Int requestedIO :: Disk -> Int completedIO :: Disk -> Int devices :: Disk -> [Device] data EngineIO EngineIO :: String -> Int -> EngineIO engineName :: EngineIO -> String outstandIO :: EngineIO -> Int data Device Device :: String -> Int -> Device deviceName :: Device -> String totalIO :: Device -> Int data Sysmon Sysmon :: LogInterval -> Kernel -> Task -> Transaction -> Index -> Lock -> Cache -> Disk -> Sysmon sysmonTime :: Sysmon -> LogInterval kernel :: Sysmon -> Kernel task :: Sysmon -> Task transaction :: Sysmon -> Transaction index :: Sysmon -> Index lock :: Sysmon -> Lock cache :: Sysmon -> Cache disk :: Sysmon -> Disk instance Averageable Sysmon instance Averageable Device instance Averageable EngineIO instance Averageable Disk instance Averageable NamedCache instance Averageable Cache instance Averageable Lock instance Averageable Index instance Averageable UlcFlush instance Averageable Request instance Averageable Transaction instance Averageable Task instance Averageable TaskSwitchDue instance Averageable TaskSwitch instance Averageable Kernel instance Averageable CpuYield instance Averageable EngineBusy instance Show EngineBusy instance Show CpuYield instance Show Kernel instance Show TaskSwitch instance Show TaskSwitchDue instance Show Task instance Show Request instance Show UlcFlush instance Show Transaction instance Show Index instance Show Lock instance Show NamedCache instance Show Cache instance Show EngineIO instance Show Device instance Show Disk instance Show Sysmon -- | Generate the Sysmon hints (suggestions) by comparing the data from -- sysmon report to the corresponding data from the configuration. module Database.Sybase.Sysmon.SysmonHints type HintEnv a = Reader HConfig a -- | Default configuration. To override the default configuration item use -- ConfigFile package API. -- -- Create Sysmon configuration from ConfigParser mkConfig :: ConfigParser -> HConfig eval :: Sysmon -> HintEnv [Hint] sysmonHints :: ConfigParser -> Sysmon -> [Hint] result :: LogShow a => Bool -> [String] -> [a] -> Result foldResult :: [Result] -> (Bool -> Bool -> Bool) -> Result -- | Parse Sybase 15 Sysmon report module Database.Sybase.Sysmon.SysmonLog parseSysmon :: FilePath -> IO (LogTree Sysmon) instance LogEntry Sysmon