public override bool IsDataExists(ProcessedDataPackage state) { PerformanceDumpFilesInfo pdfi = new PerformanceDumpFilesInfo(state); if (String.IsNullOrEmpty(pdfi.GetFullPath())) { return(false); } FileInfo fi = new FileInfo(pdfi.GetFullPath()); return(fi.Exists && fi.Length > 0); }
public override PerformanceData GetProcessedData(ProcessedDataPackage state) { PerformanceDumpFilesInfo pdfi = new PerformanceDumpFilesInfo(state); PerformanceData performanceData = new PerformanceData(); Stream s = pdfi.Open(FileAccess.Read); if (s == null) { return(performanceData); } StreamReader source = new StreamReader(s); performanceData.PerformanceDumpFilename = pdfi.GetFilename(); String buffer = source.ReadToEnd(); source.Close(); source.Dispose(); MatchCollection matchs = performance_Dump_Pattern.Matches(buffer); Match match = null; for (int i = 0; i < matchs.Count; i++) { match = matchs[i]; if (match.Success) { performanceData.AddLast(GetNewPerformanceState( state, performanceData, match.Groups[1].Value, match.Groups[2].Value, match.Groups[3].Value, match.Groups[4].Value, match.Groups[5].Value)); } } FixAvg(performanceData); return(performanceData); }
private void StopPerformanceTracking(string cmdId, string args) { lock (performanceTrackerLock) { if (performanceTracker == null) { return; } if (this.StartInfo == null || args == null) { return; } Stream outs = null; try { outs = new PerformanceDumpFilesInfo(this.StartInfo).Open(FileAccess.Write); } catch { } try{ performanceTracker.StopTracking(outs); }catch { } try { performanceTracker.Dispose(); performanceTracker = null; } catch { } } }