Beispiel #1
0
        /// <summary>
        /// Обновляет вывод связанный с Icdfa
        /// </summary>
        private void UpdateIcdfaOutput()
        {
            if (CurrentIcdfaLogic == null)
            {
                throw new InvalidProgramException();
            }

            StringBuilder.Clear();                                          //Юзам StringBuilder для экономии памяти и времени cpu
            var array = CurrentIcdfaLogic.GetTotalLenghts();                //Суммируем все части

            var deltaTime = DateTime.UtcNow - CurrentIcdfaLogic.LaunchTime; //Получаем время работы

            int?totalCount = GetTotalCount();

            StringBuilder.Append(GetDeltaTime(deltaTime));
            StringBuilder.Append("\n");

            if (totalCount.HasValue)
            {
                var totalParts = CurrentIcdfaLogic.TotalParts;
                var countParts = CurrentIcdfaLogic.CountParts;

                totalCount = (int)Math.Round(totalCount.Value * (countParts / (double)totalParts));

                var currentCount = CurrentIcdfaLogic.GetCurrentCount();
                var progress     = currentCount / (float)totalCount.Value;

                StringBuilder.Append(GetRemainedTime(deltaTime, totalCount.Value, progress));
                StringBuilder.Append("\n");

                StringBuilder.Append(GetCurrentCountOfTotalCount(currentCount, totalCount.Value));
                StringBuilder.Append("\n");

                StringBuilder.Append(GetProgress(progress));
                StringBuilder.Append("\n");

                //StringBuilder.Append(GetTransactionPerSecond(deltaTime,currentCount));
                //StringBuilder.Append("\n");

                StringBuilder.Append(GetGCCallsPerSecond(deltaTime, GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2)));
                StringBuilder.Append("\n");
            }
            else
            {
                StringBuilder.Append("<Calculating additional information...>");
                StringBuilder.Append("\n");
            }

            for (int i = 0; i < array.Length; i++)
            {
                StringBuilder.Append("\n");
                StringBuilder.Append(i.ToString("D2"));
                StringBuilder.Append(" - ");
                StringBuilder.Append(array[i].ToString());
            }

            richTextBoxIcdfaOutput.Text = StringBuilder.ToString();
        }
Beispiel #2
0
        /// <summary>
        /// Обновляет вывод связанный с Icdfa
        /// </summary>
        private void UpdateIcdfaOutput()
        {
            if (CurrentIcdfaLogic == null)
            {
                throw new InvalidProgramException();
            }

            StringBuilder.Clear();                                          //Юзам StringBuilder для экономии памяти и времени cpu
            var array = CurrentIcdfaLogic.GetTotalLenghts();                //Суммируем все части

            var deltaTime = DateTime.UtcNow - CurrentIcdfaLogic.LaunchTime; //Получаем время работы

            ulong?totalCount = IcdfaHelper.GetTotalCountNullable(CurrentIcdfaLogic.N, CurrentIcdfaLogic.K);

            StringBuilder.Append(GetDeltaTime(deltaTime));
            StringBuilder.Append("\n");

            if (totalCount.HasValue)
            {
                var totalParts = CurrentIcdfaLogic.TotalParts;
                var countParts = CurrentIcdfaLogic.CountParts;

                var totalPartCount = (ulong)Math.Round(totalCount.Value * (countParts / (double)totalParts));

                var currentCount = CurrentIcdfaLogic.GetCurrentCount();
                var progress     = currentCount / (float)totalPartCount;

                progressBar1.Style = ProgressBarStyle.Blocks;
                progressBar1.Value = Convert.ToInt32(Math.Round(progress * 1000, 1));

                StringBuilder.Append(GetRemainedTime(deltaTime, totalPartCount, progress));
                StringBuilder.Append("\n");

                StringBuilder.Append(GetCurrentCountOfTotalCount(currentCount, totalPartCount, totalCount.Value));
                StringBuilder.Append("\n");

                StringBuilder.Append(GetProgress(progress));
                //StringBuilder.Append("\n");

                //StringBuilder.Append(GetTransactionPerSecond(deltaTime,currentCount));
                //StringBuilder.Append("\n");

                //StringBuilder.Append(GetGCCallsPerSecond(deltaTime, GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2)));
                //StringBuilder.Append("\n");
            }
            else
            {
                StringBuilder.Append("<Calculating additional information...>");
                StringBuilder.Append("\n");
            }
            chartICDFA.Series[0].Points.Clear();
            for (int i = 1; i < array.Length; i++)
            {
                //StringBuilder.Append("\n");
                //StringBuilder.Append(i.ToString("D2"));
                //StringBuilder.Append(" - ");
                //StringBuilder.Append(array[i].ToString());

                chartICDFA.Series[0].Points.Add(array[i], i);
            }
            if (chartICDFA.Series[0].Points.Count >= 25)
            {
                chartICDFA.Series[0].Points[chartICDFA.Series[0].Points.Count - 2].LabelBackColor = Color.LimeGreen;
            }
            chartICDFA.Update();
            chartICDFA.Series.Invalidate();

            richTextBoxIcdfaOutput.Text = StringBuilder.ToString();
        }