Пример #1
0
    public IEnumerator GetRunStats(string runId, int runNumber, int incrementNumber, Action <RunStatistics> action)
    {
        var url = GetRunStatsUrl(runId);

        using (WWW www = new WWW(url))
        {
            yield return(www);

            if (string.IsNullOrEmpty(www.error) == true && string.IsNullOrEmpty(www.text) == false)
            {
                var runStats = new RunStatistics();
                var buffer   = "{\"data\":" + www.text + "}";
                //var runData = JsonUtility.FromJson<RunData>(buffer);
                var runData = JsonConvert.DeserializeObject <RunData>(buffer);

                var accumulator = 0.0;
                foreach (var row in runData.data)
                {
                    accumulator += row[2];
                }
                runStats.runId           = runId;
                runStats.runNumber       = runNumber;
                runStats.incrementNumber = incrementNumber;
                runStats.averageReward   = accumulator / (double)runData.data.Count;
                runStats.finalReward     = runData.data[runData.data.Count - 1][2];
                action(runStats);
            }
            else
            {
                Debug.Log("Failure getting stats for " + runId);
            }
        }
    }
Пример #2
0
        public MilkyManager()
        {
            KeyboardListener = KeyboardListener.GetOrNewInstance();

            ConsoleLoops    = ConsoleLoops.GetOrNewInstance();
            LoopsManager    = LoopsManager.GetOrNewInstance();
            StatisticsLoops = StatisticsLoops.GetOrNewInstance();

            OutputSettings = OutputSettings.GetOrNewInstance();

            ProgramInformations = ProgramInformations.GetOrNewInstance();
            ProgramManager      = ProgramManager.GetOrNewInstance();

            RunInformations = RunInformations.GetOrNewInstance();
            RunLists        = RunLists.GetOrNewInstance();
            RunManager      = RunManager.GetOrNewInstance();

            ConsoleSettings = ConsoleSettings.GetOrNewInstance();
            RunSettings     = RunSettings.GetOrNewInstance();

            CustomStatistics = CustomStatistics.GetOrNewInstance();
            RunStatistics    = RunStatistics.GetOrNewInstance();

            ConsoleUtils  = ConsoleUtils.GetOrNewInstance();
            DateTimeUtils = DateTimeUtils.GetOrNewInstance();
            FileUtils     = FileUtils.GetOrNewInstance();
            FormatUtils   = FormatUtils.GetOrNewInstance();
            HashUtils     = HashUtils.GetOrNewInstance();
            ListUtils     = ListUtils.GetOrNewInstance();
            RequestUtils  = RequestUtils.GetOrNewInstance();
            StringUtils   = StringUtils.GetOrNewInstance();
            UserUtils     = UserUtils.GetOrNewInstance();
        }
Пример #3
0
    void OnApplicationQuit()
    {
        positions.Add(origin.transform.position);

        var    now  = DateTime.Now;
        var    ts   = now - startTime;
        string file = Application.dataPath + "/Tests/" + now.ToString("s").Replace(':', '-') + ".json";

        Debug.Log("Outputting Run Statistics to " + file);

        var rs = new RunStatistics();

        rs.Date        = now.ToString("s");
        rs.UserName    = username;
        rs.TaskNum     = taskNum;
        rs.Environment = SceneManager.GetActiveScene().name.Split('_')[1];
        rs.TaskTime    = ts.TotalSeconds;
        if (particles != null)
        {
            rs.Particles = SerializableParticle.fromGOList(particles);
        }
        rs.UserPath = SerializableVector3.fromList(positions);

        string json = JsonUtility.ToJson(rs, true);

        Debug.Log(ts.TotalSeconds);
        File.WriteAllText(file, json);
    }
Пример #4
0
        public void StartExecution()
        {
            if (this.Statistics == null)
            {
                this.Statistics = new RunStatistics();
            }

            this.Statistics.ResetStatistics();
            this.Statistics.RecordsInRun = this.Context.SelectedRecordCount;

            this.Manager.AllThreadsCompleted += ManagerAllThreadsCompleted;
            this.Manager.RecordCompleted     += ManagerRecordCompleted;
            this.Manager.StartJobs();
        }
Пример #5
0
        public void StartRanPerMinuteLoop()
        {
            _runInformations = RunInformations.GetOrNewInstance();
            _runStatistics   = RunStatistics.GetOrNewInstance();
            _dateTimeUtils   = DateTimeUtils.GetOrNewInstance();

            Task.Run(() =>
            {
                while (_runInformations.runStatus != RunInformations.RunStatus.Finished)
                {
                    int ranBefore = _runInformations.ran;
                    Thread.Sleep(_dateTimeUtils.SecondsToMilliseconds(3));
                    int ranAfter = _runInformations.ran;

                    _runStatistics.ranPerMinute = (ranAfter - ranBefore) * 20;
                }
            });
        }
Пример #6
0
        /// <summary>
        /// Initialize modules
        /// </summary>
        public Manager(System.Action <Manager, ProgramManager, Console, Input, FileHelper, Tasker, Handler> execution)
        {
            // Initialize modules
            this.Program    = new ProgramManager(this);
            this.Console    = new Console(this);
            this.Input      = new Input(this);
            this.FileHelper = new FileHelper(this);
            this.Tasker     = new Tasker(this);
            this.Handler    = new Handler(this);

            // Not in method invocation
            this.RunStatistics     = new RunStatistics(this);
            this.ProgramStatistics = new ProgramStatistics(this);
            this.ProxyController   = new ProxyController(this);

            // Execution
            execution.Invoke(this, this.Program, this.Console, this.Input, this.FileHelper, this.Tasker, this.Handler);
        }
Пример #7
0
        public string FormatTitle(string text)
        {
            _programInformations = ProgramInformations.GetOrNewInstance();
            _runInformations     = RunInformations.GetOrNewInstance();
            _runLists            = RunLists.GetOrNewInstance();
            _runStatistics       = RunStatistics.GetOrNewInstance();
            _customStatistics    = CustomStatistics.GetOrNewInstance();
            _outputSettings      = OutputSettings.GetOrNewInstance();

            text = text
                   .Replace("%program.name%", _programInformations._name)
                   .Replace("%program.version%", _programInformations._version)
                   .Replace("%program.author%", _programInformations._author)

                   .Replace("%lists.combos%", _runLists.combos.Count.ToString())
                   .Replace("%lists.proxies%", _runLists.combos.Count.ToString())

                   .Replace("%run.ran%", _runInformations.ran.ToString())
                   .Replace("%run.remaining%", (_runLists.combos.Count - _runInformations.ran).ToString())
                   .Replace("%run.hits%", _runInformations.hits.ToString())
                   .Replace("%run.free%", _runInformations.free.ToString())

                   .Replace("%run.ran.percentage%", _runLists.combos.Count == 0 ? "0,00%" : ((double)_runInformations.ran / (double)_runLists.combos.Count).ToString("0.00%"))
                   .Replace("%run.hits.percentage%", _runInformations.ran == 0 ? "0,00%" : ((double)_runInformations.hits / (double)_runInformations.ran).ToString("0.00%"))
                   .Replace("%run.free.percentage%", _runInformations.hits == 0 ? "0,00%" : ((double)_runInformations.free / (double)_runInformations.hits).ToString("0.00%"))

                   .Replace("%statistics.rpm%", _runStatistics.ranPerMinute.ToString())
                   .Replace("%statistics.elapsed%", _runStatistics.GetElapsedTime())
                   .Replace("%statistics.estimated%", _runStatistics.GetEstimatedTime());

            lock (_customStatistics.customStatisticsLocker)
                foreach (var customStatistic in _customStatistics.customStatistics)
                {
                    text = text
                           .Replace($"%custom.{customStatistic.Key.Replace(" ", "_")}%", customStatistic.Value.ToString())
                           .Replace($"%custom.{customStatistic.Key.Replace(" ", "_")}.percentage%", customStatistic.Value == 0 ? "0,00%" : ((double)customStatistic.Value / (double)_runInformations.hits).ToString("0.00%"));
                }

            return(text);
        }
Пример #8
0
 // constructor
 public EnrichmentStatistics(int numberOfReads)
     : this()
 {
     RunStats = new RunStatistics(numberOfReads);
 }
Пример #9
0
        public static void Render(Area Area)
        {
            CheatWindow.Render();
            AreaDebug.Render(Area);
            DebugWindow.Render();

            imgui.LocaleEditor.Render();
            debug.PoolEditor.Render();
            state.ItemEditor.Render();
            RenderSettings();
            Lights.RenderDebug();
            SaveDebug.RenderDebug();
            LevelLayerDebug.Render();
            LootTableEditor.Render();
            assets.achievements.Achievements.RenderDebug();

            RunStatistics.RenderDebug();

            if (Rooms && ImGui.Begin("Rooms", ImGuiWindowFlags.AlwaysAutoResize))
            {
                var p = LocalPlayer.Locate(Area);

                if (p != null)
                {
                    var rm = p.GetComponent <RoomComponent>().Room;
                    var rn = new List <Room>();

                    foreach (var r in Area.Tagged[Tags.Room])
                    {
                        rn.Add((Room)r);
                    }

                    rn.Sort((a, b) => a.Type.CompareTo(b.Type));

                    foreach (var r in rn)
                    {
                        var v = rm == r;

                        if (ImGui.Selectable($"{r.Type}#{r.Y}", ref v) && v)
                        {
                            p.Center = r.Center;
                        }
                    }
                }

                ImGui.End();
            }

            ImGui.SetNextWindowPos(new Vector2(Engine.Instance.GetScreenWidth() - size.X - 10, Engine.Instance.GetScreenHeight() - size.Y - 10));
            ImGui.Begin("Windows", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar);

            if (ImGui.Button("Hide"))
            {
                Debug = Entities = RunInfo = Console = ItemEditor = LevelEditor = LocaleEditor = Rooms = Settings = PoolEditor = LootTable = false;
            }

            ImGui.SameLine();

            if (ImGui.Button("Show"))
            {
                Debug = Entities = RunInfo = Console = ItemEditor = LevelEditor = LocaleEditor = Rooms = Settings = PoolEditor = LootTable = true;
            }

            ImGui.Separator();

            ImGui.Checkbox("Cheats", ref Cheats);
            ImGui.Checkbox("Entities", ref Entities);
            ImGui.Checkbox("Run Info", ref RunInfo);
            ImGui.Checkbox("Console", ref Console);
            ImGui.Checkbox("Item Editor", ref ItemEditor);
            ImGui.Checkbox("Level Editor", ref LevelEditor);
            ImGui.Checkbox("Layer Debug", ref LayerDebug);
            ImGui.Checkbox("Locale Editor", ref LocaleEditor);
            ImGui.Checkbox("Debug", ref Debug);
            ImGui.Checkbox("Rooms", ref Rooms);
            ImGui.Checkbox("Settings", ref Settings);
            ImGui.Checkbox("Lighting", ref Lighting);
            ImGui.Checkbox("Achievements", ref Achievements);
            ImGui.Checkbox("Save", ref Save);
            ImGui.Checkbox("Pool Editor", ref PoolEditor);
            ImGui.Checkbox("Loot Table Editor", ref LootTable);

            size = ImGui.GetWindowSize();
            ImGui.End();
        }
Пример #10
0
 void AddToStats(RunStatistics stats)
 {
     RunStats.Add(stats);
 }
Пример #11
0
 public MethylSeqStatistics(int numberOfReads)
 {
     RunStats = new RunStatistics(numberOfReads);
 }