Review Board 2.0.15


stats: Add total calculation to python formula class

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

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.

   

Issue Summary

2 0 1 1
Review request changed
Updated (April 23, 2013, 8:21 p.m.)

Description:

~  

Changeset 9512:10df991a6ac9

  ~

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.

Diff:

Revision 2 (+57 -5)

Show changes