Permalink
Browse files

Remove localPath field from BenchmarkInstance

The localPath field is a bit redundant and makes it more of a pain
to move benchmarks around. The path is now generated into the
Benchmarks.hs file along with the other benchmark info when we
actually find the benchmark.
  • Loading branch information...
1 parent 83ca294 commit d8bef2f1299079e4ec83636a12124e797eb631de @dmpots committed Aug 27, 2010
View
@@ -43,6 +43,8 @@ findLocalBenchmarks baseDir = do
hPutStrLn h $ benchGroupDecl qualifiedBms
hPutStrLn h ""
hPutStrLn h $ benchInstanceDecl qualifiedBms
+ hPutStrLn h ""
+ hPutStrLn h $ benchPathDecl qualifiedBms
hClose h
bmGroups :: FilePath -> IO [FilePath]
@@ -76,10 +78,12 @@ moduleHeader = join "\n" [
" , allBenchmarks",
" , benchGroup",
" , benchInstance",
+ " , benchPath",
")",
"where",
"import Fibon.InputSize",
- "import Fibon.BenchmarkInstance"
+ "import Fibon.BenchmarkInstance",
+ "import System.FilePath"
]
where
modName = join "." benchmarksModule
@@ -134,6 +138,15 @@ benchInstanceDecl qBms =
where
defn (g,bm) = "benchInstance " ++ bm ++ " = " ++ (importAs g bm) ++ ".mkInstance"
+
+benchPathDecl :: [(String, String)] -> String
+benchPathDecl qBms =
+ "benchPath :: FibonBenchmark -> FilePath\n"++
+ (join ("\n") $ map defn qBms)
+ where
+ defn (g,bm) = "benchPath " ++ bm ++ " = " ++ s g ++ " </> " ++ s bm
+ s x = "\"" ++ x ++"\""
+
join :: String -> [String] -> String
join s ss = concat (intersperse s ss)
Submodule Benchmarks updated from a2f1db to 86a6ac
@@ -27,7 +27,6 @@ data BenchmarkInstance = BenchmarkInstance {
flagConfig :: FlagConfig
, stdinInput :: Maybe FilePath
, output :: [OutputDescription]
- , localPath :: FilePath
, exeName :: String
} deriving (Show)
@@ -68,7 +68,7 @@ bundleName bb = concat $ intersperse "-"
[(show $ benchmark bb), (show $ inputSize bb), (show $ tuneSetting bb)]
pathToBench :: BenchmarkBundle -> FilePath
-pathToBench bb = (benchDir bb) </> ((localPath . benchDetails) bb)
+pathToBench bb = (benchDir bb) </> ((benchPath . benchmark) bb)
pathToCabalWorkDir :: BenchmarkBundle -> FilePath
pathToCabalWorkDir bb = (workDir bb) </> (unique bb) </> (bundleName bb)
@@ -30,15 +30,15 @@ main = do
currentDir <- getCurrentDirectory
runConfig <- selectConfig "foo" -- for now
let workingDir = currentDir </> "run"
- benchPath = currentDir </> "benchmarks/Fibon/Benchmarks"
+ benchRoot = currentDir </> "benchmarks/Fibon/Benchmarks"
logPath = currentDir </> "log"
uniq <- chooseUniqueName workingDir (configId runConfig)
(logFile, outFile) <- Log.setupLogger logPath logPath uniq
startTime <- timeStamp
Log.notice ("Starting Run at " ++ startTime)
Log.notice ("Logging output to " ++ logFile)
Log.notice ("Logging result to " ++ outFile)
- mapM_ (runAndReport Run) (makeBundles runConfig workingDir benchPath uniq)
+ mapM_ (runAndReport Run) (makeBundles runConfig workingDir benchRoot uniq)
endTime <- timeStamp
Log.notice ("Finished Run at " ++ endTime)
Log.notice ("Logged output to " ++ logFile)
@@ -100,10 +100,10 @@ makeBundles :: RunConfig
-> FilePath -- ^ Benchmark base path
-> String -- ^ Unique Id
-> [BenchmarkBundle]
-makeBundles rc workingDir benchPath uniq = map bundle bms
+makeBundles rc workingDir benchRoot uniq = map bundle bms
where
bundle (bm, size, tune) =
- mkBundle rc bm workingDir benchPath uniq size tune
+ mkBundle rc bm workingDir benchRoot uniq size tune
bms = sort
[(bm, size, tune) |
size <- (sizeList rc),

0 comments on commit d8bef2f

Please sign in to comment.