> On 2012-01-04 15:57:35, Nathan Binkert wrote: > > Sorry to be pedantic. I just hate duplicated code. :) It's not so bad > > that I require the change and I don't need to review it again if you choose > > to make the changes I suggest. > > > > Finally, why do you want the pickle format? I ask because json might be > > more generally useful. basically replace pickle.dump with json.dump and > > then a lot more stuff could suck in the json. (Someone could build a > > pretty javascript thing with canvas for displaying the configuration :)
I looked at it's actually pretty hard to get these into one change. In theory config.ini could be created from it, so I'll think about that but no promises. json doesn't work because right now there are types in the tree that aren't json compatible (E.g. timestruct for rtc devices). > 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. > > Steve Reinhardt wrote: > 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. > > Nathan Binkert wrote: > I guess I'd like to see this, but if ali doesn't want to do it now, I'd > understand. It is a separate problem. I don't think I'm going to do the ini_str bit at this point. I'll clean up the storted(...) though. > On 2012-01-04 15:57:35, Nathan Binkert wrote: > > src/python/m5/SimObject.py, line 933 > > <http://reviews.m5sim.org/r/930/diff/1/?file=16302#file16302line933> > > > > remove newline :P k > On 2012-01-04 15:57:35, Nathan Binkert wrote: > > src/python/m5/main.py, line 90 > > <http://reviews.m5sim.org/r/930/diff/1/?file=16303#file16303line90> > > > > how about --pickle-config or --pickle-conf. Not sure if people know > > what pkl would mean > > Steve Reinhardt wrote: > agreed k - Ali ----------------------------------------------------------- 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
