timeplot 0.2.5 → 0.2.6
raw patch · 2 files changed
+29/−29 lines, 2 files
Files
- Tools/TimePlot.hs +28/−28
- timeplot.cabal +1/−1
Tools/TimePlot.hs view
@@ -98,12 +98,12 @@ data (TimeAxis t) => ChartKind t = KindEvent | KindDuration { mapName :: S.ByteString -> S.ByteString, subKind :: ChartKind t }- | KindHistogram { binSize :: Delta t }+ | KindCount { binSize :: Delta t } | KindQuantile { binSize :: Delta t, quantiles :: [Double] } | KindBinFreq { binSize :: Delta t, delims :: [Double] }- | KindBinCount { binSize :: Delta t, delims :: [Double] }+ | KindBinHist { binSize :: Delta t, delims :: [Double] } | KindFreq { binSize :: Delta t, style :: PlotBarsStyle }- | KindCount { binSize :: Delta t, style :: PlotBarsStyle }+ | KindHistogram { binSize :: Delta t, style :: PlotBarsStyle } | KindLines | KindDots | KindCumSum@@ -163,15 +163,15 @@ fromTime = fst `fmap` (parseTime . B.pack $ single "minimum time (inclusive)" "-fromTime" "") toTime = fst `fmap` (parseTime . B.pack $ single "maximum time (exclusive)" "-toTime" "") - parseKind ["hist", n ] = KindHistogram {binSize=read n}+ parseKind ["count", n ] = KindCount {binSize=read n} parseKind ["freq", n ] = KindFreq {binSize=read n,style=BarsClustered} parseKind ["freq", n,s] = KindFreq {binSize=read n,style=parseStyle s}- parseKind ["count", n ] = KindCount {binSize=read n,style=BarsClustered}- parseKind ["count", n,s] = KindCount {binSize=read n,style=parseStyle s}+ parseKind ["hist", n ] = KindHistogram {binSize=read n,style=BarsClustered}+ parseKind ["hist", n,s] = KindHistogram {binSize=read n,style=parseStyle s} parseKind ["event" ] = KindEvent parseKind ["quantile",b,q] = KindQuantile {binSize=read b, quantiles=read ("["++q++"]")} parseKind ["binf", b,q] = KindBinFreq {binSize=read b, delims =read ("["++q++"]")}- parseKind ["binc", b,q] = KindBinCount {binSize=read b, delims =read ("["++q++"]")}+ parseKind ["binh", b,q] = KindBinHist {binSize=read b, delims =read ("["++q++"]")} parseKind ["lines" ] = KindLines parseKind ["dots" ] = KindDots parseKind ["cumsum" ] = KindCumSum@@ -255,13 +255,13 @@ plotTrack name es = plotWithKind name (chartKindF name) es plotWithKind name k es = case k of- KindHistogram bs -> withAnyOrdinate $ plotTrackHistogram name es bs+ KindCount bs -> withAnyOrdinate $ plotTrackCount name es bs KindFreq bs k -> withAnyOrdinate $ plotTrackFreq name es bs k- KindCount bs k -> withAnyOrdinate $ plotTrackCount name es bs k+ KindHistogram bs k -> withAnyOrdinate $ plotTrackHist name es bs k KindEvent -> withAnyOrdinate $ plotTrackEvent name es KindQuantile bs qs -> withAnyOrdinate $ plotTrackQuantile name es qs bs KindBinFreq bs vs -> withAnyOrdinate $ plotTrackBinFreqs name es vs bs- KindBinCount bs vs -> withAnyOrdinate $ plotTrackBinCounts name es vs bs+ KindBinHist bs vs -> withAnyOrdinate $ plotTrackBinHist name es vs bs KindLines -> withAnyOrdinate $ plotTrackLines name es KindDots -> withAnyOrdinate $ plotTrackDots name es KindSum bs -> withAnyOrdinate $ plotTrackSum name es bs@@ -281,12 +281,12 @@ plot_bars_alignment ^= BarsLeft $ defaultPlotBars - plotTrackHistogram name es bs = layoutWithTitle (plotBars plot) name+ plotTrackCount name es bs = layoutWithTitle (plotBars plot) name where plot = plot_bars_values ^= barsData $ ourPlotBars barsData = [(t,[n]) | ((t,_),n) <- edges2bins bs t0 (edges es)] plotTrackFreq = plotTrackAtoms atoms2freqs- plotTrackCount = plotTrackAtoms atoms2counts+ plotTrackHist = plotTrackAtoms atoms2hist plotTrackAtoms f name es bs k = layoutWithTitle (plotBars plot) name where plot = plot_bars_style ^= k $@@ -327,9 +327,9 @@ where vals = byTimeBins ((0:).values2binFreqs vs) bs t0 (values es) n = length vs- plotTrackBinCounts name es vs bs = plotTrackBars vals (binTitles vs) name (binColor n)+ plotTrackBinHist name es vs bs = plotTrackBars vals (binTitles vs) name (binColor n) where- vals = byTimeBins ((0:).values2binCounts vs) bs t0 (values es)+ vals = byTimeBins ((0:).values2binHist vs) bs t0 (values es) n = length vs plotTrackBars :: (BarsPlotValue a) => [(t,[a])] -> [String] -> S.ByteString -> (Int -> AlphaColour Double) -> Layout1 t a@@ -446,25 +446,25 @@ | True = x:index (i':is) (j+1) xs values2binFreqs :: (Ord a) => [a] -> [a] -> [Double]-values2binFreqs bins xs = map toFreq $ values2binCounts bins xs+values2binFreqs bins xs = map toFreq $ values2binHist bins xs where n = length xs toFreq = if n==0 then const 0 else (\k -> fromIntegral k/fromIntegral n)-values2binCounts bins xs = values2binCounts' bins $ sort xs+values2binHist bins xs = values2binHist' bins $ sort xs where- values2binCounts' [] xs = [length xs]- values2binCounts' (a:as) xs = length xs0 : values2binCounts' as xs'+ values2binHist' [] xs = [length xs]+ values2binHist' (a:as) xs = length xs0 : values2binHist' as xs' where (xs0,xs') = span (<a) xs -atoms2counts :: (Ord a) => [a] -> [a] -> [Int]-atoms2counts as xs = map (maybe 0 id . (`M.lookup` m)) as+atoms2hist :: (Ord a) => [a] -> [a] -> [Int]+atoms2hist as xs = map (maybe 0 id . (`M.lookup` m)) as where m = foldl' insert M.empty xs insert m a = M.alter (Just . maybe 1 inc) a m inc n = n `seq` (n+1) atoms2freqs :: (Ord a) => [a] -> [a] -> [Double]-atoms2freqs as xs = map toFreq (atoms2counts as xs)+atoms2freqs as xs = map toFreq (atoms2hist as xs) where n = length xs toFreq = if n==0 then const 0 else (\k -> fromIntegral k/fromIntegral n)@@ -514,20 +514,20 @@ " '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[-].",- " '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",+ " 'count N' is for activity counts: 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 or impulses", " in that interval'.", " 'freq N [TYPE]' is for event frequency histograms: a histogram of type TYPE (stacked or ",- " clustered, default clustered) is drawn for each time bin of size N, about the distribution ",+ " clustered, default clustered) is drawn for each time bin of size N, about the *frequency* ", " of various ` events",- " 'count N [TYPE]' is for event frequency histograms: a histogram of type TYPE (stacked or ",- " clustered, default clustered) is drawn for each time bin of size N, about the counts of ",+ " 'count N [TYPE]' is for event count histograms: a histogram of type TYPE (stacked or ",+ " clustered, default clustered) is drawn for each time bin of size N, about the *counts* of ", " various ` events", " 'quantile N q1,q2,..' (example: quantile 100 0.25,0.5,0.75) - a bar chart of corresponding", " quantiles in time bins of size N",- " 'binf N v1,v2,..' (example: binf 100 1,2,5,10) - a bar chart of frequency of values falling",+ " 'binf N v1,v2,..' (example: binf 100 1,2,5,10) - a histogram of frequency of values falling", " 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",+ " 'binh N v1,v2,..' (example: binf 100 1,2,5,10) - a histogram 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",
timeplot.cabal view
@@ -1,5 +1,5 @@ Name: timeplot-Version: 0.2.5+Version: 0.2.6 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2009