コード例 #1
0
ファイル: PerfSuiteRunner.cs プロジェクト: ynkbt/moon
        public static int SingleTestMode(Options opts)
        {
            Console.WriteLine("*** Running single test with id '{0}' not storing results in database...", opts.TestId);

            DrtStore store = new DrtStore("perf-suite-set/drtlist.xml");
            DrtItem  item  = store.GetDrtItemForId(opts.TestId);

            if (item == null)
            {
                Console.WriteLine("*** Test '{0}' not found!", opts.TestId);
                return(128);
            }

            Console.WriteLine("*** Running [{0}]", item);

            DrtResult r = item.Run();

            ResultDbEntry resultEntry = new ResultDbEntry();

            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);
            }

            return(0);
        }
コード例 #2
0
ファイル: PerfSuiteRunner.cs プロジェクト: ynkbt/moon
        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);
        }
コード例 #3
0
ファイル: DrtItem.cs プロジェクト: ynkbt/moon
        public DrtResult Run()
        {
            DrtResult result = null;
            Process   proc   = new Process();

            try {
                string tmpFileName = Path.GetTempFileName();

                string arguments = String.Format("-f \"{0}\" -s \"{1}\" -e \"{2}\" -i \"{3}\" -n \"{4}\" -r \"{5}\" -t \"{6}\" -w \"{7}\" -h \"{8}\"",
                                                 FullFileName,
                                                 StartTime,
                                                 EndTime,
                                                 Interval,
                                                 Runs,
                                                 tmpFileName,
                                                 Timeout,
                                                 Width,
                                                 Height);

                proc.EnableRaisingEvents = false;
                proc.StartInfo.FileName  = "perf-tool";
                proc.StartInfo.Arguments = arguments;
                proc.Start();
                proc.WaitForExit();

                if (proc.ExitCode == 0)
                {
                    result = new DrtResult(tmpFileName);
                }
            } catch {
                result = null;
            } finally {
                proc.Close();
                proc.Dispose();
            }

            return(result);
        }
コード例 #4
0
ファイル: DrtItem.cs プロジェクト: dfr0/moon
		public DrtResult Run ()
		{
			DrtResult result = null;
			Process proc = new Process ();

			try {
				string tmpFileName = Path.GetTempFileName ();

				string arguments = String.Format ("-f \"{0}\" -s \"{1}\" -e \"{2}\" -i \"{3}\" -n \"{4}\" -r \"{5}\" -t \"{6}\" -w \"{7}\" -h \"{8}\"", 
								  FullFileName, 
								  StartTime, 
								  EndTime, 
								  Interval, 
								  Runs, 
							 	  tmpFileName, 
								  Timeout, 
								  Width, 
								  Height);

				proc.EnableRaisingEvents = false; 
				proc.StartInfo.FileName = "perf-tool";
				proc.StartInfo.Arguments = arguments;
				proc.Start();
				proc.WaitForExit();

				if (proc.ExitCode == 0)
					result = new DrtResult (tmpFileName);
			} catch {
				result = null;
			} finally {
				proc.Close ();
				proc.Dispose ();
			}

			return result;
		}