Exemplo n.º 1
0
 public bool FilterByRetentionTime()
 {
     // Now that we have times loaded, apply explicit RT filter if any
     if (ExplicitRetentionTime != null)
     {
         double explicitRT = ExplicitRetentionTime.RetentionTime;
         for (var i = DataSets.Count - 1; i >= 0; i--)
         {
             var dataSet = DataSets[i];
             if (explicitRT < dataSet.MinRawTime || dataSet.MaxRawTime < explicitRT)
             {
                 DataSets.RemoveAt(i);
             }
             else
             {
                 for (var j = dataSet.Chromatograms.Count - 1; j >= 0; j--)
                 {
                     var chrom = dataSet.Chromatograms[j];
                     if (explicitRT < chrom.Times.First() || chrom.Times.Last() < explicitRT)
                     {
                         dataSet.Chromatograms.RemoveAt(j);
                     }
                 }
             }
         }
     }
     return(DataSets.Any());
 }
Exemplo n.º 2
0
 private bool HasEquivalentGroupNode(TransitionGroupDocNode nodeGroup)
 {
     return(DataSets.Any(d => AreEquivalentGroupNodes(d.NodeGroup, nodeGroup)));
 }
Exemplo n.º 3
0
        internal DataFile Construct(string FilePath)
        {
            this.Name     = Path.GetFileName(FilePath);
            this.DataSets = new HashSet <DataSet>();
            var RawLines = File.ReadAllLines(FilePath);
            var LockThis = new object();

            this.IsALog = false;
            if (FilePath.EndsWith("HandleServer.dll.log", StringComparison.InvariantCultureIgnoreCase))
            {
                this.IsALog = true;
                var DataSetNames = new string[10] {
                    "GetObjectsToDelete", "GetCivData", "GetCivCacheData", "CountEnemyInArea", "CountPlayerInArea", "AddObjectToDelete", "AddObjectsData", "DeleteObjects", "AddCivWayPos", "AssignCivNames"
                };
                Parallel.ForEach(DataSetNames, new ParallelOptions {
                    MaxDegreeOfParallelism = DataSetNames.Length
                }, CurDataSetName =>
                {
                    var CurDataSet = new DataSet(CurDataSetName);
                    lock (LockThis)
                    {
                        DataSets.Add(CurDataSet);
                    }
                    double CurValue;
                    for (int i2 = 0; i2 < RawLines.Length; i2++)
                    {
                        CurValue = GetValue(RawLines[i2], CurDataSetName, ": ", "ms", 0);
                        if (CurValue > -1)
                        {
                            CurDataSet.DataValues.Add(CurValue);
                        }
                    }
                    if (CurDataSet.DataValues.Count > 0)
                    {
                        CurDataSet.AVGValue = Math.Round(CurDataSet.DataValues.Average(), 3, MidpointRounding.AwayFromZero);
                        CurDataSet.MaxValue = CurDataSet.DataValues.Max();
                    }
                    if (CurDataSet.MaxValue == 0)
                    {
                        DataSets.Remove(CurDataSet);
                    }
                });
            }
            else if (FilePath.EndsWith("HandleServer_Standalone.Perf.log", StringComparison.InvariantCultureIgnoreCase))
            {
                var DataSetNames = new HashSet <DataSetName>();
                DataSetNames.Add(new DataSetName("Durchschnittlich gecached", "(", "%)", 2));
                DataSetNames.Add(new DataSetName("Durchschnittlich nicht gecached", "(", "%)", 3));
                DataSetNames.Add(new DataSetName("Empfangene Datenmenge", " ", "MB", 2));
                DataSetNames.Add(new DataSetName("Gesendete Datenmenge", " ", "MB", 3));
                DataSetNames.Add(new DataSetName("Bandbreite", "AVG Bandwidth: ", "Kbit/s", 0));
                Parallel.ForEach(DataSetNames, new ParallelOptions {
                    MaxDegreeOfParallelism = DataSetNames.Count
                }, CurDataSetName =>
                {
                    var CurDataSet = new DataSet(CurDataSetName.Name);
                    lock (LockThis)
                    {
                        DataSets.Add(CurDataSet);
                    }
                    double CurValue;
                    for (int i2 = 0; i2 < RawLines.Length; i2++)
                    {
                        CurValue = GetValue(RawLines[i2], CurDataSetName.SecondCut, CurDataSetName.FirstCut, CurDataSetName.SecondCut, CurDataSetName.CutType);
                        if (CurValue > -1)
                        {
                            CurDataSet.DataValues.Add(CurValue);
                        }
                    }
                    if (CurDataSet.DataValues.Count > 0)
                    {
                        CurDataSet.AVGValue = Math.Round(CurDataSet.DataValues.Average(), 3, MidpointRounding.AwayFromZero);
                        CurDataSet.MaxValue = CurDataSet.DataValues.Max();
                    }
                    if (CurDataSet.MaxValue == 0)
                    {
                        DataSets.Remove(CurDataSet);
                    }
                });
            }
            else if (FilePath.EndsWith(".rpt", StringComparison.InvariantCultureIgnoreCase))
            {
                var DataSetNames = new HashSet <DataSetName>();
                DataSetNames.Add(new DataSetName("Einheiten", "Einheiten: ", " DavonLokalOhne", 0));
                DataSetNames.Add(new DataSetName("Lokale Einheiten (Keine Zivilisten)", " DavonLokalOhneZivs: ", " Spieler: ", 0));
                DataSetNames.Add(new DataSetName("Lokale Einheiten", " DavonLokal: ", " Spieler: ", 0));
                DataSetNames.Add(new DataSetName("Spieler", " Spieler: ", " Objekte: ", 0));
                DataSetNames.Add(new DataSetName("Objekte", " Objekte: ", " FPS: ", 0));
                DataSetNames.Add(new DataSetName("FPS", " FPS: ", " Schleifen: ", 0));
                DataSetNames.Add(new DataSetName("Schleifen", " Schleifen: ", " Skripte: ", 0));
                DataSetNames.Add(new DataSetName("Skriptthreads", " Skripte: [", "]", 1));
                Parallel.ForEach(DataSetNames, new ParallelOptions {
                    MaxDegreeOfParallelism = DataSetNames.Count
                }, CurDataSetName =>
                {
                    var CurDataSet = new DataSet(CurDataSetName.Name);
                    lock (LockThis)
                    {
                        DataSets.Add(CurDataSet);
                    }
                    double CurValue;
                    for (int i2 = 0; i2 < RawLines.Length; i2++)
                    {
                        CurValue = GetValue(RawLines[i2], CurDataSetName.FirstCut, CurDataSetName.FirstCut, CurDataSetName.SecondCut, CurDataSetName.CutType);
                        if (CurValue > -1)
                        {
                            CurDataSet.DataValues.Add(CurValue);
                        }
                    }
                    if (CurDataSet.DataValues.Count > 0)
                    {
                        CurDataSet.AVGValue = Math.Round(CurDataSet.DataValues.Average(), 3, MidpointRounding.AwayFromZero);
                        CurDataSet.MaxValue = CurDataSet.DataValues.Max();
                    }
                    if (CurDataSet.MaxValue == 0)
                    {
                        DataSets.Remove(CurDataSet);
                    }
                });
                if ((DataSets.Any(i => i.Name.Equals("Skriptthreads"))) && (DataSets.Any(i => i.Name.Equals("FPS"))))
                {
                    var CurCustomDataSet = new DataSet("Rechenzeit(ms) pro Skriptthread & Sekunde");
                    DataSets.Add(CurCustomDataSet);
                    var FPSSet     = DataSets.First(i => i.Name.Equals("FPS"));
                    var ThreadsSet = DataSets.First(i => i.Name.Equals("Skriptthreads"));
                    Parallel.For(0, FPSSet.DataValues.Count, new ParallelOptions {
                        MaxDegreeOfParallelism = FPSSet.DataValues.Count
                    }, i =>
                    {
                        if ((ThreadsSet.DataValues.Count > i) && (FPSSet.DataValues[i] > 0) && (ThreadsSet.DataValues[i] > 0))
                        {
                            lock (LockThis)
                            {
                                CurCustomDataSet.DataValues.Add(Math.Round((FPSSet.DataValues[i] * 3) / ThreadsSet.DataValues[i], 1, MidpointRounding.AwayFromZero));
                            }
                        }
                    });
                    CurCustomDataSet.AVGValue = Math.Round(CurCustomDataSet.DataValues.Average(), 3, MidpointRounding.AwayFromZero);
                    CurCustomDataSet.MaxValue = CurCustomDataSet.DataValues.Max();
                    if (CurCustomDataSet.MaxValue == 0)
                    {
                        DataSets.Remove(CurCustomDataSet);
                    }
                }
            }
            return(this);
        }