summaryrefslogtreecommitdiffhomepage
path: root/Cost.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Cost.hs')
-rw-r--r--Cost.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Cost.hs b/Cost.hs
index 3e3e2df..8936dec 100644
--- a/Cost.hs
+++ b/Cost.hs
@@ -27,6 +27,11 @@ showCostMinutes (CPUCost (Seconds n))
| n < 61 = "1 minute"
| otherwise = show (n `div` 60) ++ " minutes"
+-- If an operation took n seconds on a number of cores,
+-- multiple to get the CPUCost, which is for a single core.
+coreCost :: Integer -> Seconds -> Cost op
+coreCost cores (Seconds n) = CPUCost (Seconds (cores * n))
+
castCost :: Cost a -> Cost b
castCost (CPUCost s) = CPUCost s