Skip to content

Commit 6deb0ca

Browse files
watashifacebook-github-bot
authored andcommitted
Include the ReportFlags in logging samples
Summary: Log the ReportFlags in Haxl Env to some data sets. This can help us group samples by differnet report flags and check stats like the allocation overhead for enabling stats or profiling. Reviewed By: josefs Differential Revision: D33436458 fbshipit-source-id: 092e36b361e0f27ae061d8d6c81b7fdf467bfb61
1 parent 7a043e0 commit 6deb0ca

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Haxl/Core/Flags.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module Haxl.Core.Flags
3232
import Control.Monad
3333
import Data.Bits
3434
import Data.List (foldl')
35+
import Text.Printf (printf)
3536

3637
-- ---------------------------------------------------------------------------
3738
-- ReportFlags
@@ -51,6 +52,11 @@ profilingDependents =
5152

5253
newtype ReportFlags = ReportFlags Int
5354

55+
instance Show ReportFlags where
56+
show (ReportFlags fs) = printf "%0*b" (fromEnum maxReportFlag + 1) fs
57+
where
58+
maxReportFlag = maxBound :: ReportFlag
59+
5460
defaultReportFlags :: ReportFlags
5561
defaultReportFlags = ReportFlags 0
5662

0 commit comments

Comments
 (0)