summaryrefslogtreecommitdiff
path: root/util/stats/db.py
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-06-11 22:01:34 -0400
committerNathan Binkert <binkertn@umich.edu>2006-06-11 22:01:34 -0400
commit3c95f5958fd1a90cf83d85e1b24fb700c07bae91 (patch)
treeff0fba54297f66dd8e5ef7cbb46d09d8698ee08b /util/stats/db.py
parent4ab8e881edecd47ae3f2ba5fda345f7ff9788870 (diff)
parent7af93dbdf6c86a915b99da1688f51dc12e7aafff (diff)
downloadgem5-3c95f5958fd1a90cf83d85e1b24fb700c07bae91.tar.xz
Merge iceaxe.:/Volumes/work/research/m5/head
into iceaxe.:/Volumes/work/research/m5/merge src/cpu/simple/base.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/python/m5/objects/System.py: src/sim/system.cc: src/sim/system.hh: hand merge --HG-- rename : build/SConstruct => SConstruct rename : SConscript => src/SConscript rename : arch/alpha/freebsd/system.cc => src/arch/alpha/freebsd/system.cc rename : arch/alpha/linux/system.cc => src/arch/alpha/linux/system.cc rename : arch/alpha/linux/system.hh => src/arch/alpha/linux/system.hh rename : arch/alpha/system.cc => src/arch/alpha/system.cc rename : arch/alpha/tru64/system.cc => src/arch/alpha/tru64/system.cc rename : base/statistics.cc => src/base/statistics.cc rename : base/statistics.hh => src/base/statistics.hh rename : base/stats/mysql.cc => src/base/stats/mysql.cc rename : base/stats/mysql.hh => src/base/stats/mysql.hh rename : base/stats/statdb.cc => src/base/stats/statdb.cc rename : base/stats/statdb.hh => src/base/stats/statdb.hh rename : base/stats/text.cc => src/base/stats/text.cc rename : base/stats/text.hh => src/base/stats/text.hh rename : cpu/simple/cpu.cc => src/cpu/simple/base.cc rename : kern/kernel_stats.cc => src/kern/kernel_stats.cc rename : kern/kernel_stats.hh => src/kern/kernel_stats.hh rename : kern/system_events.cc => src/kern/system_events.cc rename : kern/system_events.hh => src/kern/system_events.hh rename : python/m5/objects/System.py => src/python/m5/objects/System.py rename : sim/system.cc => src/sim/system.cc rename : sim/system.hh => src/sim/system.hh rename : test/stattest.cc => src/unittest/stattest.cc extra : convert_revision : 4bb576a2bf5e32784efc48030bd776c6c7c29a7c
Diffstat (limited to 'util/stats/db.py')
-rw-r--r--util/stats/db.py97
1 files changed, 13 insertions, 84 deletions
diff --git a/util/stats/db.py b/util/stats/db.py
index 9ef51afe0..e1198d438 100644
--- a/util/stats/db.py
+++ b/util/stats/db.py
@@ -137,10 +137,6 @@ class Database(object):
self.allRunIds = {}
self.allRunNames = {}
- self.allBins = []
- self.allBinIds = {}
- self.allBinNames = {}
-
self.allFormulas = {}
self.stattop = {}
@@ -149,7 +145,6 @@ class Database(object):
self.mode = 'sum';
self.runs = None
- self.bins = None
self.ticks = None
self.method = 'sum'
self._method = type(self).sum
@@ -220,11 +215,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)
@@ -247,18 +237,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
@@ -362,39 +340,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, '
@@ -416,10 +365,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
@@ -429,35 +374,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)
@@ -473,12 +404,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 = {}