public static MemoryDumpDataSet.JoinedMemoryDumpTableDataTable Join(MemoryDumpDataSet.MemoryDumpTableDataTable First, MemoryDumpDataSet.MemoryDumpTableDataTable Second) { DataSet JoinedSet = new DataSet(); JoinedSet.Tables.Add(First); JoinedSet.Tables.Add(Second); JoinedSet.Relations.Add(new DataRelation("a", First.ClassNameColumn, Second.ClassNameColumn, false)); MemoryDumpDataSet.JoinedMemoryDumpTableDataTable Result = new MemoryDumpDataSet.JoinedMemoryDumpTableDataTable(); foreach (MemoryDumpDataSet.MemoryDumpTableRow Row in JoinedSet.Tables[First.TableName].Rows) { foreach (MemoryDumpDataSet.MemoryDumpTableRow ChildRow in Row.GetChildRows("a")) { MemoryDumpDataSet.JoinedMemoryDumpTableRow ResultRow = Result.NewJoinedMemoryDumpTableRow(); ResultRow.ClassName1 = Row.ClassName; ResultRow.Count1 = Row.Count; ResultRow.MT1 = Row.MT; ResultRow.TotalSize1 = Row.TotalSize; ResultRow.DeltaCount = ChildRow.Count - Row.Count; ResultRow.ClassName2 = ChildRow.ClassName; ResultRow.Count2 = ChildRow.Count; ResultRow.MT2 = ChildRow.MT; ResultRow.TotalSize2 = ChildRow.TotalSize; ResultRow.CountFactor = (double)(ResultRow.Count2) / ResultRow.Count1; Result.Rows.Add(ResultRow); } } return(Result); }
private void txtSecondDump_TextChanged(object sender, EventArgs e) { var msInterals = new List <string> { "System.", "MS.", "<CppImplementation", "Microsoft", "__type_info_node", "__DynamicallyInvokableAttribute", "<CrtImplementationDetails", }; Func <MemoryDumpDataSet.MemoryDumpTableRow, bool> filter = s => { // This is the early exist if (cbHideSystem.Checked && msInterals.Any(i => s.ClassName.Contains(i))) { return(false); } // Use filter, case insensitive if (string.IsNullOrWhiteSpace(textBoxFilter.Text) == false && s.ClassName.IndexOf(textBoxFilter.Text, StringComparison.CurrentCultureIgnoreCase) == -1) { return(false); } return(true); }; try { MemoryDumpDataSet.MemoryDumpTableDataTable FirstDump = MemoryComparerManager.ConvertMemoryDump("First", txtFirstDump.Lines, filter); MemoryDumpDataSet.MemoryDumpTableDataTable SecondDump = MemoryComparerManager.ConvertMemoryDump("Second", txtSecondDump.Lines, filter); Joined = MemoryComparerManager.Join(FirstDump, SecondDump); joinedMemoryDumpTableBindingSource.DataSource = Joined; } catch (Exception exception) { MessageBox.Show(exception.Message, "Error occurred"); } }