Hi Nate,

I can figure out how many stats I have up front, although that's what I was
trying to avoid doing by using a hash_map :-).

As for the unknown size, a Stats::Vector can grow dynamically, right (like
an STL vector)?  So I could either use the hash_map to index into a Vector
during simulation, as you suggested, or I could use the hash_map to record
the data, and just copy it into a Stats::Vector at the end of simulation (by
iterating through the hash_map and dynamically growing the Vector).  I'd
prefer the latter, if it's possible.  Is there a defined way to call a
function after the simulation ends but before the stats are dumped?

Thanks for the info,

  -Vilas

On 12/5/06, Nathan Binkert <[EMAIL PROTECTED]> wrote:

> you could maybe make your hash_map a hash *of* stats types (like
> hash_map<whatever, scalar stat>)...that way whenever you update the hash
> map, you're updating the stat and thus will get printed at the
end...would
> that fit in with what youe' doing?

Actually, you can't do that because stats can't be constructed after
regStats is called, and they can't be copied.  Do you know ahead of time
how many stats you will have?  If you do, you can create a vector and
initialized it up front, and use a hash_map to map from whatever to a
vector index or a pointer to the stat.  If you need a true mapping with an
unknown size up front, I'm afraid that there is currently nothing taht can
do that for you.  (Though I've long wanted to implement such a thing.)



    Nate
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to