Dimension functions and traces on C∗-algebras