Deleted Added
sdiff udiff text old ( 2343:a2b4a6ccee56 ) new ( 2665:a124942bacb8 )
full compact
1# Copyright (c) 2003-2004 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 9 unchanged lines hidden (view full) ---

18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27import MySQLdb
28
29class MyDB(object):
30 def __init__(self, options):
31 self.name = options.db
32 self.host = options.host
33 self.user = options.user

--- 59 unchanged lines hidden (view full) ---

93 rn_project VARCHAR(100) NOT NULL,
94 rn_date TIMESTAMP NOT NULL,
95 rn_expire TIMESTAMP NOT NULL,
96 PRIMARY KEY (rn_id),
97 UNIQUE (rn_name,rn_sample)
98 ) TYPE=InnoDB''')
99
100 #
101 # The stat table gives us all of the data for a particular stat.
102 #
103 # COLUMNS:
104 # 'stat' is a unique identifier for each stat to be used in other
105 # tables for references.
106 # 'name' is simply the simulator derived name for a given
107 # statistic.
108 # 'descr' is the description of the statistic and what it tells

--- 84 unchanged lines hidden (view full) ---

193 # -5: maximum value
194 # -6: underflow
195 # -7: overflow
196 # 'y' is used by a VECTORDIST and the VECTOR2D to describe the second
197 # dimension.
198 # 'run' is the run that the data was generated from. Details up in
199 # the run table
200 # 'tick' is a timestamp generated by the simulator.
201 # 'data' is the actual stat value.
202 #
203 # INDEXES:
204 # 'stat' is indexed so that a user can find all of the data for a
205 # particular stat. It is not unique, because that specific stat
206 # can be found in many runs and samples, in addition to
207 # having entries for the mulidimensional cases.
208 # 'run' is indexed to allow a user to remove all of the data for a
209 # particular execution run. It can also be used to allow the
210 # user to print out all of the data for a given run.
211 #
212 self.query('''
213 CREATE TABLE data(
214 dt_stat SMALLINT UNSIGNED NOT NULL,
215 dt_x SMALLINT NOT NULL,
216 dt_y SMALLINT NOT NULL,
217 dt_run SMALLINT UNSIGNED NOT NULL,
218 dt_tick BIGINT UNSIGNED NOT NULL,
219 dt_data DOUBLE NOT NULL,
220 INDEX (dt_stat),
221 INDEX (dt_run),
222 UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick)
223 ) TYPE=InnoDB;''')
224
225 #
226 # Names and descriptions for multi-dimensional stats (vectors, etc.)
227 # are stored here instead of having their own entry in the statistics
228 # table. This allows all parts of a single stat to easily share a
229 # single id.
230 #

--- 135 unchanged lines hidden (view full) ---

366
367 self.query('''
368 DELETE subdata
369 FROM subdata
370 LEFT JOIN data ON sd_stat=dt_stat
371 WHERE dt_stat IS NULL''')
372
373 self.query('''
374 DELETE events
375 FROM events
376 LEFT JOIN runs ON ev_run=rn_id
377 WHERE rn_id IS NULL''')
378
379 self.query('''
380 DELETE event_names
381 FROM event_names
382 LEFT JOIN events ON en_id=ev_event
383 WHERE ev_event IS NULL''')