It's basically because of reset.  If stats can be reset at any time,
but you're writing code that depends on the stat, things don't work
right.  Think about something where you want something to happen every
1000 instructions, well, if stats get reset randomly, that won't
happen correctly.

  Nate

> So the follow-up question for anyone inclined to answer is: Is there ever a
> reason to have a "counter" variable and a "stat" variable? Is there
> something with resetting stats (or ???) that I'm missing?
>
> The example I can point to is in the "numInst" and "numInsts" in the
> SimpleCPU:
>     void countInst()
>     {
>         numInst++;
>         numInsts++;
>
>         thread->funcExeInst++;
>     }
>
> Quickly looking through the code, I don't really see a reason to have two
> distinct variables there.
>
>
> On Fri, Mar 5, 2010 at 1:27 PM, Lisa Hsu <[email protected]> wrote:
>>
>> Korey,
>> Use myStat[tid].value()
>> Lisa
>>
>> On Fri, Mar 5, 2010 at 9:07 AM, Korey Sewell <[email protected]> wrote:
>>>
>>> Is there a way to get the run-time value of a stat?
>>>
>>> Particularly, I have a vector stats that I am incrementing:
>>> myStat[tid]++.
>>>
>>> But, for debugging purposes, I would like to print out the stats value:
>>> printf("Stat value is %i", myStat[tid])
>>> but that will cause compiler errors with the Stat type.
>>>
>>> I've seen in other places in M5 where there is one "counting" variable
>>> and there is a separate "statistic" variable, but I'm just wondering if I
>>> can get away with just using one stat variable and reading the value from
>>> that directly.
>>>
>>> (This may be a old topic so excuse me for rehashing it again if it is.)
>>>
>>> --
>>> - Korey
>>>
>>> _______________________________________________
>>> m5-dev mailing list
>>> [email protected]
>>> http://m5sim.org/mailman/listinfo/m5-dev
>>>
>>
>>
>> _______________________________________________
>> m5-dev mailing list
>> [email protected]
>> http://m5sim.org/mailman/listinfo/m5-dev
>>
>
>
>
> --
> - Korey
>
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to