Review Board 2.0.15


stats: Add total calculation to python formula class

Review Request #1677 - Created Jan. 28, 2013 and updated - Latest diff uploaded

Information
Andreas Hansson
gem5
default
Reviewers
Default
Changeset 9706:c874d053e378
---------------------------
stats: Add total calculation to python formula class

This patch adds total calculation to the formula class. This is done
by using puthon's AST module, which allows custom syntax trees to be
built. The original formula is taken, and the total is added to the
formula by manipulating the syntax tree. The tree is then evaluated to
get the total for the formula. In the event that python is unable to
evaluate the tree, NaN is returned.

As ScalarValues are treated as floats by eval, we need to extend the
total function to simply return the stat as is.