stats: Optimise SQL stats output to improve speed and file size
Review Request #1644 - Created Jan. 15, 2013 and updated
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9497:9835f2157f30 --------------------------- stats: Optimise SQL stats output to improve speed and file size This patch optimises the SQL stats. It does this by only writing to the stats database if and when the stat is non-zero and non-NaN and the corresponding flag is set. It also removes unnecessary calls to getattr and hasattr by accessing the values directly. Finally, it only calculates the total for a formula if necessary
Issue Summary
6
4
2
0
| Description | From | Last Updated | Status |
|---|---|---|---|
| This seems like it belongs in a different patch. | Nathan Binkert | Jan. 25, 2013, 8:07 a.m. | Open |
| seems to me that this sort of thing belongs in the stat object, not here. Like a stat.getValue function. I ... | Nathan Binkert | Jan. 25, 2013, 8:07 a.m. | Open |
| This seems like a pretty bad place to put this code. Why does statContainer calculate the value instead of the ... | Nathan Binkert | Jan. 25, 2013, 8:07 a.m. | Open |
| Seems like you should be looping over the values and recording if they're all zero, and if there are any ... | Nathan Binkert | Jan. 25, 2013, 8:07 a.m. | Open |
Posted (Jan. 25, 2013, 1:50 a.m.)
-
src/python/m5/stats/__init__.py (Diff revision 1) -
This is really strange. You first added the 'name' argument in a separate patch, and now you remove it here.
Posted (Jan. 25, 2013, 8:07 a.m.)
I understand the desire to avoid extra getattr lookups, but the way you're going about it seems rather confusing (and I believe could be done just as efficiently in a more clear manner). Also, it's hard for me to suggest improvements because the optimizations are cluttered with extra code and spread across diffs.
-
src/python/m5/stats/__init__.py (Diff revision 1) -
This seems like a bugfix that belongs in a different patch
-
src/python/m5/stats/sql.py (Diff revision 1) -
This seems like it belongs in a different patch.
-
src/python/m5/stats/sql.py (Diff revision 1) -
seems to me that this sort of thing belongs in the stat object, not here. Like a stat.getValue function. I assume that the info is not available, so you can't use __getattr__ and it must be a function. That's fine, but this seems like the wrong place to do this.
-
src/python/m5/stats/sql.py (Diff revision 1) -
This seems like a pretty bad place to put this code. Why does statContainer calculate the value instead of the stat itself? Is it because the container has the info? If so, it seems like you should have the container calculate the value instead of doing it here.
-
src/python/m5/stats/sql.py (Diff revision 1) -
Seems like you should be looping over the values and recording if they're all zero, and if there are any NaN values instead of building an intermediate list (which is comparatively expensive). You can also exit early. hasNonNan = False hasNonZero = False for x in theValue: if not isnan(x): hasNonNan = True if hasNonZero: break if x: hasNonZero = True if hasNonNan: break
