summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/emacs/m5-c-style.el3
-rw-r--r--util/m5/Makefile62
-rw-r--r--util/m5/m5.c18
-rw-r--r--util/m5/m5op.S196
-rw-r--r--util/m5/m5op.h31
-rw-r--r--util/m5/m5op.s121
-rw-r--r--util/pbs/jobfile.py43
-rw-r--r--util/stats/barchart.py122
-rw-r--r--util/stats/categories.py6
-rw-r--r--util/stats/chart.py4
-rw-r--r--util/stats/db.py2
-rw-r--r--util/stats/output.py37
-rwxr-xr-xutil/stats/stats.py7
13 files changed, 439 insertions, 213 deletions
diff --git a/util/emacs/m5-c-style.el b/util/emacs/m5-c-style.el
index b9d16a4b1..9578e3dbe 100644
--- a/util/emacs/m5-c-style.el
+++ b/util/emacs/m5-c-style.el
@@ -1,4 +1,4 @@
-; Copyright (c) 2003-2004 The Regents of The University of Michigan
+; Copyright (c) 2003-2004, 2006 The Regents of The University of Michigan
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
(c-add-style "m5"
'((c-basic-offset . 4)
+ (indent-tabs-mode . nil)
(c-offsets-alist . ((substatement-open . 0)
(inline-open . 0)
(block-open . -4)
diff --git a/util/m5/Makefile b/util/m5/Makefile
index 6e4ad31a3..518542322 100644
--- a/util/m5/Makefile
+++ b/util/m5/Makefile
@@ -1,26 +1,50 @@
-AS=as
-CC=cc
-LD=cc
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-CCFLAGS=-O2
-#LDFLAGS=-non_shared
+### If we are not compiling on an alpha, we must use cross tools ###
+ifneq ($(shell uname -m), alpha)
+CROSS_COMPILE?=alpha-unknown-linux-gnu-
+endif
+CC=$(CROSS_COMPILE)gcc
+AS=$(CROSS_COMPILE)as
+LD=$(CROSS_COMPILE)ld
-all: m5
+CFLAGS=-O2
+OBJS=m5.o m5op.o
-m5: m5op.o m5.o
- $(LD) $(LDFLAGS) -o $@ $>
- strip $@
+all: m5
-clean:
- @rm -f m5 *.o *.d *~ .#*
+%.o: %.S
+ $(CC) $(CFLAGS) -o $@ -c $<
-.SUFFIXES:
-.SUFFIXES:.o .c .s
+%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
-# C Compilation
-.c.o:
- $(CC) $(CCFLAGS) -o $@ -c $<
+m5: $(OBJS)
+ $(CC) -o $@ $(OBJS)
-# Assembly
-.s.o:
- $(AS) $(ASFLAGS) -o $@ $<
+clean:
+ rm -f *.o m5
diff --git a/util/m5/m5.c b/util/m5/m5.c
index 942ad5ba4..6fdbc0500 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
usage();
arg1 = strtoul(argv[2], NULL, 0);
- ivlb(arg1);
+ m5_ivlb(arg1);
return 0;
}
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
usage();
arg1 = strtoul(argv[2], NULL, 0);
- ivle(arg1);
+ m5_ivle(arg1);
return 0;
}
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
if (argc != 2)
usage();
- printf("%ld", initparam());
+ printf("%ld", m5_initparam());
return 0;
}
@@ -98,7 +98,7 @@ main(int argc, char *argv[])
if (argc != 2)
usage();
- param = initparam();
+ param = m5_initparam();
// run-time, rampup-time, rampdown-time, warmup-time, connections
printf("%d %d %d %d %d", (param >> 48) & 0xfff,
(param >> 36) & 0xfff, (param >> 24) & 0xfff,
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
case 3:
arg1 = strtoul(argv[2], NULL, 0);
case 2:
- m5exit(arg1);
+ m5_exit(arg1);
return 0;
default:
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
case 3:
arg1 = strtoul(argv[2], NULL, 0);
case 2:
- reset_stats(arg1, arg2);
+ m5_reset_stats(arg1, arg2);
return 0;
default:
@@ -142,7 +142,7 @@ main(int argc, char *argv[])
case 3:
arg1 = strtoul(argv[2], NULL, 0);
case 2:
- dump_stats(arg1, arg2);
+ m5_dump_stats(arg1, arg2);
return 0;
default:
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
case 3:
arg1 = strtoul(argv[2], NULL, 0);
case 2:
- dumpreset_stats(arg1, arg2);
+ m5_dumpreset_stats(arg1, arg2);
return 0;
default:
@@ -172,7 +172,7 @@ main(int argc, char *argv[])
case 3:
arg1 = strtoul(argv[2], NULL, 0);
case 2:
- checkpoint(arg1, arg2);
+ m5_checkpoint(arg1, arg2);
return 0;
default:
diff --git a/util/m5/m5op.S b/util/m5/m5op.S
new file mode 100644
index 000000000..a53c45277
--- /dev/null
+++ b/util/m5/m5op.S
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2003-2006 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define m5_op 0x01
+
+#define arm_func 0x00
+#define quiesce_func 0x01
+#define quiescens_func 0x02
+#define quiescecycle_func 0x03
+#define quiescetime_func 0x04
+#define ivlb_func 0x10
+#define ivle_func 0x11
+#define exit_old_func 0x20 // deprectated!
+#define exit_func 0x21
+#define initparam_func 0x30
+#define resetstats_func 0x40
+#define dumpstats_func 0x41
+#define dumprststats_func 0x42
+#define ckpt_func 0x43
+#define readfile_func 0x50
+#define debugbreak_func 0x51
+#define switchcpu_func 0x52
+#define addsymbol_func 0x53
+#define panic_func 0x54
+
+#define INST(op, ra, rb, func) \
+ .long (((op) << 26) | ((ra) << 21) | ((rb) << 16) | (func))
+
+#define LEAF(func) \
+ .align 3; \
+ .globl func; \
+ .ent func; \
+func:
+
+#define RET \
+ ret ($26)
+
+#define END(func) \
+ .end func
+
+#define ARM(reg) INST(m5_op, reg, 0, arm_func)
+#define QUIESCE INST(m5_op, 0, 0, quiesce_func)
+#define QUIESCENS(r1) INST(m5_op, r1, 0, quiescens_func)
+#define QUIESCECYC(r1) INST(m5_op, r1, 0, quiescecycle_func)
+#define QUIESCETIME INST(m5_op, 0, 0, quiescetime_func)
+#define IVLB(reg) INST(m5_op, reg, 0, ivlb_func)
+#define IVLE(reg) INST(m5_op, reg, 0, ivle_func)
+#define M5EXIT(reg) INST(m5_op, reg, 0, exit_func)
+#define INITPARAM(reg) INST(m5_op, reg, 0, initparam_func)
+#define RESET_STATS(r1, r2) INST(m5_op, r1, r2, resetstats_func)
+#define DUMP_STATS(r1, r2) INST(m5_op, r1, r2, dumpstats_func)
+#define DUMPRST_STATS(r1, r2) INST(m5_op, r1, r2, dumprststats_func)
+#define CHECKPOINT(r1, r2) INST(m5_op, r1, r2, ckpt_func)
+#define READFILE INST(m5_op, 0, 0, readfile_func)
+#define DEBUGBREAK INST(m5_op, 0, 0, debugbreak_func)
+#define SWITCHCPU INST(m5_op, 0, 0, switchcpu_func)
+#define ADDSYMBOL(r1,r2) INST(m5_op, r1, r2, addsymbol_func)
+#define PANIC INST(m5_op, 0, 0, panic_func)
+
+ .set noreorder
+
+ .align 4
+LEAF(arm)
+ ARM(16)
+ RET
+END(arm)
+
+ .align 4
+LEAF(quiesce)
+ QUIESCE
+ RET
+END(quiesce)
+
+ .align 4
+LEAF(quiesceNs)
+ QUIESCENS(16)
+ RET
+END(quiesceNs)
+
+ .align 4
+LEAF(quiesceCycle)
+ QUIESCECYC(16)
+ RET
+END(quiesceCycle)
+
+ .align 4
+LEAF(quiesceTime)
+ QUIESCETIME
+ RET
+END(quiesceTime)
+
+
+ .align 4
+LEAF(m5_ivlb)
+ IVLB(16)
+ RET
+END(m5_ivlb)
+
+ .align 4
+LEAF(m5_ivle)
+ IVLE(16)
+ RET
+END(m5_ivle)
+
+ .align 4
+LEAF(m5_exit)
+ M5EXIT(16)
+ RET
+END(m5_exit)
+
+ .align 4
+LEAF(m5_initparam)
+ INITPARAM(0)
+ RET
+END(m5_initparam)
+
+ .align 4
+LEAF(m5_reset_stats)
+ RESET_STATS(16, 17)
+ RET
+END(m5_reset_stats)
+
+ .align 4
+LEAF(m5_dump_stats)
+ DUMP_STATS(16, 17)
+ RET
+END(m5_dump_stats)
+
+ .align 4
+LEAF(m5_dumpreset_stats)
+ DUMPRST_STATS(16, 17)
+ RET
+END(m5_dumpreset_stats)
+
+ .align 4
+LEAF(m5_checkpoint)
+ CHECKPOINT(16, 17)
+ RET
+END(m5_checkpoint)
+
+ .align 4
+LEAF(m5_readfile)
+ READFILE
+ RET
+END(m5_readfile)
+
+ .align 4
+LEAF(m5_debugbreak)
+ DEBUGBREAK
+ RET
+END(m5_debugbreak)
+
+ .align 4
+LEAF(m5_switchcpu)
+ SWITCHCPU
+ RET
+END(m5_switchcpu)
+
+ .align 4
+LEAF(m5_addsymbol)
+ ADDSYMBOL(16, 17)
+ RET
+END(m5_addsymbol)
+
+ .align 4
+LEAF(m5_panic)
+ PANIC
+ RET
+END(m5_panic)
+
+
diff --git a/util/m5/m5op.h b/util/m5/m5op.h
index 91dc4cc8b..34ac7760d 100644
--- a/util/m5/m5op.h
+++ b/util/m5/m5op.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2005 The Regents of The University of Michigan
+ * Copyright (c) 2003-2006 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,17 +29,26 @@
#ifndef __M5OP_H__
#define __M5OP_H__
-#include <inttypes.h>
+#include <asm/types.h>
void arm(uint64_t address);
-void quiesce();
-void ivlb(uint64_t interval);
-void ivle(uint64_t interval);
-void m5exit(uint64_t ns_delay);
-uint64_t initparam();
-void checkpoint(uint64_t ns_delay, uint64_t ns_period);
-void reset_stats(uint64_t ns_delay, uint64_t ns_period);
-void dump_stats(uint64_t ns_delay, uint64_t ns_period);
-void dumpreset_stats(uint64_t ns_delay, uint64_t ns_period);
+void quiesce(void);
+void quiesceNs(uint64_t ns);
+void quiesceCycle(uint64_t cycles);
+uint64_t quiesceTime(void);
+
+void m5_ivlb(uint64_t interval);
+void m5_ivle(uint64_t interval);
+void m5_exit(uint64_t ns_delay);
+uint64_t m5_initparam(void);
+void m5_checkpoint(uint64_t ns_delay, uint64_t ns_period);
+void m5_reset_stats(uint64_t ns_delay, uint64_t ns_period);
+void m5_dump_stats(uint64_t ns_delay, uint64_t ns_period);
+void m5_dumpreset_stats(uint64_t ns_delay, uint64_t ns_period);
+uint64_t m5_readfile(void *buffer, uint64_t len, uint64_t offset);
+void m5_debugbreak(void);
+void m5_switchcpu(void);
+void m5_addsymbol(uint64_t addr, char *symbol);
+void m5_panic(void);
#endif // __M5OP_H__
diff --git a/util/m5/m5op.s b/util/m5/m5op.s
deleted file mode 100644
index e779e4209..000000000
--- a/util/m5/m5op.s
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2003, 2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-#include <regdef.h>
-
-#define m5_op 0x01
-
-#define arm_func 0x00
-#define quiesce_func 0x01
-#define ivlb_func 0x10
-#define ivle_func 0x11
-#define exit_old_func 0x20 // deprectated!
-#define exit_func 0x21
-#define initparam_func 0x30
-#define resetstats_func 0x40
-#define dumpstats_func 0x41
-#define dumprststats_func 0x42
-#define ckpt_func 0x43
-
-#define INST(op, ra, rb, func) \
- .long (((op) << 26) | ((ra) << 21) | ((rb) << 16) | (func))
-
-#define ARM(reg) INST(m5_op, reg, 0, arm_func)
-#define QUIESCE() INST(m5_op, 0, 0, quiesce_func)
-#define IVLB(reg) INST(m5_op, reg, 0, ivlb_func)
-#define IVLE(reg) INST(m5_op, reg, 0, ivle_func)
-#define M5EXIT(reg) INST(m5_op, reg, 0, exit_func)
-#define INITPARAM(reg) INST(m5_op, reg, 0, initparam_func)
-#define RESET_STATS(r1, r2) INST(m5_op, r1, r2, resetstats_func)
-#define DUMP_STATS(r1, r2) INST(m5_op, r1, r2, dumpstats_func)
-#define DUMPRST_STATS(r1, r2) INST(m5_op, r1, r2, dumprststats_func)
-#define CHECKPOINT(r1, r2) INST(m5_op, r1, r2, ckpt_func)
-
- .set noreorder
-
- .align 4
-LEAF(arm)
- ARM(16)
- RET
-END(arm)
-
- .align 4
-LEAF(quiesce)
- QUIESCE()
- RET
-END(quiesce)
-
- .align 4
-LEAF(ivlb)
- IVLB(16)
- RET
-END(ivlb)
-
- .align 4
-LEAF(ivle)
- IVLE(16)
- RET
-END(ivle)
-
- .align 4
-LEAF(m5exit)
- M5EXIT(16)
- RET
-END(m5exit)
-
- .align 4
-LEAF(initparam)
- INITPARAM(0)
- RET
-END(initparam)
-
- .align 4
-LEAF(reset_stats)
- RESET_STATS(16, 17)
- RET
-END(reset_stats)
-
- .align 4
-LEAF(dump_stats)
- DUMP_STATS(16, 17)
- RET
-END(dump_stats)
-
- .align 4
-LEAF(dumpreset_stats)
- DUMPRST_STATS(16, 17)
- RET
-END(dumpreset_stats)
-
- .align 4
-LEAF(checkpoint)
- CHECKPOINT(16, 17)
- RET
-END(checkpoint)
-
diff --git a/util/pbs/jobfile.py b/util/pbs/jobfile.py
index d36b5ee6d..fd19b3bf5 100644
--- a/util/pbs/jobfile.py
+++ b/util/pbs/jobfile.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 The Regents of The University of Michigan
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -277,10 +277,11 @@ class Option(Data):
return name
if attr == 'desc':
- desc = self.__dict__[attr]
- if self._suboption is not None:
- desc = '%s, %s' % (desc, self._suboption.desc)
- return desc
+ desc = [ self.__dict__[attr] ]
+ if self._suboption is not None and self._suboption.desc:
+ desc.append(self._suboption.desc)
+ return ', '.join(desc)
+
return super(Option, self).__getattribute__(attr)
@@ -356,6 +357,8 @@ class Configuration(Data):
def __init__(self, name, desc, **kwargs):
super(Configuration, self).__init__(name, desc, **kwargs)
self._groups = []
+ self._posfilters = []
+ self._negfilters = []
def group(self, name, desc, **kwargs):
grp = Group(name, desc, **kwargs)
@@ -402,13 +405,39 @@ class Configuration(Data):
if checkpoint:
yield options
+ def addfilter(self, filt, pos=True):
+ import re
+ filt = re.compile(filt)
+ if pos:
+ self._posfilters.append(filt)
+ else:
+ self._negfilters.append(filt)
+
+ def jobfilter(self, job):
+ for filt in self._negfilters:
+ if filt.match(job.name):
+ return False
+
+ if not self._posfilters:
+ return True
+
+ for filt in self._posfilters:
+ if filt.match(job.name):
+ return True
+
+ return False
+
def checkpoints(self, groups = None):
for options in self.options(groups, True):
- yield Job(options)
+ job = Job(options)
+ if self.jobfilter(job):
+ yield job
def jobs(self, groups = None):
for options in self.options(groups, False):
- yield Job(options)
+ job = Job(options)
+ if self.jobfilter(job):
+ yield job
def alljobs(self, groups = None):
for options in self.options(groups, True):
diff --git a/util/stats/barchart.py b/util/stats/barchart.py
index 19cccb58a..5d6dd0ab1 100644
--- a/util/stats/barchart.py
+++ b/util/stats/barchart.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 The Regents of The University of Michigan
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@ import matplotlib, pylab
from matplotlib.font_manager import FontProperties
from matplotlib.numerix import array, arange, reshape, shape, transpose, zeros
from matplotlib.numerix import Float
+from matplotlib.ticker import NullLocator
matplotlib.interactive(False)
@@ -41,13 +42,18 @@ class BarChart(ChartOptions):
super(BarChart, self).__init__(default, **kwargs)
self.inputdata = None
self.chartdata = None
+ self.inputerr = None
+ self.charterr = None
def gen_colors(self, count):
cmap = matplotlib.cm.get_cmap(self.colormap)
if count == 1:
return cmap([ 0.5 ])
- else:
- return cmap(arange(count) / float(count - 1))
+
+ if count < 5:
+ return cmap(arange(5) / float(4))[:count]
+
+ return cmap(arange(count) / float(count - 1))
# The input data format does not match the data format that the
# graph function takes because it is intuitive. The conversion
@@ -88,6 +94,32 @@ class BarChart(ChartOptions):
data = property(get_data, set_data)
+ def set_err(self, err):
+ if err is None:
+ self.inputerr = None
+ self.charterr = None
+ return
+
+ err = array(err)
+ dim = len(shape(err))
+ if dim not in (1, 2, 3):
+ raise AttributeError, "Input err must be a 1, 2, or 3d matrix"
+ self.inputerr = err
+
+ if dim == 1:
+ self.charterr = array([[err]])
+
+ if dim == 2:
+ self.charterr = transpose([err], axes=(2,0,1))
+
+ if dim == 3:
+ self.charterr = transpose(err, axes=(1,2,0))
+
+ def get_err(self):
+ return self.inputerr
+
+ err = property(get_err, set_err)
+
# Graph the chart data.
# Input is a 3d matrix that describes a plot that has multiple
# groups, multiple bars in each group, and multiple values stacked
@@ -120,11 +152,11 @@ class BarChart(ChartOptions):
if self.chartdata is None:
raise AttributeError, "Data not set for bar chart!"
- self.figure = pylab.figure(figsize=self.chart_size)
- self.axes = self.figure.add_axes(self.figure_size)
-
dim = len(shape(self.inputdata))
cshape = shape(self.chartdata)
+ if self.charterr is not None and shape(self.charterr) != cshape:
+ raise AttributeError, 'Dimensions of error and data do not match'
+
if dim == 1:
colors = self.gen_colors(cshape[2])
colors = [ [ colors ] * cshape[1] ] * cshape[0]
@@ -139,13 +171,36 @@ class BarChart(ChartOptions):
colors = array(colors)
- bars_in_group = len(self.chartdata)
- if bars_in_group < 5:
- width = 1.0 / ( bars_in_group + 1)
- center = width / 2
+ self.figure = pylab.figure(figsize=self.chart_size)
+
+ outer_axes = None
+ inner_axes = None
+ if self.xsubticks is not None:
+ color = self.figure.get_facecolor()
+ self.metaaxes = self.figure.add_axes(self.figure_size,
+ axisbg=color, frameon=False)
+ for tick in self.metaaxes.xaxis.majorTicks:
+ tick.tick1On = False
+ tick.tick2On = False
+ self.metaaxes.set_yticklabels([])
+ self.metaaxes.set_yticks([])
+ size = [0] * 4
+ size[0] = self.figure_size[0]
+ size[1] = self.figure_size[1] + .12
+ size[2] = self.figure_size[2]
+ size[3] = self.figure_size[3] - .12
+ self.axes = self.figure.add_axes(size)
+ outer_axes = self.metaaxes
+ inner_axes = self.axes
else:
- width = .8 / bars_in_group
- center = .1
+ self.axes = self.figure.add_axes(self.figure_size)
+ outer_axes = self.axes
+ inner_axes = self.axes
+
+ bars_in_group = len(self.chartdata)
+
+ width = 1.0 / ( bars_in_group + 1)
+ center = width / 2
bars = []
for i,stackdata in enumerate(self.chartdata):
@@ -154,30 +209,42 @@ class BarChart(ChartOptions):
for j,bardata in enumerate(stackdata):
bardata = array(bardata)
ind = arange(len(bardata)) + i * width + center
+ yerr = None
+ if self.charterr is not None:
+ yerr = self.charterr[i][j]
bar = self.axes.bar(ind, bardata, width, bottom=bottom,
- color=colors[i][j])
+ color=colors[i][j], yerr=yerr)
+ if self.xsubticks is not None:
+ self.metaaxes.bar(ind, [0] * len(bardata), width)
stack.append(bar)
bottom += bardata
bars.append(stack)
if self.xlabel is not None:
- self.axes.set_xlabel(self.xlabel)
+ outer_axes.set_xlabel(self.xlabel)
if self.ylabel is not None:
- self.axes.set_ylabel(self.ylabel)
+ inner_axes.set_ylabel(self.ylabel)
if self.yticks is not None:
ymin, ymax = self.axes.get_ylim()
nticks = float(len(self.yticks))
ticks = arange(nticks) / (nticks - 1) * (ymax - ymin) + ymin
- self.axes.set_yticks(ticks)
- self.axes.set_yticklabels(self.yticks)
+ inner_axes.set_yticks(ticks)
+ inner_axes.set_yticklabels(self.yticks)
elif self.ylim is not None:
- self.axes.set_ylim(self.ylim)
+ self.inner_axes.set_ylim(self.ylim)
if self.xticks is not None:
- self.axes.set_xticks(arange(cshape[2]) + .5)
- self.axes.set_xticklabels(self.xticks)
+ outer_axes.set_xticks(arange(cshape[2]) + .5)
+ outer_axes.set_xticklabels(self.xticks)
+
+ if self.xsubticks is not None:
+ numticks = (cshape[0] + 1) * cshape[2]
+ inner_axes.set_xticks(arange(numticks) * width + 2 * center)
+ self.xsubticks.append('')
+ inner_axes.set_xticklabels(self.xsubticks * cshape[2], fontsize=7,
+ rotation=90)
if self.legend is not None:
if dim == 1:
@@ -188,8 +255,12 @@ class BarChart(ChartOptions):
number = len(bars[0])
lbars = [ bars[0][number - j - 1][0] for j in xrange(number)]
- self.figure.legend(lbars, self.legend, self.legend_loc,
- prop=FontProperties(size=self.legend_size))
+ if self.fig_legend:
+ self.figure.legend(lbars, self.legend, self.legend_loc,
+ prop=FontProperties(size=self.legend_size))
+ else:
+ self.axes.legend(lbars, self.legend, self.legend_loc,
+ prop=FontProperties(size=self.legend_size))
if self.title is not None:
self.axes.set_title(self.title)
@@ -213,14 +284,13 @@ class BarChart(ChartOptions):
ylabel = []
#if self.ylabel:
# ylabel = [ self.ylabel[i] ]
- f.write(', '.join(ylabel + [ '%f' % val for val in row]) + '\n')
+ f.write(', '.join(ylabel + [ '%f' % v for v in row]) + '\n')
if dim == 3:
f.write("don't do 3D csv files\n")
pass
f.close()
-
if __name__ == '__main__':
from random import randrange
import random, sys
@@ -252,6 +322,8 @@ if __name__ == '__main__':
chart1.legend = [ 'x%d' % x for x in xrange(myshape[-1]) ]
chart1.xticks = [ 'xtick%d' % x for x in xrange(myshape[0]) ]
chart1.title = 'this is the title'
+ if len(myshape) > 2:
+ chart1.xsubticks = [ '%d' % x for x in xrange(myshape[1]) ]
chart1.graph()
chart1.savefig('/tmp/test1.png')
chart1.savefig('/tmp/test1.ps')
@@ -266,4 +338,4 @@ if __name__ == '__main__':
chart2.savefig('/tmp/test2.png')
chart2.savefig('/tmp/test2.ps')
- #pylab.show()
+# pylab.show()
diff --git a/util/stats/categories.py b/util/stats/categories.py
index 8d5d506a2..6d8568879 100644
--- a/util/stats/categories.py
+++ b/util/stats/categories.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 The Regents of The University of Michigan
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -33,10 +33,14 @@ func_categories = { \
'skb_clone_fraglist' : 'buffer',
'skb_seq_read' : 'buffer',
'sock_alloc_send_skb' : 'buffer',
+ 'sinic_rxskb_alloc' : 'buffer',
# Copy functions
+ 'sinic_copyfrom' : 'copy',
'__copy_user' : 'copy',
'skb_copy_bits' : 'copy',
+ 'skb_copy_datagram_iovec' : 'copy',
+ 'sinic_vcopy_iov' : 'idle',
# Driver functions
'do_tx_done' : 'driver',
diff --git a/util/stats/chart.py b/util/stats/chart.py
index 1e301cb58..369a57fc6 100644
--- a/util/stats/chart.py
+++ b/util/stats/chart.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 The Regents of The University of Michigan
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@ class ChartOptions(object):
defaults = { 'chart_size' : (8, 4),
'figure_size' : [0.1, 0.1, 0.6, 0.85],
'title' : None,
+ 'fig_legend' : True,
'legend' : None,
'legend_loc' : 'upper right',
'legend_size' : 6,
@@ -38,6 +39,7 @@ class ChartOptions(object):
'xlabel' : None,
'ylabel' : None,
'xticks' : None,
+ 'xsubticks' : None,
'yticks' : None,
'ylim' : None,
}
diff --git a/util/stats/db.py b/util/stats/db.py
index d9b78c7d1..c0e7796eb 100644
--- a/util/stats/db.py
+++ b/util/stats/db.py
@@ -158,7 +158,7 @@ class Database(object):
return None
from info import ProxyError, scalar, vector, value, values, total, len
- if system is None and hasattr('system', job):
+ if system is None and hasattr(job, 'system'):
system = job.system
if system is not None:
diff --git a/util/stats/output.py b/util/stats/output.py
index e67751bbc..abfb8d901 100644
--- a/util/stats/output.py
+++ b/util/stats/output.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 The Regents of The University of Michigan
+# Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -103,15 +103,17 @@ class StatOutput(ChartOptions):
else:
groups.append(group)
- if not groupopts:
- raise AttributeError, 'No group selected for graph group'
+ has_group = bool(groupopts)
+ if has_group:
+ groupopts = [ group for group in crossproduct(groupopts) ]
+ else:
+ groupopts = [ None ]
- if not baropts:
+ if baropts:
+ baropts = [ bar for bar in crossproduct(baropts) ]
+ else:
raise AttributeError, 'No group selected for graph bars'
- groupopts = [ group for group in crossproduct(groupopts) ]
- baropts = [ bar for bar in crossproduct(baropts) ]
-
directory = expanduser(graphdir)
if not isdir(directory):
os.mkdir(directory)
@@ -124,12 +126,13 @@ class StatOutput(ChartOptions):
for options in self.jobfile.options(groups):
chart = BarChart(self)
- data = zeros((len(groupopts), len(baropts)), Float)
data = [ [ None ] * len(baropts) for i in xrange(len(groupopts)) ]
enabled = False
stacked = 0
for g,gopt in enumerate(groupopts):
for b,bopt in enumerate(baropts):
+ if gopt is None:
+ gopt = []
job = self.jobfile.job(options + gopt + bopt)
if not job:
continue
@@ -168,19 +171,24 @@ class StatOutput(ChartOptions):
if data.sum() == 0:
continue
+ dim = len(data.shape)
x = data.shape[0]
- y = data.shape[1]
xkeep = [ i for i in xrange(x) if data[i].sum() != 0 ]
+ y = data.shape[1]
ykeep = [ i for i in xrange(y) if data[:,i].sum() != 0 ]
data = data.take(xkeep, axis=0)
data = data.take(ykeep, axis=1)
+ if not has_group:
+ data = data.take([ 0 ], axis=0)
chart.data = data
- gopts = [ groupopts[i] for i in xkeep ]
- bopts = [ baropts[i] for i in ykeep ]
+ bopts = [ baropts[i] for i in ykeep ]
bdescs = [ ' '.join([o.desc for o in opt]) for opt in bopts]
- gdescs = [ ' '.join([o.desc for o in opt]) for opt in gopts]
+
+ if has_group:
+ gopts = [ groupopts[i] for i in xkeep ]
+ gdescs = [ ' '.join([o.desc for o in opt]) for opt in gopts]
if chart.legend is None:
if stacked:
@@ -192,7 +200,10 @@ class StatOutput(ChartOptions):
chart.legend = bdescs
if chart.xticks is None:
- chart.xticks = gdescs
+ if has_group:
+ chart.xticks = gdescs
+ else:
+ chart.xticks = []
chart.graph()
names = [ opt.name for opt in options ]
diff --git a/util/stats/stats.py b/util/stats/stats.py
index b75d9fec0..08281287f 100755
--- a/util/stats/stats.py
+++ b/util/stats/stats.py
@@ -262,6 +262,7 @@ def commands(options, command, args):
from output import StatOutput
output = StatOutput(options.jobfile, source)
output.xlabel = 'System Configuration'
+ output.colormap = 'RdYlGn'
if command == 'stat' or command == 'formula':
if len(args) != 1:
@@ -286,7 +287,6 @@ def commands(options, command, args):
raise CommandException
from info import ProxyGroup
- sim_seconds = source['sim_seconds']
proxy = ProxyGroup(system = source[options.system])
system = proxy.system
@@ -294,7 +294,6 @@ def commands(options, command, args):
bytes = etherdev.rxBytes + etherdev.txBytes
kbytes = bytes / 1024
packets = etherdev.rxPackets + etherdev.txPackets
- bps = etherdev.rxBandwidth + etherdev.txBandwidth
def display():
if options.graph:
@@ -337,7 +336,7 @@ def commands(options, command, args):
return
if command == 'pps':
- output.stat = packets / sim_seconds
+ output.stat = packets / source['sim_seconds']
output.ylabel = 'Packets/s'
display()
return
@@ -355,7 +354,7 @@ def commands(options, command, args):
if command == 'txbps':
output.stat = etherdev.txBandwidth / 1e9
if command == 'bps':
- output.stat = bps / 1e9
+ output.stat = (etherdev.rxBandwidth + etherdev.txBandwidth) / 1e9
output.ylabel = 'Bandwidth (Gbps)'
output.ylim = [ 0.0, 10.0 ]