static public CSVThread NewDefault(string aThreadName) { CSVThread ret = new CSVThread(); ret.iThreadName = aThreadName; ret.iIsDefault = true; return(ret); }
public void CompareThread(CSVThread aThread1, CSVThread aThread2) { // Do comparison iComparerHeapSize.Compare(aThread1, aThread2); iComparerCellCounts.Compare(aThread1, aThread2); iComparerLargestCells.Compare(aThread1, aThread2); iComparerFragmentation.Compare(aThread1, aThread2); iComparerSlackSpace.Compare(aThread1, aThread2); }
public void Export(CSVDataSet aSet) { int count = aSet.Count; for (int i = 0; i < count; i++) { CSVThread thread = aSet[i]; // find row if (iThreadMap.ContainsKey(thread.ThreadId)) { TThreadMapEntry entry = iThreadMap[thread.ThreadId]; Utils.SetValue(entry.iRowIndex, iColumnCounter, iSheetChunkSize, thread.SizeCurrent.ToString()); Utils.SetValue(entry.iRowIndex, iColumnCounter, iSheetAlloc, thread.AllocSpaceTotal.ToString()); Utils.SetValue(entry.iRowIndex, iColumnCounter, iSheetFree, thread.FreeSpaceTotal.ToString()); // Update stats ++entry.iNumberOfMatchingDataSets; // Min & max for each type entry.iRangeChunk.UpdateMin(thread.SizeCurrent); entry.iRangeChunk.UpdateMax(thread.SizeCurrent); entry.iRangeAlloc.UpdateMin(thread.AllocSpaceTotal); entry.iRangeAlloc.UpdateMax(thread.AllocSpaceTotal); entry.iRangeFree.UpdateMin(thread.FreeSpaceTotal); entry.iRangeFree.UpdateMax(thread.FreeSpaceTotal); // Delta for each type long deltaChunk = entry.iLastChunk > 0 ? (thread.SizeCurrent - entry.iLastChunk) : 0; long deltaAlloc = entry.iLastAlloc > 0 ? (thread.AllocSpaceTotal - entry.iLastAlloc) : 0; long deltaFree = entry.iLastFree > 0 ? (thread.FreeSpaceTotal - entry.iLastFree) : 0; entry.iDeltaChunk += deltaChunk; entry.iDeltaAlloc += deltaAlloc; entry.iDeltaFree += deltaFree; // Net effect entry.iNetEffectChunk += CSVExcelExporterAllDataSets.NetEffectForDelta(deltaChunk); entry.iNetEffectAlloc += CSVExcelExporterAllDataSets.NetEffectForDelta(deltaAlloc); entry.iNetEffectFree += CSVExcelExporterAllDataSets.NetEffectForDelta(deltaFree); // Update last values entry.iLastChunk = thread.SizeCurrent; entry.iLastAlloc = thread.AllocSpaceTotal; entry.iLastFree = thread.FreeSpaceTotal; } else { throw new Exception("Cannot find thread entry for thread named: " + thread.ThreadName); } } ++iColumnCounter; }
public void AddThreadWithCommonHeapChunkHandle(CSVThread aOtherThread) { if (aOtherThread != this) { if (iThreadsWithCommonHeapChunk == null) { iThreadsWithCommonHeapChunk = new List <CSVThread>(); } iThreadsWithCommonHeapChunk.Add(aOtherThread); } }
public CSVThread ParseLine(string aLine) { CSVThread ret = iParserNew.ParseLine(aLine); // if (ret == null) { ret = iParserOld.ParseLine(aLine); } // return(ret); }
private void AddThreadsToList(CSVDataSet aSet, SortedDictionary <long, string> aList) { int count = aSet.Count; for (int i = count - 1; i >= 0; i--) { CSVThread master = aSet[i]; if (aList.ContainsKey(master.ThreadId) == false) { aList.Add(master.ThreadId, master.FullName); } } }
protected override void HandleFilteredLine(string aLine) { string originalLine = aLine; iCleaner.CleanLine(ref aLine); // Strip prefix if (CheckForKnownElement(ref aLine, KRDebugPrefixes)) { } // Main handler if (CheckForKnownElement(ref aLine, KMarkerEnd)) { // Finished an item - forced flush if (iCurrentDataSet != null) { iStorage.Add(iCurrentDataSet); } iCurrentDataSet = new CSVDataSet(base.FileName, base.LineNumber); iParser.CurrentDataSet = iCurrentDataSet; } else if (CheckForKnownElement(ref aLine, KMarkerStart)) { // Start of item - make a new entry iCurrentDataSet = new CSVDataSet(base.FileName, base.LineNumber); iParser.CurrentDataSet = iCurrentDataSet; } else { // Is it a valid line? CSVThread threadEntry = iParser.ParseLine(aLine); if (threadEntry != null) { if (iCurrentDataSet != null) { iCurrentDataSet.Add(threadEntry); } } } }
private CSVThread FindAppropriateSecondary(CSVThread aMaster, CSVDataSet aSecondaryCol) { System.Diagnostics.Debug.Assert(aMaster.FullName != string.Empty); // We must try to find the corresponding secondary thread with which to compare // aMaster. CSVThread secondary = aSecondaryCol[aMaster.FullName]; if (secondary == null) { // Secondary collection doesn't contain this thread, so make a default entry. secondary = CSVThread.NewDefault(aMaster.FullName); } else { aSecondaryCol.Remove(secondary); } return(secondary); }
private void BuildPairs() { // Treat the first collection as the master list. int count = iCol1.Count; for (int i = count - 1; i >= 0; i--) { CSVThread master = iCol1[i]; // Remove primary entry also iCol1.Remove(master); // Create or locate secondary CSVThread secondary = FindAppropriateSecondary(master, iCol2); // Create a pairing iPairings.Add(master.FullName, new CSVThreadPair(master, secondary)); } // Now do the same but for the secondary list this time. It should // be largely empty. The only entries that will remain are threads // which don't exist in the primary list. count = iCol2.Count; for (int i = count - 1; i >= 0; i--) { CSVThread master = iCol2[i]; // Remove primary entry also iCol2.Remove(master); // Create or locate secondary CSVThread secondary = FindAppropriateSecondary(master, iCol1); // Create a pairing - but this time the master is the 2nd entry // in the pair. This ensures we keep the threads in the correct // columns in the final excel spreadsheet. iPairings.Add(master.FullName, new CSVThreadPair(secondary, master)); } }
static public CSVThread New() { CSVThread ret = new CSVThread(); return(ret); }
public CSVThreadPair(CSVThread aMaster, CSVThread aSecondary) { iMaster = aMaster; iSecondary = aSecondary; }
private void CompareAndExport(CSVThread aMaster, CSVThread aSecondary) { iExcelExporter.CompareThread(aMaster, aSecondary); }