timeplot 0.2.4 → 0.2.5
raw patch · 2 files changed
+22/−12 lines, 2 files
Files
- Tools/TimePlot.hs +21/−11
- timeplot.cabal +1/−1
Tools/TimePlot.hs view
@@ -106,6 +106,8 @@ | KindCount { binSize :: Delta t, style :: PlotBarsStyle } | KindLines | KindDots+ | KindCumSum+ | KindSum { binSize :: Delta t } | KindNone @@ -125,7 +127,7 @@ readConf :: [String] -> Conf readConf args = case (words $ single "time format" "-tf" ("date %Y-%m-%d %H:%M:%OS")) of- ["num"] -> readConf' (fmap (int2double *** id) . B.readInt)+ ["num"] -> readConf' readDouble "date":f -> readConf' (strptime (B.pack $ unwords f)) _ -> error "Unrecognized time format (-tf)" where@@ -172,6 +174,8 @@ parseKind ["binc", b,q] = KindBinCount {binSize=read b, delims =read ("["++q++"]")} parseKind ["lines" ] = KindLines parseKind ["dots" ] = KindDots+ parseKind ["cumsum" ] = KindCumSum+ parseKind ["sum", b ] = KindSum {binSize=read b} parseKind ("duration":ws) = KindDuration {subKind=parseKind ws, mapName=id} parseKind (('d':'u':'r':'a':'t':'i':'o':'n':'[':sep:"]"):ws) = KindDuration {subKind=parseKind ws, mapName = fst . S.break (==sep)}@@ -260,6 +264,8 @@ KindBinCount bs vs -> withAnyOrdinate $ plotTrackBinCounts name es vs bs KindLines -> withAnyOrdinate $ plotTrackLines name es KindDots -> withAnyOrdinate $ plotTrackDots name es+ KindSum bs -> withAnyOrdinate $ plotTrackSum name es bs+ KindCumSum -> withAnyOrdinate $ plotTrackCumSum name es KindDuration _ _ -> error "KindDuration should not be plotted" KindNone -> error "KindNone should not be plotted" @@ -339,14 +345,20 @@ toBars tvs = [(t,diffs vs) | (t,vs) <- tvs] diffs xs = zipWith (-) xs (0:xs) - plotTrackLines name es = layoutWithTitle (toPlot plot) name- where plot = plot_lines_values ^= [values es] $ defaultPlotLines+ plotLines name vs = layoutWithTitle (toPlot plot) name+ where plot = plot_lines_values ^= [vs] $ defaultPlotLines + plotTrackLines name es = plotLines name (values es)+ plotTrackDots name es = layoutWithTitle (toPlot plot) name where plot = plot_points_values ^= values es $ plot_points_style ^= hollowCircles 4 1 (opaque blue) $ defaultPlotPoints + plotTrackCumSum name es = plotLines name $ scanl1 (\(t1,s) (t2,v) -> (t2,s+v)) (values es)++ plotTrackSum name es bs = plotLines name $ byTimeBins sum bs t0 (values es)+ layoutWithTitle plot name = layout1_title ^= "" $ layout1_plots ^= [Left plot] $@@ -472,8 +484,8 @@ " x is only available if you installed timeplot with --flags=gtk", " -or - output resolution (default 640x480)", " -if IFILE - input file; '-' means 'read from stdin'",- " -tf TF - time format: 'num' means that times are integer numbers less than 2^31",- " (for instance, line numbers); 'date PATTERN' means that times are dates",+ " -tf TF - time format: 'num' means that times are floating-point numbers",+ " (for instance, seconds elapsed since an event); 'date PATTERN' means that times are dates", " in the format specified by PATTERN - see http://linux.die.net/man/3/strptime,", " for example, [%Y-%m-%d %H:%M:%S] parses dates like [2009-10-20 16:52:43]. ", " We also support %OS for fractional seconds (i.e. %OS will parse 12.4039 or 12,4039).",@@ -502,8 +514,6 @@ " 'duration[C] XXXX' - same as 'duration', but of a track's name we only take the part before character C.", " For example, if you have processes named 'MACHINE-PID' (i.e. UNIT027-8532) say 'begin something' / ", " 'end something' and you're interested in the properties of per-machine durations, use duration[-].",- " An interesting combination is, for example, duration[-] cumsum - you'll see total durations of the",- " something for all pids on a machine, for each machine.", " 'hist N' is for histograms: a histogram is drawn with granularity of N time units, where", " the bin corresponding to [t..t+N) has value 'what was the maximal number of active events", " in that interval'.",@@ -519,10 +529,10 @@ " into bins min..v1, v1..v2, .., v2..max in time bins of size N", " 'binc N v1,v2,..' (example: binf 100 1,2,5,10) - a bar chart of counts of values falling", " into bins min..v1, v1..v2, .., v2..max in time bins of size N",- " 'lines' - a simple line plot of numeric values",- " 'dots' - a simple dot plot of numeric values",- " 'sum N' - a line plot of the sums of numeric values in time bins of size N",- " 'cumsum' - a line plot of the cumulative sums of numeric values seen so far",+ " 'lines' - a simple line plot of numeric values",+ " 'dots' - a simple dot plot of numeric values",+ " 'cumsum' - a simple line plot of the sum of the numeric values",+ " 'sum N' - a simple line plot of the sum of the numeric values in time bins of size N", "N is measured in units or in seconds." ]
timeplot.cabal view
@@ -1,5 +1,5 @@ Name: timeplot-Version: 0.2.4+Version: 0.2.5 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2009