Ruby: Convert to M5 Stats
Review Request #704 - Created May 16, 2011 and submitted
| Information | |
|---|---|
| Derek Hower | |
| gem5 | |
| Reviewers | |
| Default | |
| beckmann, ksewell, nate | |
This patch contains changes to convert Ruby's stat handling to the M5-style Stat class. The ultimate goal is to remove Profiler entirely, though this patch only represents a (significant) step towards that goal. Some stats remain in the Profiler, notably those that do not have an obvious object to hold them (like Address Profiler) or those that I'm not sure what they do (e.g., *wCC*). Also, this patch does not contain a Garnet stats conversion (though the simple network is converted).
Posted (May 17, 2011, 5:13 a.m.)
Overall, this is a good start. There are a couple of recurring themes in my review. 1) Objects should have a name() function (this is automatic for SimObjects) and we should use that to generate the stat name simply by doing something like this: ".name(name() + ".my_stat"). 2) Stats should be opaque and you shouldn't try to grab the value of them. If you need the value, you should create another variable. This is because stats values can be arbitrarily screwed with by the user. 3) Stats shouldn't be within a std::vector and they shouldn't be dynamically allocated. We should figure out how to use arrays or the various Vector stats to do what we need. 4) printStats and clearStats functions should go away.
-
src/mem/ruby/network/simple/Throttle.hh (Diff revision 1) -
I know that this is old code, but this code will leak memory. Can you plan to fix it?
-
src/mem/ruby/network/simple/Throttle.hh (Diff revision 1) -
This really shouldn't work this way. You should use Stat::Vector2d.
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
Please sort your #includes. The style hook should have complained about (and offered to fix) this. Do you not have it installed correctly. Also, shouldn't this just be "base/statistics.hh"
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
Stats really should not be dynamically allocated.
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
can I suggest csprintf() instead of stringstream? Also, SimObjects generally have a name() parameter and we generally name stats like this: my_stat .name(name() + ".my_stat") .desc(...)
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
can I suggest csprintf() instead of stringstream?
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
It's not necessary to initialize stats to zero. This is automatic.
-
src/mem/ruby/network/simple/Throttle.cc (Diff revision 1) -
Just to check, is this function actually used? Because stats can be reset at any time and updated in strange ways, we treat stats as opaque objects and never try to extract the current value. If link utilization is important, we should have a separate variable for this.
-
src/mem/ruby/profiler/AddressProfiler.cc (Diff revision 1) -
.name should really have name() as part of the name. Is the AddressProfiler not a SimObject() ?
-
src/mem/ruby/profiler/AddressProfiler.cc (Diff revision 1) -
Probably should be removed.
-
src/mem/ruby/profiler/AddressProfiler.cc (Diff revision 1) -
The statistics package has its own mechanism for clearing statistics. I think that you should hook into that and not call clearStats yourself.
-
src/mem/ruby/profiler/CacheProfiler.hh (Diff revision 1) -
Does a Stats::Vector make more sense here?
-
src/mem/ruby/profiler/CacheProfiler.cc (Diff revision 1) -
We should really figure out how to have the profilers have a name() parameter. If we do it this way, we'll never be able to instantiate two separate systems that have a ruby memory hierarchy.
-
src/mem/ruby/profiler/CacheProfiler.cc (Diff revision 1) -
Shouldn't this whole function go away?
-
src/mem/ruby/profiler/MemCntrlProfiler.cc (Diff revision 1) -
Need to use name()
-
src/mem/ruby/profiler/MemCntrlProfiler.cc (Diff revision 1) -
This should go away.
-
src/mem/ruby/profiler/Profiler.hh (Diff revision 1) -
regStats() is the proper name.
-
src/mem/ruby/profiler/Profiler.hh (Diff revision 1) -
Again, we really shouldn't dynamically allocate statistics. What exactly is this stat all about?
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
Please delete code instead of commenting it out. In fact, this whole function should probably be deleted.
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
How did you pick this magic number? Can we at least make it a constant that is defined in a header file with an explanation as to how it was chosen?
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
More magic numbers.
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
This should probably be deleted.
-
src/mem/ruby/system/CacheMemory.hh (Diff revision 1) -
If the profiler is a SimObject, regStats will automatically get called.
-
src/mem/ruby/system/Sequencer.hh (Diff revision 1) -
Hmmm. More vectors of histograms. Can we make this an array instead?
-
src/mem/ruby/system/Sequencer.cc (Diff revision 1) -
more magic numbers.
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
can we use name() ?
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
Can we avoid the dynamic allocation here?
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
Is this used outside of stats?
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
is this used outside of stats?
Posted (May 30, 2011, 3:56 p.m.)
I apologize it took me a while to review this code. Overall, my major concern is that the patch removes some of the most valuable stats in Ruby. Specific comments below:
-
src/mem/ruby/profiler/Profiler.hh (Diff revision 1) -
Please, do not delete these stats. These stats are very useful in discovering performance bottlenecks in protocols. As far as those protocols checked into the tree, I believe the hammer protocol uses most, if not all of these stats. The term "wCC" stands for "with Cache Coherence" and signifies those requests that require cache-to-cache transfers.
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
This code was used to monitor cache port and bank contention when Ruby modeled those resources. I'm pretty sure that no current protocols enable the bank resource feature, but if the port resource is approximated by the number of transitions per cycle. It is possible for that port resource to cause problems and this stat would catch it. Thus I would like to keep these stats.
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
Yes, Korey your last observation is exactly why those histograms are initialized with a fixed bin size. It makes comparisons between different runs possible. I assume you can do the same thing with M5 stats, correct?
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
Did you move this logic somewhere else, or did you determine that none of the checked in protocols use this function?
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
Please keep this funcitonality. It is very useful to understand the behavior of the system.
Posted (May 30, 2011, 4:14 p.m.)
-
src/mem/ruby/profiler/Profiler.hh (Diff revision 1) -
In my recent Ruby experiences, I agree with Brad to keep most if not all of these. Can we just convert these to M5 with the same names? Subsequent changesets could consider if somethign is unnnecessary. Also "missLatency" is really "accessLatency" as previously discussed. Can we change that?
-
src/mem/ruby/profiler/Profiler.cc (Diff revision 1) -
We are going to call this access latency eventually right? Might as well change it now...
