Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Criterion/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import qualified Data.Text.Lazy.Builder as TL
import qualified Data.Text.Lazy.IO as TL
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed as U
import qualified Language.Javascript.Flot as Flot
import qualified Language.Javascript.JQuery as JQuery
import qualified Text.Hastache as H

-- | Trim long flat tails from a KDE plot.
Expand Down Expand Up @@ -87,10 +89,12 @@ formatReport :: [Report]
-> IO TL.Text
formatReport reports template = do
templates <- getTemplateDir
let context "report" = return $ MuList $ map inner reports
context "json" = return $ MuVariable (encode reports)
context "include" = return $ MuLambdaM $ includeFile [templates]
context _ = return $ MuNothing
let context "report" = return $ MuList $ map inner reports
context "json" = return $ MuVariable (encode reports)
context "include" = return $ MuLambdaM $ includeFile [templates]
context "js-jquery" = fmap MuVariable $ TL.readFile =<< JQuery.file
context "js-flot" = fmap MuVariable $ TL.readFile =<< Flot.file Flot.Flot
context _ = return $ MuNothing
encode v = TL.toLazyText . encodeToTextBuilder . toJSON $ v
inner r@Report{..} = mkStrContextM $ \nym ->
case nym of
Expand Down
4 changes: 0 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Some files in templates/js have their own copyright and license, please
refer to the corresponding sources in js-src/.
6 changes: 2 additions & 4 deletions criterion.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ extra-source-files:
examples/*.cabal
examples/*.hs
examples/*.html
js-src/flot-0.8.3.zip
js-src/jquery-2.1.1.js

data-files:
templates/*.css
templates/*.tpl
templates/js/jquery-2.1.1.min.js
templates/js/jquery.criterion.js
templates/js/jquery.flot-0.8.3.min.js

description:
This library provides a powerful but simple way to measure software
Expand Down Expand Up @@ -85,6 +81,8 @@ library
filepath,
Glob >= 0.7.2,
hastache >= 0.6.0,
js-flot,
js-jquery,
mtl >= 2,
mwc-random >= 0.8.0.3,
optparse-applicative >= 0.11,
Expand Down
8 changes: 3 additions & 5 deletions examples/Comparison.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Criterion.Main

main = defaultMain [
bcompare [
bench "exp" $ whnf exp (2 :: Double)
, bench "log" $ whnf log (2 :: Double)
, bench "sqrt" $ whnf sqrt (2 :: Double)
]
bench "exp" $ whnf exp (2 :: Double)
, bench "log" $ whnf log (2 :: Double)
, bench "sqrt" $ whnf sqrt (2 :: Double)
]
Binary file removed js-src/flot-0.8.3.zip
Binary file not shown.
Loading