packages feed

timeplot 1.0.14 → 1.0.15

raw patch · 5 files changed

+27/−12 lines, 5 files

Files

Tools/TimePlot.hs view
@@ -48,6 +48,7 @@   if null events     then return emptyRenderable     else do+      let dropLateEvents  es = case maxT of Just t -> takeWhile ((<t) . fst) es ; Nothing -> es       -- Pass 1: find out min/max time and final track names.       let i2o t (KindNone,                _) = []           i2o t (KindWithin mapName sk, suf) = [(S.append (mapName t) suf, sk)]@@ -57,7 +58,7 @@       let (minTime, maxTime, outTracks) = foldl'              (\(!mi,!ma,!ts) (t,e) -> (min t mi, max t ma, foldr (uncurry M.insert) ts (i2oTracks $ evt_track e)))              (t0, t0, M.empty) -            events+            (dropLateEvents events)        let minOutTime = case minT of Just t -> t ; Nothing -> minTime       let maxOutTime = case maxT of Just t -> t ; Nothing -> maxTime@@ -65,7 +66,7 @@       let commonTimeAxis = transformLabels $ autoAxis [minOutTime, maxOutTime]              -- Pass 2-      events' <- readEvents+      events' <- dropLateEvents `fmap` readEvents       let eventsToTracks = [(outTrack, (t,e)) | (t,e) <- events', (outTrack,_) <- i2oTracks (evt_track e)]        let initPlot track = initGen (outTracks M.! track) (S.unpack track) minTime maxTime@@ -141,12 +142,21 @@   "  'none' - do not plot this track",   "  'event' is for event diagrams: activities are drawn like --[===]--- ,",   "     pulse events like --|-- with a label over '|'",-  "  'duration XXXX' - plot any kind of diagram over the *durations* of events",+  "  'duration [drop] XXXX' - plot any kind of diagram over the *durations* of events",   "     on a track (delimited by > ... <), for example 'duration quantile",   "     300 0.25,0.5,0.75' will plot these quantiles of durations of the",   "     events. This is useful where your log looks like 'Started processing'",   "     ... 'Finished processing': you can plot processing durations without",   "     computing them yourself. Very useful inside 'within'!",+  "     If you use 'drop', then names of the original input tracks will be dropped",+  "     before putting the events onto the output track, e.g. an event rtime.14e3ac1",+  "     when used by 'within[.] duration drop dots', will be put onto the output track",+  "     'rtime', with input track 'rtime'. When used by 'within[.] duration dots',",+  "     its input track will still be rtime.14e3ac1. The difference is whether",+  "     the output of 'duration' appears to 'XXXX' as a single or multiple input tracks.",+  "     E.g. if you're measuring durations of processing unique requests with rtime.REQID,",+  "     then use 'drop'; if it's durations of processing at certain stages with rtime.STAGE",+  "     then don't.",   "  'within[C] XXXX' - draw plot XXXX over events grouped by their track's name ",   "     before separator C. For example, if you have processes",   "     named 'MACHINE-PID' (i.e. UNIT027-8532) say 'begin something' / ",
Tools/TimePlot/Conf.hs view
@@ -142,7 +142,8 @@         parseKind ["sum",     b,s] = KindSum       {binSize=read b, subtrackStyle=parseSubtrackStyle s}
         parseKind ("sum":_)        = error $ "sum requires one or two arguments: bin size and optionally " ++ 
                                              "subtrack style, e.g.: -dk 'sum 1' or -dk 'sum 1 stacked'"
-        parseKind ("duration":ws)  = KindDuration  {subKind=parseKind ws}
+        parseKind ("duration":"drop":ws)  = KindDuration  {subKind=parseKind ws, dropSubtrack=True}
+        parseKind ("duration":ws)  = KindDuration  {subKind=parseKind ws, dropSubtrack=False}
         parseKind (('w':'i':'t':'h':'i':'n':'[':sep:"]"):ws)
                                    = KindWithin    {subKind=parseKind ws, mapName = fst . S.break (==sep)}
         parseKind ["none"        ] = KindNone
Tools/TimePlot/Plots.hs view
@@ -44,7 +44,7 @@ initGen (KindDots     alpha)    = genDots alpha
 initGen (KindSum bs ss)         = genSum bs ss
 initGen (KindCumSum bs ss)      = genCumSum bs ss
-initGen (KindDuration sk)       = genDuration sk
+initGen (KindDuration sk dropSubtrack) = genDuration sk dropSubtrack 
 initGen (KindWithin _ _)        = \name -> error $ 
   "KindWithin should not be plotted (this is a bug): track " ++ show name
 initGen KindNone                = \name -> error $ 
@@ -334,13 +334,16 @@         addEvent sum (s,(t0,_,st)) = I.insert sum (s, LongEvent (t0,True) (t1,False) st)
 
 edges2durationsSummary :: forall t . (Ord t, HasDelta t) => 
-    t -> t -> String -> StreamTransformer (t,S.ByteString,Edge) (t,InEvent)
+    t -> t -> Maybe String -> StreamTransformer (t,S.ByteString,Edge) (t,InEvent)
 edges2durationsSummary t0 t1 commonTrack = edges2eventsSummary t0 t1 . I.filterMap genDurations
   where
     genDurations (track, e) = case e of
-      LongEvent (t1,True) (t2,True) _ -> Just (t2, InValue commonTrackBS $ deltaToSeconds t2 t1)
+      LongEvent (t1,True) (t2,True) _ -> Just (t2, InValue (case commonTrack of 
+                                                              Nothing -> track
+                                                              _ -> commonTrackBS)
+                                                           (deltaToSeconds t2 t1))
       _                               -> Nothing
-    commonTrackBS = S.pack commonTrack
+    commonTrackBS = S.pack (fromJust commonTrack)
 
 genEvent :: PlotGen
 genEvent name t0 t1 = I.filterMap edges $ 
@@ -348,8 +351,9 @@                       edges2eventsSummary t0 t1 I.collect
 -- TODO Multiple tracks
 
-genDuration :: ChartKind LocalTime -> PlotGen
-genDuration sk name t0 t1 = I.filterMap edges $ edges2durationsSummary t0 t1 name (initGen sk name t0 t1)
+genDuration :: ChartKind LocalTime -> Bool -> PlotGen
+genDuration sk dropSubtrack name t0 t1 = I.filterMap edges $ 
+    edges2durationsSummary t0 t1 (if dropSubtrack then Just name else Nothing) (initGen sk name t0 t1)
 
 fromListWith' f kvs = foldl' insert M.empty kvs
   where
Tools/TimePlot/Types.hs view
@@ -91,7 +91,7 @@ data SumSubtrackStyle = SumStacked | SumOverlayed
 
 data ChartKind t = KindEvent
-               | KindDuration  { subKind :: ChartKind t }
+               | KindDuration  { subKind :: ChartKind t, dropSubtrack :: Bool }
                | KindWithin    { mapName :: S.ByteString -> S.ByteString, subKind :: ChartKind t }
                | KindACount    { binSize :: Delta t }
                | KindAPercent  { binSize :: Delta t, baseCount :: Double }
timeplot.cabal view
@@ -1,5 +1,5 @@ name: timeplot-version: 1.0.14+version: 1.0.15 cabal-version: >=1.6 build-type: Simple license: BSD3