예제 #1
0
 public void PrintPerformance(SRKStringBuilder sb)
 {
     sb.AppendLine($"Avg Runtime = {AverageRuntime:0.0000}ms   ({AverageRuntime * invMaxRuntimePercent:0.00}%)");
     sb.AppendLine($"Peak Runtime = {PeakRuntime:0.0000}ms\n");
     sb.AppendLine($"Avg Complexity = {AverageComplexity:0.00}   ({AverageComplexity * invMaxInstCountPercent:0.00}%)");
     sb.AppendLine($"Peak Complexity = {PeakComplexity:0.00}");
 }
예제 #2
0
 public void PrintSectionBreakdown(SRKStringBuilder sb)
 {
     foreach (KeyValuePair <string, SectionValues> entry in AverageBreakdown)
     {
         double runtime = entry.Value.AccumulatedRuntime / entry.Value.AccumulatedCount;
         sb.AppendLine($"{entry.Key} = {runtime:0.0000}ms");
     }
 }
예제 #3
0
            public string Serialize()
            {
                SRKStringBuilder builder = new SRKStringBuilder();

                builder.Append($"{name}{{");
                for (int i = 0; i < subMenues.Count; i++)
                {
                    string v = subMenues[i].Serialize();
                    builder.Append($"{{{v.Length.ToString()}}}{v}");
                }
                builder.Append($"}}{remoteCommand}");
                return(builder.ToString());
            }
 public void GetOutput(SRKStringBuilder builder)
 {
     for (int i = 0; i < LogLines.Length; ++i)
     {
         if (i == LogIndex)
         {
             builder.AppendLine("==== WRAP ====");
         }
         else
         {
             builder.AppendLine(LogLines[i]);
         }
     }
 }
        public string JoinArguments(SRKStringBuilder builder, int start, int end)
        {
            builder.Clear();
            int termination = Math.Max(ArgumentCount - 1, end);

            for (int i = start; i <= termination; ++i)
            {
                builder.Append(myCommandLine.Items[i]);
                if (i != termination)
                {
                    builder.Append(' ');
                }
            }
            return(builder.ToString());
        }
        public string SerializeManager()
        {
            SRKStringBuilder saveBuilder = new SRKStringBuilder();

            // Save my settings here

            // Save subsystem settings here
            saveBuilder.AppendLine(Subsystems.Count().ToString());
            foreach (KeyValuePair <string, ISubsystem> kvp in Subsystems)
            {
                string subsystemSave = kvp.Value.SerializeSubsystem();
                int    lns           = subsystemSave.Split(
                    new[] { "\r\n", "\r", "\n" },
                    StringSplitOptions.None
                    ).Count();

                saveBuilder.AppendLine($"{kvp.Key} {lns.ToString()}");
                saveBuilder.AppendLine(subsystemSave);
            }

            return(saveBuilder.ToString());
        }
        public void DeserializeManager(string serialized)
        {
            try
            {
                var loadBuilder = new SRKStringBuilder();
                var reader      = new MyStringReader(serialized);

                loadBuilder.Clear();

                // Load subsystem settings here
                int numSubsystems = int.Parse(reader.NextLine());


                for (int i = 0; i < numSubsystems; i++)
                {
                    string[] header = reader.NextLine().Split(' ');
                    string   name   = header[0];

                    int numLines = int.Parse(header[1]);

                    for (int j = 0; j < numLines; j++)
                    {
                        loadBuilder.AppendLine(reader.NextLine());
                    }

                    if (Subsystems.ContainsKey(name))
                    {
                        Subsystems[name].DeserializeSubsystem(loadBuilder.ToString());
                    }

                    loadBuilder.Clear();
                }
            }
            catch (Exception exc)
            {
                ExceptionBuilder.AppendLine(exc.StackTrace);
            }
        }
예제 #8
0
        void MySave(SRKStringBuilder builder)
        {
            builder.AppendLine(currentState.ToString());

            builder.AppendLine(tag);
        }