I described a fairly generic extension. To call your own method from
System::printStats(), you can get a pointer to your object directly and just
call any method. Follow g_system_ptr to the Chip ptr, and then follow that
to your own object pointer.
--Mike
> -----Original Message-----
> From: gems-users-bounces@xxxxxxxxxxx [mailto:gems-users-
> bounces@xxxxxxxxxxx] On Behalf Of Mike Marty
> Sent: Tuesday, September 13, 2005 8:29 AM
> To: 'Gems Users'
> Subject: RE: [Gems-users] Obtaining statistics from a Demo Prefetcher
> likemodel
>
> The easiest way is to add your statistics to ruby/profiler/Profiler.[Ch]
> by
> adding variables and functions that are called by your class object.
>
> However there is only a single, system-wide Profiler object. If you
> wanted
> per-object stats, it would take some bit of work to track this in the
> single
> Profiler instance.
>
> If you wanted each object instance to collect its own stats internally and
> then dump then out when "ruby0.dump-stats" is performed, you can add a
> printStats() method to your class and change the framework to call this at
> the right time.
>
> When ruby0.dump-stats is invoked, System::printStats() is called in
> ruby/system/System.C. At the end of this method, it will call
> Chip::printStats(). Unfortunately this is a call to a static method, and
> assuming that your object is instantiated from a SLICC controller, this
> won't work. In the past, I've personally added a
> Chip::printDynamicStats()
> to my own tree which is a non-static method. In System::printStats(), I
> loop through all the Chip instances and call printDynamicStats() on it. I
> then modified SLICC so that Chip.[Ch] contains this printDynamicStats()
> method which, for any class instantiated within a SLICC controller that
> has
> the "dump_stats" flag set, it will call some method in your object. So
> when
> I instantiated an object in a SLICC controller, I did so like the
> following:
>
> MyObject myObject, dump_stats="yes";
>
> Essentially I extended SLICC to recognize this and it generated the
> appropriate code in Chip.C to call printStats() on this object when that
> flag existed.
>
> Unfortunately (for you), I never bothered checking in this code and
> eventually threw it away! But it should be easy to add yourself. Hacking
> SLICC is pretty easy. Just look at Chip.C-- it will tell you where in
> SLICC
> it was generated. You don't even need to modify the parser to recognize
> the
> dump_stats="yes" because it already builds up a list of these pairs which
> you can check the existence of.
>
> --Mike
>
>
>
> > -----Original Message-----
> > From: gems-users-bounces@xxxxxxxxxxx [mailto:gems-users-
> > bounces@xxxxxxxxxxx] On Behalf Of Sean Ryan Leventhal
> > Sent: Tuesday, September 13, 2005 7:26 AM
> > To: gems-users@xxxxxxxxxxx
> > Subject: [Gems-users] Obtaining statistics from a Demo Prefetcher like
> > model
> >
> > I have modified several protocols in a way similar to that in the Demo
> > Prefetcher example (including a class interface into slicc). How can I
> go
> > about placing statistics from this class into the ruby statistics
> output?
> > _______________________________________________
> > Gems-users mailing list
> > Gems-users@xxxxxxxxxxx
> > https://lists.cs.wisc.edu/mailman/listinfo/gems-users
>
>
> _______________________________________________
> Gems-users mailing list
> Gems-users@xxxxxxxxxxx
> https://lists.cs.wisc.edu/mailman/listinfo/gems-users
|