Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types and operations for statistics and profiling. Most users should import Haxl.Core instead of importing this module directly.
Synopsis
- newtype Stats = Stats [FetchStats]
- type CallId = Int
- data FetchStats
- = FetchStats {
- fetchDataSource :: Text
- fetchBatchSize :: !Int
- fetchStart :: !Timestamp
- fetchDuration :: !Microseconds
- fetchSpace :: !Int64
- fetchFailures :: !Int
- fetchIgnoredFailures :: !Int
- fetchBatchId :: !Int
- fetchIds :: [CallId]
- | FetchCall {
- fetchReq :: String
- fetchStack :: [String]
- fetchStatId :: !CallId
- | MemoCall {
- memoStatId :: !CallId
- memoSpace :: !Int64
- | FetchWait { }
- = FetchStats {
- type Microseconds = Int64
- type Timestamp = Microseconds
- getTimestamp :: IO Timestamp
- emptyStats :: Stats
- numFetches :: Stats -> Int
- ppStats :: Stats -> String
- ppFetchStats :: FetchStats -> String
- aggregateFetchBatches :: ([FetchStats] -> a) -> Stats -> [a]
- data Profile = Profile {}
- data ProfileMemo = ProfileMemo {}
- data ProfileFetch = ProfileFetch {}
- emptyProfile :: Profile
- type ProfileKey = Int64
- type ProfileLabel = Text
- data ProfileData = ProfileData {}
- emptyProfileData :: ProfileData
- type AllocCount = Int64
- type LabelHitCount = Int64
- getAllocationCounter :: IO Int64
- setAllocationCounter :: Int64 -> IO ()
Data-source stats
Stats that we collect along the way.
data FetchStats Source #
Maps data source name to the number of requests made in that round. The map only contains entries for sources that made requests in that round.
FetchStats | Timing stats for a (batched) data fetch |
| |
FetchCall | The stack trace of a call to |
| |
MemoCall | |
| |
FetchWait | |
|
Instances
Eq FetchStats Source # | |
Defined in Haxl.Core.Stats (==) :: FetchStats -> FetchStats -> Bool # (/=) :: FetchStats -> FetchStats -> Bool # | |
Show FetchStats Source # | |
Defined in Haxl.Core.Stats showsPrec :: Int -> FetchStats -> ShowS # show :: FetchStats -> String # showList :: [FetchStats] -> ShowS # | |
ToJSON FetchStats Source # | |
Defined in Haxl.Core.Stats toJSON :: FetchStats -> Value # toEncoding :: FetchStats -> Encoding # toJSONList :: [FetchStats] -> Value # toEncodingList :: [FetchStats] -> Encoding # |
type Microseconds = Int64 Source #
type Timestamp = Microseconds Source #
emptyStats :: Stats Source #
numFetches :: Stats -> Int Source #
ppFetchStats :: FetchStats -> String Source #
Pretty-print RoundStats.
aggregateFetchBatches :: ([FetchStats] -> a) -> Stats -> [a] Source #
Aggregate stats merging FetchStats from the same dispatched batch into one.
Profiling
Profile | |
|
data ProfileMemo Source #
Instances
Eq ProfileMemo Source # | |
Defined in Haxl.Core.Stats (==) :: ProfileMemo -> ProfileMemo -> Bool # (/=) :: ProfileMemo -> ProfileMemo -> Bool # | |
Show ProfileMemo Source # | |
Defined in Haxl.Core.Stats showsPrec :: Int -> ProfileMemo -> ShowS # show :: ProfileMemo -> String # showList :: [ProfileMemo] -> ShowS # |
data ProfileFetch Source #
Instances
Eq ProfileFetch Source # | |
Defined in Haxl.Core.Stats (==) :: ProfileFetch -> ProfileFetch -> Bool # (/=) :: ProfileFetch -> ProfileFetch -> Bool # | |
Show ProfileFetch Source # | |
Defined in Haxl.Core.Stats showsPrec :: Int -> ProfileFetch -> ShowS # show :: ProfileFetch -> String # showList :: [ProfileFetch] -> ShowS # |
type ProfileKey = Int64 Source #
type ProfileLabel = Text Source #
data ProfileData Source #
ProfileData | |
|
Instances
Show ProfileData Source # | |
Defined in Haxl.Core.Stats showsPrec :: Int -> ProfileData -> ShowS # show :: ProfileData -> String # showList :: [ProfileData] -> ShowS # |
type AllocCount = Int64 Source #
type LabelHitCount = Int64 Source #
Allocation
getAllocationCounter :: IO Int64 #
Return the current value of the allocation counter for the current thread.
Since: base-4.8.0.0
setAllocationCounter :: Int64 -> IO () #
Every thread has an allocation counter that tracks how much
memory has been allocated by the thread. The counter is
initialized to zero, and setAllocationCounter
sets the current
value. The allocation counter counts *down*, so in the absence of
a call to setAllocationCounter
its value is the negation of the
number of bytes of memory allocated by the thread.
There are two things that you can do with this counter:
- Use it as a simple profiling mechanism, with
getAllocationCounter
. - Use it as a resource limit. See
enableAllocationLimit
.
Allocation accounting is accurate only to about 4Kbytes.
Since: base-4.8.0.0