I again want to point out that if you're interested in a couple of statistics every cycle, this is not the optimal way to do it. Not only will you end up with an extremely large text file, you'll also slow down the simulation maybe 10x or more to dump stats in this manner. What you probably want to do is just open up a file (with simout.create()) and write the data that interests you every cycle.

Ali

On May 8, 2008, at 11:37 AM, jerry lrui wrote:

Hi, Korey

Thank you so much for your help. I really appreciate it.

Jerry

On 5/8/08, Korey Sewell <[EMAIL PROTECTED]> wrote: OK,
so it's a few simple things you can do to dump stats at a certain
interval. I adopted this from the checkpoint (?) dumping code and
implemented it in the SimpleCPU.

(1) src/simple/base.cc: In the constructor add these lines:
     Tick when = ticks(p->start_stats);
     Tick repeat = ticks(p->sample_period);

printf("Stats starting @ %i w/period of %i.\n", (int) when, (int) repeat);

     Stats::StatEvent(true, true, when, repeat);

You need to substitute the right values for the when/repeat variables.

*NOTE: DEPENDING ON YOUR CONFIG 1 cycle might equal 500 ticks. There
is a email about a few weeks back that describes how to make a 1:1
correlation between cycles and ticks.

Make sure these header files available:
#include "sim/stats.hh"
#include "sim/system.hh"
#include "sim/stat_control.hh"


(2) I print out headers so that I know that there stats for each
sample. In src/base/stats/text.cc add lines to the Text::output()
function to mark what stat sample you are on. My function looks like
this:
Text::output()
{
   using namespace Database;

   static int sample = 0;

   ccprintf(*stream, "\n---------- Begin Simulation Statistics :
Sample %i ----------\n", sample);
   stat_list_t::const_iterator i, end = stats().end();
   for (i = stats().begin(); i != end; ++i)
       (*i)->visit(*this);
   ccprintf(*stream, "\n---------- End Simulation Statistics : Sample
%i  ----------\n", sample++);
   stream->flush();
}



Anyway, I hope that helps what you are doing.

On Tue, May 6, 2008 at 12:53 AM, jerry lrui <[EMAIL PROTECTED]> wrote: > Thanks. you are right. it's impractical to dump all these stats every cycle. > According to your suggestion, I'll further look through the codes to find
> correct way to handle these stats i needed. Thanks again.
>
>
> Jerry
>
> On 5/6/08, Korey Sewell <[EMAIL PROTECTED]> wrote:
>>
>> I agree with Lisa that you dont want 50 million files...
>>
>> I'll try to churn out a patch for you tomorrow...  The patch I will
>> generate keeps dumping to the same file so what's going to happen if
>> you go per-cycle is you have a REALLY BIG stat file.
>>
>> I used the patch to dump I think a max of like10,000 samples and that >> was pretty ridiculous given the # of cache stats that are turned out. >> I had to go through the cache and change the majority of stats to not >> even show if they were a value of ZERO in order to help condense the
>> file size.
>>
>> Because I did so much hacking, it makes a tougher patch (this was
>> pre-mercurial queue days for me)... sorry about that!
>>
>> Actually, it might be easy to just copy/paste code to you.... i think
>> it's just a few lines...
>>
>> On Mon, May 5, 2008 at 8:47 PM, Lisa Hsu <[EMAIL PROTECTED]> wrote:
>> > i don't think you want that.  dumping stats, as geoff and i have
>> > mentioned,
>> > will dump EVERY stat. if your simulation is even 50,000 cycles, you'll
>> > have
>> > 50,000 files to sift through, most of which it sounds like you don't
>> > care
>> > about.  and i'm sure your sims are way longer than that.
>> >
>> > if i were you, i'd look through the tree to find out exactly how a Stat
>> > type
>> > gets evaluated and then sent to the m5 stats file, and then do that
>> > yourself
>> > on every tick to send to your own personal output file. if i recall >> > correctly, a Stat type isn't evaluated until it is dumped, so you have
>> > to
>> > find out how to get it to evaluate for your own purposes, set up your
>> > own
>> > output file, and have it dump into there. i don't remember where it is
>> > or
>> > anything, but i imagine if you follow the chain of calls from dumpstats
>> > you'll find your answer.
>> >
>> > lisa
>> >
>> >
>> >
>> > On Mon, May 5, 2008 at 9:09 PM, jerry lrui <[EMAIL PROTECTED]> wrote:
>> > >
>> > > Thanks! I'm using BaseCPU, too.
>> > >
>> > >
>> > >
>> > >
>> > > On 5/6/08, Korey Sewell <[EMAIL PROTECTED]> wrote:
>> > > > I have something in my tree that lets me dump stats every X cycles. >> > > > That's probably what you are looking for. It's similar to dumping >> > > > checkpoints at a certain interval, but instead I dump the stats...
>> > > >
>> > > > I think I implemented it in BaseCPU... what CPU are you using this
>> > > > for?
>> > > >
>> > > > I'll look into  what I got later at the next opportunity...
>> > > >
>> > > > On Mon, May 5, 2008 at 9:09 AM, jerry lrui <[EMAIL PROTECTED] >
>> > > > wrote:
>> > > > > Is there a better way to get these stats after very cycle, if I
>> > > > > can
>> > not dump
>> > > > > all these stats? I only need few stats such as cache hits to
>> > > > > analyze
>> > the
>> > > > > runtime characteristic. Thanks.
>> > > > >
>> > > > > Jerry
>> > > > >
>> > > > >
>> > > > >
>> > > > > On 5/5/08, Geoffrey Blake <[EMAIL PROTECTED]> wrote:
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > If you just need aggregate stats at the end of the simulation
>> > > > > > run,
>> > such as
>> > > > > number of dcache.ReadReq_hits, M5 already does this. When the
>> > simulation
>> > > > > finishes, it dumps the file: m5stats.txt to your current working
>> > directory
>> > > > > with everything added up for you.
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Dumping stats every cycle can easily lead to multi gigabyte
>> > > > > > files
>> > that
>> > > > > will be very hard to work with and store.
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Geoff
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > From: [EMAIL PROTECTED]
>> > > > > > [mailto:[EMAIL PROTECTED]
>> > On
>> > > > > Behalf Of jerry lrui
>> > > > > > Sent: Monday, May 05, 2008 11:17 AM
>> > > > > > To: M5 users mailing list
>> > > > > > Subject: Re: [m5-users] How to dump m5stats per cycle?
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Hi, Lisa
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > I only need few stats to analyze the runtime characteristics of
>> > > > > > an
>> > > > > application. For example the number of dcache.ReadReq_hits,
>> > > > > icache.ReadReq_hits, etc. I added these codes
>> > > > > "Stats::StatEvent(true,false);" in function simulate(Tick
>> > > > > num_cycles)
>> > > > > located simulate.cc. But I didn't get the result I wanted. Could
>> > > > > you
>> > tell me
>> > > > > what is the correct way to get thest stats? Thank you very much!
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Jerry
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On 5/5/08, Lisa Hsu <[EMAIL PROTECTED]> wrote:
>> > > > > >
>> > > > > > doing this will result in millions of large files full of stat
>> > > > > > text
>> > - what
>> > > > > is it that you want this for?
>> > > > > >
>> > > > > > lisa
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On Sat, May 3, 2008 at 11:39 PM, jerry lrui
>> > > > > > <[EMAIL PROTECTED]>
>> > wrote:
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > I want to dump m5stats after per cycle. I've looked up the code.
>> > Maybe I
>> > > > > can add some codes in function simulate(Tick num_cycles) located
>> > > > > simulate.cc. Fox example, add a StatEvent like
>> > > > > "Stats::StatEvent(true,false);" in this function? But I'm not sure
>> > > > > how
>> > to do
>> > > > > it correctly. I'm using m5sim 2.0b5 in SE model. What is the
>> > > > > correct
>> > way to
>> > > > > get this information? Thanks!
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Jerry
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > _______________________________________________
>> > > > > > 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
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > No virus found in this incoming message.
>> > > > > > Checked by AVG.
>> > > > > > Version: 7.5.524 / Virus Database: 269.23.8/1413 - Release Date:
>> > 5/3/2008
>> > > > > 11:22 AM
>> > > > > >
>> > > > > >
>> > > > > > No virus found in this outgoing message.
>> > > > > > Checked by AVG.
>> > > > > > Version: 7.5.524 / Virus Database: 269.23.8/1413 - Release Date:
>> > 5/3/2008
>> > > > > 11:22 AM
>> > > > > >
>> > > > > > _______________________________________________
>> > > > > > 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
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > ----------
>> > > > Korey L Sewell
>> > > > Graduate Student - PhD Candidate
>> > > > Computer Science & Engineering
>> > > > University of Michigan
>> > > > _______________________________________________
>> > > > 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
>> > >
>> >
>> >
>> > _______________________________________________
>> >  m5-users mailing list
>> >  [email protected]
>> >  http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
>> >
>>
>>
>>
>> --
>> ----------
>> Korey L Sewell
>> Graduate Student - PhD Candidate
>> Computer Science & Engineering
>> University of Michigan
>> _______________________________________________
>> 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
>



--
----------
Korey L Sewell
Graduate Student - PhD Candidate
Computer Science & Engineering
University of Michigan
_______________________________________________
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

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

Reply via email to