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]
- data FetchStats
- = FetchStats {
- fetchDataSource :: Text
- fetchBatchSize :: !Int
- fetchStart :: !Timestamp
- fetchDuration :: !Microseconds
- fetchSpace :: !Int64
- fetchFailures :: !Int
- | FetchCall {
- fetchReq :: String
- fetchStack :: [String]
- = FetchStats {
- type Microseconds = Int64
- type Timestamp = Microseconds
- getTimestamp :: IO Timestamp
- emptyStats :: Stats
- numFetches :: Stats -> Int
- ppStats :: Stats -> String
- ppFetchStats :: FetchStats -> String
- data Profile
- emptyProfile :: Profile
- profile :: Profile -> HashMap ProfileLabel ProfileData
- type ProfileLabel = Text
- data ProfileData = ProfileData {}
- emptyProfileData :: ProfileData
- type AllocCount = Int64
- type MemoHitCount = 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 |
|
Instances
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.
Profiling
profile :: Profile -> HashMap ProfileLabel ProfileData Source #
Data on individual labels.
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 MemoHitCount = 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