Exemplo n.º 1
0
        void RunBenchmark(long runSetId, string benchmarkName, string machineName, string architecture)
        {
            const int DRY_RUNS   = 3;
            const int ITERATIONS = 10;


            Logging.GetLogging().InfoFormat("Benchmarker | hostname \"{0}\" architecture \"{1}\"", machineName, architecture);
            Logging.GetLogging().InfoFormat("Benchmarker | configname \"{0}\"", "default");

            models.Commit  mainCommit = DetermineCommit();
            models.Machine machine    = new models.Machine {
                Name = machineName, Architecture = architecture
            };
            models.Config config = new models.Config {
                Name        = "default", Mono = String.Empty,
                MonoOptions = new string[0],
                MonoEnvironmentVariables = new Dictionary <string, string> (),
                Count = ITERATIONS
            };
            models.RunSet runSet = AsyncContext.Run(() => models.RunSet.FromId(machine, runSetId, config, mainCommit, null, null, null /* TODO: logURL? */));

            if (runSet == null)
            {
                Logging.GetLogging().Warn("RunSetID " + runSetId + " not found");
                return;
            }
            new Task(() => {
                try {
                    for (var i = 0; i < (ITERATIONS + DRY_RUNS); i++)
                    {
                        var run = Iteration(benchmarkName, i, i < DRY_RUNS);
                        if (i >= DRY_RUNS)
                        {
                            runSet.Runs.Add(run);
                        }
                    }
                    var result = AsyncContext.Run(() => runSet.Upload());
                    if (result == null)
                    {
                        RunOnUiThread(() => SetStartButtonText("failed"));
                    }
                    else
                    {
                        RunOnUiThread(() => SetStartButtonText("start"));
                    }
                } catch (Exception e) {
                    RunOnUiThread(() => SetStartButtonText("failed"));
                    Logging.GetLogging().Error(e);
                } finally {
                    if (AndroidCPUManagment.IsRooted())
                    {
                        CpuManager.RestoreCPUStates();
                    }
                }
            }).Start();
        }
Exemplo n.º 2
0
		void RunBenchmark (long runSetId, string benchmarkName, string machineName, string architecture, string configName)
		{
			const int DRY_RUNS = 3;
			const int ITERATIONS = 10;
			bool cheat = configName.Equals ("cheat");
			models.RunSet runSet = null;

			if (cheat) {
				runSetId = 1;
			}

			if (!cheat) {
				Logging.GetLogging ().InfoFormat ("Benchmarker | hostname \"{0}\" architecture \"{1}\"" ,machineName ,architecture);
				Logging.GetLogging ().InfoFormat ("Benchmarker | configname \"{0}\"" ,"default");

				models.Commit mainCommit = DetermineCommit ();
				models.Machine machine = new models.Machine { Name = machineName ,Architecture = architecture };
				models.Config config = new models.Config {
					Name = configName ,
					Mono = String.Empty ,
					MonoOptions = new string[0] ,
					MonoEnvironmentVariables = new Dictionary<string ,string> () ,
					Count = ITERATIONS
				};
				runSet = AsyncContext.Run (() => models.RunSet.FromId (machine ,runSetId ,config ,mainCommit ,null ,null ,null /* TODO: logURL? */));
			}

			if (runSet == null && !cheat) {
				Logging.GetLogging ().Warn ("RunSetID " + runSetId + " not found");
				return;
			}
			new Task (() => {
				try {
					for (var i = 0; i < (ITERATIONS + DRY_RUNS); i++) {
						var run = Iteration (benchmarkName, i, i < DRY_RUNS);
						if (i >= DRY_RUNS && !cheat) {
							runSet.Runs.Add (run);
						}
					}
					if (!cheat) {
						var result = AsyncContext.Run (() => runSet.Upload ());
						RunOnUiThread (() => SetStartButtonText (result == null ? "failed" : "start"));
					} else {
						RunOnUiThread (() => SetStartButtonText ("start"));
					}
				} catch (Exception e) {
					RunOnUiThread (() => SetStartButtonText ("failed"));
					Logging.GetLogging ().Error (e);
				} finally {
					if (AndroidCPUManagment.IsRooted ()) {
						CpuManager.RestoreCPUStates ();
					}
				}
			}).Start ();
		}