summaryrefslogtreecommitdiff
path: root/util/stats
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
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')
-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 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 = {}
diff --git a/util/stats/dbinit.py b/util/stats/dbinit.py
index 8f7608bba..036941675 100644
--- a/util/stats/dbinit.py
+++ b/util/stats/dbinit.py
@@ -100,28 +100,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:
@@ -222,14 +200,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
@@ -242,11 +218,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;''')
#
@@ -398,12 +373,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 4954b0519..193159b4c 100644
--- a/util/stats/info.py
+++ b/util/stats/info.py
@@ -176,7 +176,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
@@ -185,7 +185,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')
@@ -761,7 +761,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 fa0dad513..2aa0d4e0b 100755
--- a/util/stats/stats.py
+++ b/util/stats/stats.py
@@ -39,7 +39,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
@@ -142,16 +141,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()
@@ -281,7 +270,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
@@ -301,22 +290,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
@@ -403,7 +380,6 @@ def commands(options, command, args):
if command == 'mpkb':
output.stat = misses / (bytes / 1024)
- output.binstats = [ misses ]
output.ylabel = 'Misses / KB'
display()
return
@@ -411,7 +387,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
@@ -448,7 +423,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'
@@ -456,10 +430,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':