summaryrefslogtreecommitdiff
path: root/util/stats
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-06-10 13:08:43 -0400
committerNathan Binkert <binkertn@umich.edu>2006-06-10 13:08:43 -0400
commit7af93dbdf6c86a915b99da1688f51dc12e7aafff (patch)
tree11f7f8cd446fda9628dd380acf8f65db1f7869cd /util/stats
parentf1fab2a4469d6cb2e55ebac15da02f8c1fcb7055 (diff)
downloadgem5-7af93dbdf6c86a915b99da1688f51dc12e7aafff.tar.xz
Remove all binning stuff
--HG-- extra : convert_revision : 6da2b3b0b6c2824f2064d42670fd8383edb7c718
Diffstat (limited to 'util/stats')
-rw-r--r--util/stats/db.py97
-rw-r--r--util/stats/dbinit.py35
-rw-r--r--util/stats/info.py5
-rw-r--r--util/stats/output.py22
-rwxr-xr-xutil/stats/stats.py34
5 files changed, 22 insertions, 171 deletions
diff --git a/util/stats/db.py b/util/stats/db.py
index c0e7796eb..9d876e97f 100644
--- a/util/stats/db.py
+++ b/util/stats/db.py
@@ -135,10 +135,6 @@ class Database(object):
self.allRunIds = {}
self.allRunNames = {}
- self.allBins = []
- self.allBinIds = {}
- self.allBinNames = {}
-
self.allFormulas = {}
self.stattop = {}
@@ -147,7 +143,6 @@ class Database(object):
self.mode = 'sum';
self.runs = None
- self.bins = None
self.ticks = None
self.method = 'sum'
self._method = type(self).sum
@@ -218,11 +213,6 @@ class Database(object):
self.allRunIds[run.run] = run
self.allRunNames[run.name] = run
- self.query('select * from bins')
- for id,name in self.cursor.fetchall():
- self.allBinIds[int(id)] = name
- self.allBinNames[name] = int(id)
-
self.query('select sd_stat,sd_x,sd_y,sd_name,sd_descr from subdata')
for result in self.cursor.fetchall():
subdata = SubData(result)
@@ -245,18 +235,6 @@ class Database(object):
self.allStatIds[stat.stat] = stat
self.allStatNames[stat.name] = stat
- # Name: listbins
- # Desc: Prints all bins matching regex argument, if no argument
- # is given all bins are returned
- def listBins(self, regex='.*'):
- print '%-50s %-10s' % ('bin name', 'id')
- print '-' * 61
- names = self.allBinNames.keys()
- names.sort()
- for name in names:
- id = self.allBinNames[name]
- print '%-50s %-10d' % (name, id)
-
# Name: listruns
# Desc: Prints all runs matching a given user, if no argument
# is given all runs are returned
@@ -360,39 +338,10 @@ class Database(object):
ret.append(stat)
return ret
- def getBin(self, bins):
- if type(bins) is not list:
- bins = [ bins ]
-
- ret = []
- for bin in bins:
- if type(bin) is int:
- ret.append(bin)
- elif type(bin) is str:
- ret.append(self.allBinNames[bin])
- else:
- for name,id in self.allBinNames.items():
- if bin.match(name):
- ret.append(id)
-
- return ret
-
- def getNotBin(self, bin):
- map = {}
- for bin in getBin(bin):
- map[bin] = 1
-
- ret = []
- for bin in self.allBinIds.keys():
- if not map.has_key(bin):
- ret.append(bin)
-
- return ret
-
#########################################
# get the data
#
- def inner(self, op, stat, bins, ticks, group=False):
+ def query(self, op, stat, ticks, group=False):
sql = 'select '
sql += 'dt_stat as stat, '
sql += 'dt_run as run, '
@@ -414,10 +363,6 @@ class Database(object):
val = ' or '.join([ 'dt_run=%d' % r for r in self.runs ])
sql += ' and (%s)' % val
- if bins != None and len(bins):
- val = ' or '.join([ 'dt_bin=%d' % b for b in bins ])
- sql += ' and (%s)' % val
-
if ticks != None and len(ticks):
val = ' or '.join([ 'dt_tick=%d' % s for s in ticks ])
sql += ' and (%s)' % val
@@ -427,35 +372,21 @@ class Database(object):
sql += ',dt_tick'
return sql
- def outer(self, op_out, op_in, stat, bins, ticks):
- sql = self.inner(op_in, stat, bins, ticks, True)
- sql = 'select stat,run,x,y,%s(data) from (%s) as tb ' % (op_out, sql)
- sql += 'group by stat,run,x,y'
- return sql
-
# Name: sum
- # Desc: given a run, a stat and an array of samples and bins,
- # sum all the bins and then get the standard deviation of the
- # samples for non-binned runs. This will just return the average
- # of samples, however a bin array still must be passed
- def sum(self, stat, bins, ticks):
- return self.inner('sum', stat, bins, ticks)
+ # Desc: given a run, a stat and an array of samples, total the samples
+ def sum(self, *args, **kwargs):
+ return self.query('sum', *args, **kwargs)
# Name: avg
- # Desc: given a run, a stat and an array of samples and bins,
- # sum all the bins and then average the samples for non-binned
- # runs this will just return the average of samples, however
- # a bin array still must be passed
- def avg(self, stat, bins, ticks):
- return self.outer('avg', 'sum', stat, bins, ticks)
+ # Desc: given a run, a stat and an array of samples, average the samples
+ def avg(self, stat, ticks):
+ return self.query('avg', *args, **kwargs)
# Name: stdev
- # Desc: given a run, a stat and an array of samples and bins,
- # sum all the bins and then get the standard deviation of the
- # samples for non-binned runs. This will just return the average
- # of samples, however a bin array still must be passed
- def stdev(self, stat, bins, ticks):
- return self.outer('stddev', 'sum', stat, bins, ticks)
+ # Desc: given a run, a stat and an array of samples, get the standard
+ # deviation
+ def stdev(self, stat, ticks):
+ return self.query('stddev', *args, **kwargs)
def __setattr__(self, attr, value):
super(Database, self).__setattr__(attr, value)
@@ -471,12 +402,10 @@ class Database(object):
else:
raise AttributeError, "can only set get to: sum | avg | stdev"
- def data(self, stat, bins=None, ticks=None):
- if bins is None:
- bins = self.bins
+ def data(self, stat, ticks=None):
if ticks is None:
ticks = self.ticks
- sql = self._method(self, stat, bins, ticks)
+ sql = self._method(self, stat, ticks)
self.query(sql)
runs = {}
diff --git a/util/stats/dbinit.py b/util/stats/dbinit.py
index ffae88cdb..203582478 100644
--- a/util/stats/dbinit.py
+++ b/util/stats/dbinit.py
@@ -98,28 +98,6 @@ class MyDB(object):
) TYPE=InnoDB''')
#
- # We keep the bin names separate so that the data table doesn't get
- # huge since bin names are frequently repeated.
- #
- # COLUMNS:
- # 'id' is the unique bin identifer.
- # 'name' is the string name for the bin.
- #
- # INDEXES:
- # 'bin' is indexed to get the name of a bin when data is retrieved
- # via the data table.
- # 'name' is indexed to get the bin id for a named bin when you want
- # to search the data table based on a specific bin.
- #
- self.query('''
- CREATE TABLE bins(
- bn_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
- bn_name VARCHAR(255) NOT NULL,
- PRIMARY KEY(bn_id),
- UNIQUE (bn_name)
- ) TYPE=InnoDB''')
-
- #
# The stat table gives us all of the data for a particular stat.
#
# COLUMNS:
@@ -220,14 +198,12 @@ class MyDB(object):
# 'run' is the run that the data was generated from. Details up in
# the run table
# 'tick' is a timestamp generated by the simulator.
- # 'bin' is the name of the bin that the data was generated in, if
- # any.
# 'data' is the actual stat value.
#
# INDEXES:
# 'stat' is indexed so that a user can find all of the data for a
# particular stat. It is not unique, because that specific stat
- # can be found in many runs, bins, and samples, in addition to
+ # can be found in many runs and samples, in addition to
# having entries for the mulidimensional cases.
# 'run' is indexed to allow a user to remove all of the data for a
# particular execution run. It can also be used to allow the
@@ -240,11 +216,10 @@ class MyDB(object):
dt_y SMALLINT NOT NULL,
dt_run SMALLINT UNSIGNED NOT NULL,
dt_tick BIGINT UNSIGNED NOT NULL,
- dt_bin SMALLINT UNSIGNED NOT NULL,
dt_data DOUBLE NOT NULL,
INDEX (dt_stat),
INDEX (dt_run),
- UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin)
+ UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick)
) TYPE=InnoDB;''')
#
@@ -396,12 +371,6 @@ class MyDB(object):
WHERE dt_stat IS NULL''')
self.query('''
- DELETE bins
- FROM bins
- LEFT JOIN data ON bn_id=dt_bin
- WHERE dt_bin IS NULL''')
-
- self.query('''
DELETE events
FROM events
LEFT JOIN runs ON ev_run=rn_id
diff --git a/util/stats/info.py b/util/stats/info.py
index 4cb55f564..c1e18bb3f 100644
--- a/util/stats/info.py
+++ b/util/stats/info.py
@@ -174,7 +174,7 @@ def WrapValue(value):
class Statistic(object):
def __getattr__(self, attr):
if attr in ('data', 'x', 'y'):
- result = self.source.data(self, self.bins, self.ticks)
+ result = self.source.data(self, self.ticks)
self.data = result.data
self.x = result.x
self.y = result.y
@@ -183,7 +183,7 @@ class Statistic(object):
def __setattr__(self, attr, value):
if attr == 'stat':
raise AttributeError, '%s is read only' % stat
- if attr in ('source', 'bins', 'ticks'):
+ if attr in ('source', 'ticks'):
if getattr(self, attr) != value:
if hasattr(self, 'data'):
delattr(self, 'data')
@@ -759,7 +759,6 @@ def NewStat(source, data):
stat = Formula()
stat.__dict__['source'] = source
- stat.__dict__['bins'] = None
stat.__dict__['ticks'] = None
stat.__dict__.update(data.__dict__)
diff --git a/util/stats/output.py b/util/stats/output.py
index abfb8d901..03c100edc 100644
--- a/util/stats/output.py
+++ b/util/stats/output.py
@@ -29,24 +29,16 @@
from chart import ChartOptions
class StatOutput(ChartOptions):
- def __init__(self, jobfile, info, stat=None, binstats=None):
+ def __init__(self, jobfile, info, stat=None):
super(StatOutput, self).__init__()
self.jobfile = jobfile
self.stat = stat
- self.binstats = None
self.invert = False
self.info = info
- def printdata(self, name, bin = None, printmode = 'G'):
+ def display(self, name, printmode = 'G'):
import info
- if bin:
- print '%s %s stats' % (name, bin)
-
- if self.binstats:
- for stat in self.binstats:
- stat.bins = bin
-
if printmode == 'G':
valformat = '%g'
elif printmode != 'F' and value > 1e6:
@@ -70,16 +62,6 @@ class StatOutput(ChartOptions):
valstring = ', '.join([ valformat % val for val in value ])
print '%-50s %s' % (job.name + ':', valstring)
- def display(self, name, binned = False, printmode = 'G'):
- if binned and self.binstats:
- self.printdata(name, 'kernel', printmode)
- self.printdata(name, 'idle', printmode)
- self.printdata(name, 'user', printmode)
- self.printdata(name, 'interrupt', printmode)
-
- print '%s total stats' % name
- self.printdata(name, printmode=printmode)
-
def graph(self, name, graphdir, proxy=None):
from os.path import expanduser, isdir, join as joinpath
from barchart import BarChart
diff --git a/util/stats/stats.py b/util/stats/stats.py
index 08281287f..40ef8ac0f 100755
--- a/util/stats/stats.py
+++ b/util/stats/stats.py
@@ -37,7 +37,6 @@ Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p]
commands extra parameters description
----------- ------------------ ---------------------------------------
- bins [regex] List bins (only matching regex)
formula <formula> Evaluated formula specified
formulas [regex] List formulas (only matching regex)
runs none List all runs in database
@@ -140,16 +139,6 @@ def commands(options, command, args):
return
- if command == 'bins':
- if len(args) == 0:
- source.listBins()
- elif len(args) == 1:
- source.listBins(args[0])
- else:
- raise CommandException
-
- return
-
if command == 'formulas':
if len(args) == 0:
source.listFormulas()
@@ -279,7 +268,7 @@ def commands(options, command, args):
if options.graph:
output.graph(stat.name, options.graphdir)
else:
- output.display(stat.name, options.binned, options.printmode)
+ output.display(stat.name, options.printmode)
return
@@ -299,22 +288,10 @@ def commands(options, command, args):
if options.graph:
output.graph(command, options.graphdir, proxy)
else:
- output.display(command, options.binned, options.printmode)
-
- if command == 'usertime':
- import copy
- user = copy.copy(system.run0.numCycles)
- user.bins = 'user'
-
- output.stat = user / system.run0.numCycles
- output.ylabel = 'User Fraction'
-
- display()
- return
+ output.display(command, options.printmode)
if command == 'ticks':
output.stat = system.run0.numCycles
- output.binstats = [ system.run0.numCycles ]
display()
return
@@ -401,7 +378,6 @@ def commands(options, command, args):
if command == 'mpkb':
output.stat = misses / (bytes / 1024)
- output.binstats = [ misses ]
output.ylabel = 'Misses / KB'
display()
return
@@ -409,7 +385,6 @@ def commands(options, command, args):
if command == 'ipkb':
interrupts = system.run0.kern.faults[4]
output.stat = interrupts / kbytes
- output.binstats = [ interrupts ]
output.ylabel = 'Interrupts / KB'
display()
return
@@ -446,7 +421,6 @@ if __name__ == '__main__':
options.runs = None
options.system = 'client'
options.method = None
- options.binned = False
options.graph = False
options.ticks = False
options.printmode = 'G'
@@ -454,10 +428,8 @@ if __name__ == '__main__':
options.jobfile = None
options.all = False
- opts, args = getopts(sys.argv[1:], '-BEFJad:g:h:j:m:pr:s:u:T:')
+ opts, args = getopts(sys.argv[1:], '-EFJad:g:h:j:m:pr:s:u:T:')
for o,a in opts:
- if o == '-B':
- options.binned = True
if o == '-E':
options.printmode = 'E'
if o == '-F':