haxl-2.1.2.0: A Haskell library for efficient, concurrent, and concise data access.

Safe HaskellNone
LanguageHaskell2010

Haxl.Core.Stats

Contents

Description

Types and operations for statistics and profiling. Most users should import Haxl.Core instead of importing this module directly.

Synopsis

Data-source stats

newtype Stats Source #

Stats that we collect along the way.

Constructors

Stats [FetchStats] 
Instances
Show Stats Source # 
Instance details

Defined in Haxl.Core.Stats

Methods

showsPrec :: Int -> Stats -> ShowS #

show :: Stats -> String #

showList :: [Stats] -> ShowS #

Semigroup Stats Source # 
Instance details

Defined in Haxl.Core.Stats

Methods

(<>) :: Stats -> Stats -> Stats #

sconcat :: NonEmpty Stats -> Stats #

stimes :: Integral b => b -> Stats -> Stats #

Monoid Stats Source # 
Instance details

Defined in Haxl.Core.Stats

Methods

mempty :: Stats #

mappend :: Stats -> Stats -> Stats #

mconcat :: [Stats] -> Stats #

ToJSON Stats Source # 
Instance details

Defined in Haxl.Core.Stats

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.

Constructors

FetchStats

Timing stats for a (batched) data fetch

FetchCall

The stack trace of a call to dataFetch. These are collected only when profiling and reportLevel is 5 or greater.

Fields

ppStats :: Stats -> String Source #

Pretty-print Stats.

ppFetchStats :: FetchStats -> String Source #

Pretty-print RoundStats.

Profiling

profile :: Profile -> HashMap ProfileLabel ProfileData Source #

Data on individual labels.

data ProfileData Source #

Constructors

ProfileData 

Fields

Instances
Show ProfileData Source # 
Instance details

Defined in Haxl.Core.Stats

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:

Allocation accounting is accurate only to about 4Kbytes.

Since: base-4.8.0.0