Hi Petr,

How's this for a darcs record benchmark?

Thanks,

Eric

3 patches for repository http://repos.mornfall.net/darcs/benchmark:

Sun Jan 24 15:02:59 GMT 2010  Eric Kow <[email protected]>
  * Complain if the user just runs darcs-benchmark run without binaries.

Sun Jan 24 17:25:25 GMT 2010  Eric Kow <[email protected]>
  * Create temporary darcs-stats file in temporary directory.

Sun Jan 24 17:26:38 GMT 2010  Eric Kow <[email protected]>
  * Add darcs record benchmark.

New patches:

[Complain if the user just runs darcs-benchmark run without binaries.
Eric Kow <[email protected]>**20100124150259
 Ignore-this: 52747ebe945273815064f5b8a98d769
] hunk ./main.hs 7
 import System.Console.CmdArgs
 import System.Exit
 import System.Directory
+import System.IO
 import Control.Monad
 import Control.Monad.Trans
 import Benchmark
hunk ./main.hs 60
          userepos = map TestRepo $ if null repos then confrepos else repos
          usebins = map TestBinary $ if null bins then confbins else bins
          usetests = if C.fast cfg then fast else standard
+     when (null usebins) $ do
+       hPutStrLn stderr "Please specify at least one darcs binary to benchmark"
+       exitWith (ExitFailure 1)
      return ( if null userepos then allrepos else userepos
             , usebins
             , usetests
[Create temporary darcs-stats file in temporary directory.
Eric Kow <[email protected]>**20100124172525
 Ignore-this: a64e48f4c5ae972e0f567ca4fdb1f318
] hunk ./Benchmark.hs 210
 
 darcs :: String -> [String] -> Command String
 darcs cmd args' = do
-    let args = args' ++ ["+RTS", "-sdarcs-stats", "-RTS"]
+    stats_f <- liftIO $
+      do tmpdir <- getTemporaryDirectory
+         (f, h) <- openTempFile tmpdir "darcs-stats-XXXX"
+         hClose h
+         return f
+    let args = args' ++ ["+RTS", "-s" ++ stats_f, "-RTS"]
     loud <- liftIO isLoud
     verbose . unwords $ cmd:args
     (res, _, stats) <- liftIO $ do
hunk ./Benchmark.hs 223
        res' <- drain outH loud
        errs' <- drain errH loud
        ex <- waitForProcess procH
-       stats <- readFile "darcs-stats" `catch` \_ -> return ""
+       stats <- do c <- readFile stats_f
+                   removeFile stats_f
+                   return c
+                `catch` \_ -> return ""
        errs <- readChan errs'
        case ex of
          ExitSuccess -> return ()
[Add darcs record benchmark.
Eric Kow <[email protected]>**20100124172638
 Ignore-this: 7e72b78df16a2e3a5e2ceba26554c75a
] hunk ./Standard.hs 5
 import System.FilePath
 import Shellish
 import Benchmark hiding ( darcs )
-import Control.Monad( forM, filterM, when )
+import Control.Monad( forM_, mapM_, forM, filterM, when )
 import Control.Monad.Trans( liftIO )
 import qualified Control.Monad.State as MS
 
hunk ./Standard.hs 74
   forM [1..n] $ \_ -> darcs_wh [ "--look-for-adds" ] darcs
   return ()
 
+-- | n patches for each file
+record_mod :: Int -> BenchmarkCmd ()
+record_mod n darcs = do
+ cd "repo"
+ files <- filterM test_f =<< ls "."
+ forM_ [1..n] $ \x -> do
+   forM_ files $ \f -> liftIO (appendFile f (show n))
+   darcs [ "record", "--all", "-m", show x, "--no-test"]
+ darcs [ "obliterate", "--last=" ++ show n, "--all" ]
+ return ()
+
 fast :: [ Benchmark () ]
 fast = [ Destructive "get (full)" $ get 1 []
        , Destructive "get (lazy, x10)" $ get 10 ["--lazy"]

Context:

[Avoid pipe deadlock when running darcs. Print darcs output if --verbose.
Petr Rockai <[email protected]>**20100113183527
 Ignore-this: 44d3aebf79d2d7d8eb0f066cd8efa6d9
] 
[Fix up help texts.
Petr Rockai <[email protected]>**20100111174854
 Ignore-this: 5f3f7e0c5f627dacca426be62f910ed4
] 
[Produce a reasonably formatted transcript in verbose mode.
Petr Rockai <[email protected]>**20100111174818
 Ignore-this: c32e9d6a78ea72e2e362a2763bbc6d1a
] 
[Show darcs-benchmark version in help.
Eric Kow <[email protected]>**20100111115511
 Ignore-this: ac013999b2801a5012a391eeacf0f2a9
] 
[Print command being run if --verbose is set.
Eric Kow <[email protected]>**20100111120311
 Ignore-this: 5c95db48c30f5c12cf39dbeccf9985c1
] 
[Switch to CmdArgs for command line processing (UI change too).
Eric Kow <[email protected]>**20100111115542
 Ignore-this: 565f2331161b8e37cf21b1423c1e0c41
 
 This changes the UI in the following ways:
 - darcs-benchmark get (was: darcs-benchmark --get)
 - darcs-benchmark run (was: darcs-benchmark)
 - bin bin / repo repo (was: bin bin -- repo repo)
 
 These changes should make it a little bit easier to extend the functionality of
 darcs-benchmark.
] 
[Delete the unrevert patch in the pull benchmarks.
Petr Rockai <[email protected]>**20100104160011
 Ignore-this: 1f6da4da9d6ae19b91f64d1688bd2111
] 
[Update and reformat online docs (mention --dump).
Petr Rockai <[email protected]>**20091030184332
 Ignore-this: 32efc6c53af970c4957587767b08e3f7
] 
[Add a --dump option, causing machine-readable output to be produced.
Petr Rockai <[email protected]>**20091030184310
 Ignore-this: b070fc10d3eb73fcd58c935a4df9593a
] 
[Make the benchmark results (de-)serializable (show, read).
Petr Rockai <[email protected]>**20091030184223
 Ignore-this: 4417f25ce7fe284934b780c031ce30d9
] 
[Print all progress reporting to stderr instead of stdout.
Petr Rockai <[email protected]>**20091030184117
 Ignore-this: c6610ae432c5dea63539d8e82f9d45f2
] 
[TAG 0.1.3
Petr Rockai <[email protected]>**20091021185333
 Ignore-this: ef736c9c486928efc22e85eb69d508cd
] 
Patch bundle hash:
203c7cb4b5fa20763ec310f9a4b4443b739ceae0
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to