[LNT] r235587 - [LNT] Add a 'score' sample type

James Molloy james.molloy at arm.com
Thu Apr 23 05:19:06 PDT 2015


Author: jamesm
Date: Thu Apr 23 07:19:05 2015
New Revision: 235587

URL: http://llvm.org/viewvc/llvm-project?rev=235587&view=rev
Log:
[LNT] Add a 'score' sample type

This is intended for benchmarks that report some bigger-is-better metric,
like Geekbench's "score" or "iterations per second".

Added:
    lnt/trunk/lnt/server/db/migrations/upgrade_4_to_5.py
Modified:
    lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt.db
    lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py

Added: lnt/trunk/lnt/server/db/migrations/upgrade_4_to_5.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_4_to_5.py?rev=235587&view=auto
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_4_to_5.py (added)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_4_to_5.py Thu Apr 23 07:19:05 2015
@@ -0,0 +1,47 @@
+# Version 5 adds a "score" Sample type.
+
+import os
+import sys
+
+import sqlalchemy
+from sqlalchemy import *
+
+###
+# Upgrade TestSuite
+
+# Import the original schema from upgrade_0_to_1 since upgrade_4_to_5 does not
+# change the actual schema.
+import lnt.server.db.migrations.upgrade_0_to_1 as upgrade_0_to_1
+
+def upgrade(engine):
+    # Create a session.
+    session = sqlalchemy.orm.sessionmaker(engine)()
+
+    real_sample_type = session.query(upgrade_0_to_1.SampleType).\
+        filter_by(name = "Real").first()
+
+    ts = session.query(upgrade_0_to_1.TestSuite).filter_by(name='nts').first()
+    score = upgrade_0_to_1.SampleField(name="score", type=real_sample_type,
+                                       info_key=".score",)
+    ts.sample_fields.append(score)
+    session.add(ts)
+
+    session.commit()
+    # upgrade_3_to_4.py added this column, so it is not in the ORM.
+    session.connection().execute("""
+UPDATE TestSuiteSampleFields
+SET bigger_is_better=1
+WHERE name='score'
+                                 """)
+    session.commit()
+
+    # FIXME: This is obviously not the right way to do this, but I gave up
+    # trying to find out how to do it properly in SQLAlchemy without
+    # SQLAlchemy-migrate installed.
+    session.connection().execute("""
+ALTER TABLE NT_Sample
+ADD COLUMN score FLOAT
+""")
+    session.commit()
+
+    

Modified: lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt.db
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt.db?rev=235587&r1=235586&r2=235587&view=diff
==============================================================================
Binary files lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt.db (original) and lnt/trunk/tests/SharedInputs/SmallInstance/data/lnt.db Thu Apr 23 07:19:05 2015 differ

Modified: lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py?rev=235587&r1=235586&r2=235587&view=diff
==============================================================================
--- lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py (original)
+++ lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py Thu Apr 23 07:19:05 2015
@@ -30,6 +30,7 @@ run = ts_db.Run(machine, order, start_ti
 test = ts_db.Test("test-a")
 sample = ts_db.Sample(run, test)
 sample.compile_time = 1.0
+sample.score = 4.2
 
 # Add and commit.
 ts_db.add(machine)
@@ -79,3 +80,4 @@ assert test.name == "test-a"
 assert sample.run is run
 assert sample.test is test
 assert sample.compile_time == 1.0
+assert sample.score == 4.2





More information about the llvm-commits mailing list