On the trace anomaly as a measure of degrees of freedom