> On 2012-01-04 15:57:35, Nathan Binkert wrote: > > src/python/m5/SimObject.py, line 900 > > <http://reviews.m5sim.org/r/930/diff/1/?file=16302#file16302line900> > > > > This seems to be a massive repeat of the print_ini code. Could you > > build the ini_file code on top of this code? > > > > Also, the name ini_str is pretty outdated, is it still necessary? does > > str() work? We could also separate __str__ and __repr__ (though that could > > certainly be a separate change. > > Steve Reinhardt wrote: > It's different enough from print_ini that it seems to me it might be hard > to fold these together. One thing that would help is if we added a > sorted_keys() method to multidict, then all the code like: > > child_names = self._children.keys() > child_names.sort() > for n in child_names: > > could be changed to: > > for n in _children.sorted_keys(): > > both here and in print_ini (and probably elsewhere). > > As far as ini_str(), you can look in params.py to see where that differs > from str(); since the default for ini_str() is str(), it's only overridden > when different, with one exception :). > > Nathan Binkert wrote: > for n in sorted(self._children.keys()) not good enough? > > Also, I agree that ini_str and str can be different, but I don't see why > that is useful. We can always just use __str__ instead of ini_str and not > care. ini_str only needed to be special when we were parsing ini files to > suck in the configuration. Now, we can be much more flexible with how we > output them. If we need different representations, then we can use __repr__ > and __str__ for them.
Heh, good point, guess I'm still stuck in pre-2.4 mode. So we should do that. For ports (or specifically PortRefs), ini_str() print's the peer's name, while __str__ prints the name of the port itself. Probably a lot of the other overrides could be changed to just overriding __str__, but ports are the only one that Ali uses. Though ports are different from params, so we could just call it peer_name() or something like that. - Steve ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviews.m5sim.org/r/930/#review1823 ----------------------------------------------------------- On 2011-12-16 13:35:00, Ali Saidi wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://reviews.m5sim.org/r/930/ > ----------------------------------------------------------- > > (Updated 2011-12-16 13:35:00) > > > Review request for Default. > > > Summary > ------- > > config: support outputing a pickle of the configuration tree > > This is useful as an input potential input to power models and visualization > tools. > > > Diffs > ----- > > src/python/m5/SimObject.py ca98021c3f96 > src/python/m5/main.py ca98021c3f96 > src/python/m5/params.py ca98021c3f96 > src/python/m5/simulate.py ca98021c3f96 > > Diff: http://reviews.m5sim.org/r/930/diff > > > Testing > ------- > > > Thanks, > > Ali > > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
