From b6d9730e98c256c900727bda14e3d3eca6284fd4 Mon Sep 17 00:00:00 2001 From: Adithya Obilisetty Date: Tue, 6 Feb 2024 02:29:40 +0530 Subject: [PATCH] Make namespace of type Int32 --- lib/Stat.hs | 12 ++++++------ stat-collector-src/Main.hs | 9 ++++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/Stat.hs b/lib/Stat.hs index 678bb64..bbc4309 100644 --- a/lib/Stat.hs +++ b/lib/Stat.hs @@ -81,7 +81,7 @@ $(MBA.deriveSerialize [d|instance MBA.Serialize Counter|]) data Metric = Metric { m_tid :: Int32 - , m_namespace :: String + , m_namespace :: Int32 , m_modName :: String , m_lineNum :: Int32 , m_counter :: Counter @@ -202,7 +202,7 @@ printMetricList handle mList = do eventGeneric :: - (forall b. IO b -> m b) -> String -> EvLoc -> SrcLoc -> Handle -> m () + (forall b. IO b -> m b) -> Int32 -> EvLoc -> SrcLoc -> Handle -> m () eventGeneric liftio namespace evLoc srcLoc handle = liftio $ do (a, b, c, d) <- getThreadStat let modName = loc_module srcLoc @@ -233,19 +233,19 @@ withEvLoc f = do start :: Q Exp start = do Loc a b c d e <- location - [|eventGeneric id "g" Start (Loc a b c d e) perfHandle|] + [|eventGeneric id 0 Start (Loc a b c d e) perfHandle|] end :: Q Exp end = do Loc a b c d e <- location - [|eventGeneric id "g" End (Loc a b c d e) perfHandle|] + [|eventGeneric id 0 End (Loc a b c d e) perfHandle|] record :: Q Exp record = do Loc a b c d e <- location - [|eventGeneric id "g" Record (Loc a b c d e) perfHandle|] + [|eventGeneric id 0 Record (Loc a b c d e) perfHandle|] restart :: Q Exp restart = do Loc a b c d e <- location - [|eventGeneric id "g" Restart (Loc a b c d e) perfHandle|] + [|eventGeneric id 0 Restart (Loc a b c d e) perfHandle|] diff --git a/stat-collector-src/Main.hs b/stat-collector-src/Main.hs index 6d38e42..39188aa 100644 --- a/stat-collector-src/Main.hs +++ b/stat-collector-src/Main.hs @@ -144,7 +144,8 @@ boundEvents = Fold step initial extract extract Just (((md1, ln1), prevVal), stk1) -> let lnStr = show ln ln1Str = show ln1 - win = [str|#{ns}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] + nsStr = show ns + win = [str|#{nsStr}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] in ( Just (Event (EventId tid counter win) (val - prevVal)) , Just stk1 ) @@ -154,7 +155,8 @@ boundEvents = Fold step initial extract extract Just (((md1, ln1), prevVal), stk1) -> let lnStr = show ln ln1Str = show ln1 - win = [str|#{ns}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] + nsStr = show ns + win = [str|#{nsStr}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] in ( Just (Event (EventId tid counter win) (val - prevVal)) , Just (((md, ln) ,val):stk1) ) @@ -164,7 +166,8 @@ boundEvents = Fold step initial extract extract Just (((md1, ln1), prevVal), _) -> let lnStr = show ln ln1Str = show ln1 - win = [str|#{ns}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] + nsStr = show ns + win = [str|#{nsStr}[#{md1}:#{ln1Str}-#{md}:#{lnStr}]|] in ( Just (Event (EventId tid counter win) (val - prevVal)) , Just stk )