A calculus for costed computations (Logical Methods in Computer Science, 2011)