From 25b39da69d4267b34a87b7324008b6d4480a2b09 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sat, 25 Feb 2006 22:01:05 -0500 Subject: Since the delayed write stuff is gone, get rid of regWrite and merge it with writeBar0 --HG-- extra : convert_revision : 354642e0d528b6a5a7f2cdf0264d93e738b2d4eb --- dev/sinic.cc | 23 ++++++----------------- dev/sinic.hh | 1 - 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/dev/sinic.cc b/dev/sinic.cc index c499d2f49..a9363954b 100644 --- a/dev/sinic.cc +++ b/dev/sinic.cc @@ -489,30 +489,17 @@ Device::writeBar0(MemReqPtr &req, Addr daddr, const uint8_t *data) panic("invalid size for %s: cpu=%d da=%#x pa=%#x va=%#x size=%d", info.name, cpu, daddr, req->paddr, req->vaddr, req->size); - //uint32_t reg32 = *(uint32_t *)data; + uint32_t reg32 = *(uint32_t *)data; uint64_t reg64 = *(uint64_t *)data; + VirtualReg &vnic = virtualRegs[index]; + DPRINTF(EthernetPIO, "write %s: cpu=%d val=%#x da=%#x pa=%#x va=%#x size=%d\n", - info.name, cpu, info.size == 4 ? (*(uint32_t *)data) : reg64, daddr, + info.name, cpu, info.size == 4 ? reg32 : reg64, daddr, req->paddr, req->vaddr, req->size); prepareWrite(cpu, index); - regWrite(daddr, cpu, data); - - return NoFault; -} - -void -Device::regWrite(Addr daddr, int cpu, const uint8_t *data) -{ - Addr index = daddr >> Regs::VirtualShift; - Addr raddr = daddr & Regs::VirtualMask; - - uint32_t reg32 = *(uint32_t *)data; - uint64_t reg64 = *(uint64_t *)data; - VirtualReg &vnic = virtualRegs[index]; - switch (raddr) { case Regs::Config: changeConfig(reg32); @@ -559,6 +546,8 @@ Device::regWrite(Addr daddr, int cpu, const uint8_t *data) } break; } + + return NoFault; } void diff --git a/dev/sinic.hh b/dev/sinic.hh index 97ebf4c30..c4027be86 100644 --- a/dev/sinic.hh +++ b/dev/sinic.hh @@ -280,7 +280,6 @@ class Device : public Base Fault iprRead(Addr daddr, int cpu, uint64_t &result); Fault readBar0(MemReqPtr &req, Addr daddr, uint8_t *data); Fault writeBar0(MemReqPtr &req, Addr daddr, const uint8_t *data); - void regWrite(Addr daddr, int cpu, const uint8_t *data); Tick cacheAccess(MemReqPtr &req); /** -- cgit v1.2.3 -- cgit v1.2.3 From 63db9860cf4ef1bfdfe97bf7f276c27dc5d13eea Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 25 Feb 2006 22:57:46 -0500 Subject: Make sure cpu/static_inst_exec_sigs.hh get rebuilt when CPU_MODELS parameter changes. arch/SConscript: Fix typo in comment. cpu/SConscript: Convert exec signature generator to Action so we can add dependency on CPU_MODELS environment var. Print nicer string while we're at it. Also add some comments. --HG-- extra : convert_revision : bcb38a7941943cf071dac34cdbb2ece5456b8620 --- arch/SConscript | 2 +- cpu/SConscript | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/arch/SConscript b/arch/SConscript index d237b0b1f..142bd763b 100644 --- a/arch/SConscript +++ b/arch/SConscript @@ -70,7 +70,7 @@ def gen_switch_hdr_string(target, source, env): return "Generating ISA switch header " + str(target[0]) # Build SCons Action object. 'varlist' specifies env vars that this -# action depdnds on; when env['ALL_ISA_LIST'] changes these actions +# action depends on; when env['ALL_ISA_LIST'] changes these actions # should get re-executed. switch_hdr_action = Action(gen_switch_hdr, gen_switch_hdr_string, varlist=['ALL_ISA_LIST']) diff --git a/cpu/SConscript b/cpu/SConscript index dbe174660..af6bab4eb 100644 --- a/cpu/SConscript +++ b/cpu/SConscript @@ -32,13 +32,28 @@ import os.path # Import build environment variable from SConstruct. Import('env') +################################################################# +# +# Generate StaticInst execute() method signatures. +# +# There must be one signature for each CPU model compiled in. +# Since the set of compiled-in models is flexible, we generate a +# header containing the appropriate set of signatures on the fly. +# +################################################################# + +# CPU model-specific data is contained in cpu_models.py +# Convert to SCons File node to get path handling models_db = File('cpu_models.py') +# slurp in contents of file execfile(models_db.srcnode().abspath) +# Template for execute() signature. exec_sig_template = ''' virtual Fault execute(%s *xc, Trace::InstRecord *traceData) const = 0; ''' +# Generate header. def gen_cpu_exec_signatures(target, source, env): f = open(str(target[0]), 'w') print >> f, ''' @@ -52,7 +67,22 @@ def gen_cpu_exec_signatures(target, source, env): #endif // __CPU_STATIC_INST_EXEC_SIGS_HH__ ''' -env.Command('static_inst_exec_sigs.hh', models_db, gen_cpu_exec_signatures) +# Generate string that gets printed when header is rebuilt +def gen_sigs_string(target, source, env): + return "Generating static_inst_exec_sigs.hh: " \ + + ', '.join(env['CPU_MODELS']) + +# Add command to generate header to environment. +env.Command('static_inst_exec_sigs.hh', models_db, + Action(gen_cpu_exec_signatures, gen_sigs_string, + varlist = ['CPU_MODELS'])) + +################################################################# +# +# Include CPU-model-specific files based on set of models +# specified in CPU_MODELS build option. +# +################################################################# sources = [] -- cgit v1.2.3 From 46189e9e2b4d36cb2aa3587919cb4d532118fa9c Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sat, 25 Feb 2006 23:48:13 -0500 Subject: better colors for barcharts util/stats/barchart.py: If there are fewer than 5 colors, pick from a subset of 5 so there is more consistency in colors between graphs --HG-- extra : convert_revision : 6cf64c2f8ed81e714e24a3ebe5a7a60ca168b231 --- util/stats/barchart.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/stats/barchart.py b/util/stats/barchart.py index dd3bf0180..87d0eb5bb 100644 --- a/util/stats/barchart.py +++ b/util/stats/barchart.py @@ -47,8 +47,11 @@ class BarChart(ChartOptions): 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 -- cgit v1.2.3 From cf3667a0e435fe707cf318caecc151c4b311b755 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 00:11:54 -0500 Subject: add error bars and more options for legend placement util/stats/barchart.py: Add support for error bars util/stats/barchart.py: add support to choose between a legend inside or outside the figure. --HG-- extra : convert_revision : 14273e385c106bf27a2013991f9f34ca6551b96c --- util/stats/barchart.py | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/util/stats/barchart.py b/util/stats/barchart.py index 87d0eb5bb..f26a88d51 100644 --- a/util/stats/barchart.py +++ b/util/stats/barchart.py @@ -42,6 +42,8 @@ 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) @@ -92,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 @@ -126,6 +154,9 @@ class BarChart(ChartOptions): 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] @@ -177,8 +208,11 @@ 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) @@ -218,8 +252,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) -- cgit v1.2.3 From 0d71a17ed89cc1cfa3b2b2b5b2844687c45c2102 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 00:19:02 -0500 Subject: forgot to add a chart option util/stats/chart.py: add a bool config option for determining if the legend is inside or outside the figure --HG-- extra : convert_revision : e862d1832a0cc3c1837758cc247bc77c0a02ec12 --- util/stats/chart.py | 1 + 1 file changed, 1 insertion(+) diff --git a/util/stats/chart.py b/util/stats/chart.py index 095620172..369a57fc6 100644 --- a/util/stats/chart.py +++ b/util/stats/chart.py @@ -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, -- cgit v1.2.3 From b7e4d16ea94bbfe49ac3baa5e73f04d44ee2f2f0 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 00:35:10 -0500 Subject: code cleanup util/stats/barchart.py: clean up some of lisa's messy code remove trailing whitespace while I'm at it. --HG-- extra : convert_revision : f2fe6777fb4b458fa1d5b5b743f6274014c229ad --- util/stats/barchart.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/util/stats/barchart.py b/util/stats/barchart.py index f26a88d51..5d6dd0ab1 100644 --- a/util/stats/barchart.py +++ b/util/stats/barchart.py @@ -177,7 +177,8 @@ class BarChart(ChartOptions): 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) + 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 @@ -239,9 +240,11 @@ class BarChart(ChartOptions): outer_axes.set_xticklabels(self.xticks) if self.xsubticks is not None: - inner_axes.set_xticks(arange((cshape[0] + 1)*cshape[2])*width + 2*center) + 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) + inner_axes.set_xticklabels(self.xsubticks * cshape[2], fontsize=7, + rotation=90) if self.legend is not None: if dim == 1: @@ -281,7 +284,7 @@ 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 -- cgit v1.2.3 From 2c3e8d148cd349e5cb73c0d018271d171da0571c Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 00:57:37 -0500 Subject: fix small python bug in database processing code util/stats/db.py: fix usage of hasattr --HG-- extra : convert_revision : b384e1efeda76921c565f9f391694c27273edcec --- util/stats/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- cgit v1.2.3 From 57092567bac410c521738c7d30affa57c7b45b96 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 01:00:15 -0500 Subject: better function categorization util/stats/categories.py: bit more stuff for categorizing functions --HG-- extra : convert_revision : 03617246a9254a580684dce82836517d1efdfc5b --- util/stats/categories.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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', -- cgit v1.2.3 From 10fcad4ce099118fde1e61a907fb96abd617ac68 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 10:44:01 -0500 Subject: Allow graph_group to not be selected so we can have a normal ungrouped barchart --HG-- extra : convert_revision : 7d55440c9bb060607eddbb72448a3413944bb6ba --- util/stats/output.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) 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 ] -- cgit v1.2.3 From 9b18c0e87272b35a34e39ce2a9924963402e5b29 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 20:31:08 -0500 Subject: add some support for random access of data in packet fifos dev/pktfifo.cc: add support for copying arbitrary data out of a packet fifo dev/pktfifo.hh: add support for copying arbitrary data out of a packet fifo. Add functions to determine where in the fifo a particular packet is --HG-- extra : convert_revision : f8ddc994ce8577f29af0de3fa418a01e4e2cb0f1 --- dev/pktfifo.cc | 34 ++++++++++++++++++++++++++++++++-- dev/pktfifo.hh | 29 +++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/dev/pktfifo.cc b/dev/pktfifo.cc index b4fab2d6f..639009be9 100644 --- a/dev/pktfifo.cc +++ b/dev/pktfifo.cc @@ -31,6 +31,36 @@ using namespace std; +bool +PacketFifo::copyout(void *dest, int offset, int len) +{ + char *data = (char *)dest; + if (offset + len >= size()) + return false; + + list::iterator p = fifo.begin(); + list::iterator end = fifo.end(); + while (len > 0) { + while (offset >= (*p)->length) { + offset -= (*p)->length; + ++p; + } + + if (p == end) + panic("invalid fifo"); + + int size = min((*p)->length - offset, len); + memcpy(data, (*p)->data, size); + offset = 0; + len -= size; + data += size; + ++p; + } + + return true; +} + + void PacketFifo::serialize(const string &base, ostream &os) { @@ -40,8 +70,8 @@ PacketFifo::serialize(const string &base, ostream &os) paramOut(os, base + ".packets", fifo.size()); int i = 0; - std::list::iterator p = fifo.begin(); - std::list::iterator end = fifo.end(); + list::iterator p = fifo.begin(); + list::iterator end = fifo.end(); while (p != end) { (*p)->serialize(csprintf("%s.packet%d", base, i), os); ++p; diff --git a/dev/pktfifo.hh b/dev/pktfifo.hh index e63fd291f..e245840a8 100644 --- a/dev/pktfifo.hh +++ b/dev/pktfifo.hh @@ -127,6 +127,35 @@ class PacketFifo fifo.erase(i); } + bool copyout(void *dest, int offset, int len); + + int countPacketsBefore(iterator end) + { + iterator i = fifo.begin(); + int count = 0; + + while (i != end) { + ++count; + ++i; + } + + return count; + } + + int countPacketsAfter(iterator i) + { + iterator end = fifo.end(); + int count = 0; + + while (i != end) { + ++count; + ++i; + } + + return count; + } + + /** * Serialization stuff */ -- cgit v1.2.3 From 29f50d934549f10b073a5492bd0d441d71534ace Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 26 Feb 2006 23:06:21 -0500 Subject: fix some minor stats stuff util/stats/stats.py: fix up a few of the stats. --HG-- extra : convert_revision : 61c600cd146900c8cc0cf60a9036f2e999a5e244 --- util/stats/stats.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 ] -- cgit v1.2.3