Hi Gabe, Thanks for the suggestion. It would be nice if we can derive the unit from the Formula that way. However, for now, I think it's better to manually determine the stat units for three reasons: most stats involving Formula are straightforward to determine the unit, it keeps the implementation simple, and there is a corner case that could result in a wrong unit.
A bit about the corner case. We have a unit called `Ratio`, which represents a quantity of unit A divided by a quantity of unit A. There is also a unit called `Count`, which represents a quantity of any unit other than ticks, cycles, bytes, etc. The problem is that, if we have a formula `f = scalarA / scalarB`, where `scalarA` and `scalarB` have `Count` as its unit, then `f` could be a `Ratio` or a `Count / Count`. This would require the user to manually specify the unit. Regards, Hoa Nguyen On 2/6/21, Gabe Black via gem5-dev <[email protected]> wrote: > Hi folks working on stats. I noticed a lot of changes recently related to > stats and units, and while I haven't been paying that close attention to > it, it at least sounds like a pretty good idea, so go for it. > > One thing I noticed though, was that there are some stats which are derived > from other stats (formula stats I think). These specify how they're > computed by overloading operators on other stats, so if a stat should > computed as the value of stat A divided by the value of stat B, you'd set > it to be A / B. Then in addition to that, the units are also separately > computed the same way, by saying, for instance, bytes / seconds. If stat A > already has units bytes, and stat B already has units seconds, why don't we > just figure out the units of A / B as bytes / seconds without having to > specify it again? That would simplify writing out stats, and reduce the > likelihood of errors. > > Just a thought. > > Gabe > _______________________________________________ gem5-dev mailing list -- [email protected] To unsubscribe send an email to [email protected] %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
