The {\em height} of a trace is the height of the corresponding heap of pieces in Viennot's representation, or equivalently the number of factors in its Cartier-Foata decomposition. Let h(t) and |t| stand respectively for the height and the length of a trace t. Roughly speaking, |t| is the `sequential' execution time and h(t) is the `parallel' execution time. We prove that the bivariate commutative series ∑txh(t)y|t| is rational, and we give a finite representation of it. We use the rationality to obtain precise information on the asymptotics of the number of traces of a given height or length. Then, we study the average height of a trace for various probability distributions on traces. For the uniform probability distribution on traces of the same length (resp. of the same height), the asymptotic average height (resp. length) exists and is an algebraic number. To illustrate our results and methods, we consider a couple of examples: the free commutative monoid and the trace monoid whose independence graph is the ladder graph.