Beispiel #1
0
		public ResultDbEntry (IDataReader reader, int index, ItemDbEntry item, PassDbEntry pass)
		{
			id = Convert.ToInt32 (reader [0 + index]);
			Item = item;
			Pass = pass;
			Time = Convert.ToInt64 ((string) reader [3 + index]);
		}
Beispiel #2
0
        public static List <ResultDbEntry> GetResultEntriesForItemEntry(ItemDbEntry item, int limit)
        {
            IDbCommand cmd = connection.CreateCommand();

            cmd.CommandText = (String.Format("SELECT results.id, results.item_id, results.pass_id, results.time, passes.id, passes.short_name, passes.author, passes.changelog, passes.date " +
                                             "FROM results, passes " +
                                             "WHERE results.pass_id = passes.id AND results.item_id = :it " +
                                             "ORDER BY passes.date DESC " +
                                             "LIMIT {0}", limit));

            IDataParameter p1 = cmd.CreateParameter();

            p1.ParameterName = ":it";
            p1.Value         = item.Id.ToString();
            cmd.Parameters.Add(p1);

            IDataReader          reader = cmd.ExecuteReader();
            List <ResultDbEntry> list   = new List <ResultDbEntry> ();

            while (reader.Read())
            {
                PassDbEntry pass = new PassDbEntry(reader, 4);
                list.Add(new ResultDbEntry(reader, 0, item, pass));
            }

            return(list);
        }
Beispiel #3
0
 public ResultDbEntry(IDataReader reader, int index, ItemDbEntry item, PassDbEntry pass)
 {
     id   = Convert.ToInt32(reader [0 + index]);
     Item = item;
     Pass = pass;
     Time = Convert.ToInt64((string)reader [3 + index]);
 }
Beispiel #4
0
		public static int AllTestsMode (Options opts)
		{
			Console.WriteLine ("*** Pass name is '{0}'...", opts.ShortName);

			Database.Initialize (opts.DatabaseFile);
			Database.BeginTransaction ();

			PassDbEntry passEntry = new PassDbEntry ();
			passEntry.ShortName = opts.ShortName;
			passEntry.Author = opts.Author;
			passEntry.ChangeLog = opts.ChangeLog;
			passEntry.Date = DateTime.Now;

			Database.Put (passEntry);

			DrtStore store = new DrtStore ("perf-suite-set/drtlist.xml");
			foreach (DrtItem item in store.Items) {
				Console.WriteLine ("*** Running [{0}]", item);

				ItemDbEntry itemEntry = Database.GetItemEntryByUniqueId (item.UniqueId);
				if (itemEntry == null) {
					Console.WriteLine ("*** [{0}] not yet in the database, adding...", item);
					itemEntry = new ItemDbEntry ();
					itemEntry.UniqueId = item.UniqueId;
					itemEntry.Name = item.Name;
					itemEntry.InputFile = item.InputFile;
					Database.Put (itemEntry);
				}
			
				DrtResult r = item.Run ();
				
				ResultDbEntry resultEntry = new ResultDbEntry ();
				resultEntry.Pass = passEntry;
				resultEntry.Item = itemEntry;

				if (r == null) {
					resultEntry.Time = 0;
					Console.WriteLine ("*** Averaged result: 0 (FAILURE)");
				} else {
					resultEntry.Time = r.AveragedTime;
					Console.WriteLine ("*** Averaged result: {0}usec", r.AveragedTime);
				}
				
				Database.Put (resultEntry);
			}

			Database.CommitTransaction ();

			return 0;

		}
Beispiel #5
0
		public static List <ResultDbEntry> GetResultEntriesForItemEntry (ItemDbEntry item, int limit)
		{
			IDbCommand cmd = connection.CreateCommand ();
			
			cmd.CommandText = (String.Format ("SELECT results.id, results.item_id, results.pass_id, results.time, passes.id, passes.short_name, passes.author, passes.changelog, passes.date " + 
					   "FROM results, passes " + 
					   "WHERE results.pass_id = passes.id AND results.item_id = :it " + 
					   "ORDER BY passes.date DESC " + 
					   "LIMIT {0}", limit));

			IDataParameter p1 = cmd.CreateParameter ();
			p1.ParameterName = ":it";
			p1.Value = item.Id.ToString ();
			cmd.Parameters.Add (p1);

			IDataReader reader = cmd.ExecuteReader ();
			List <ResultDbEntry> list = new List <ResultDbEntry> ();

			while (reader.Read ()) {
				PassDbEntry pass = new PassDbEntry (reader, 4);
				list.Add (new ResultDbEntry (reader, 0, item, pass));
			}

			return list;
		}