public void RefreshDiffData(CrawledMemorySnapshot unpackedCrawl, CrawledMemorySnapshot preUnpackedCrawl) { MemUtil.LoadSnapshotProgress(0.01f, "refresh Data"); _unpacked = unpackedCrawl; _preUnpacked = preUnpackedCrawl; resetDiffDicts(); _categories.Clear(); _staticDetailInfo.clear(); foreach (ThingInMemory thingInMemory in _unpacked.allObjects) { string typeName = MemUtil.GetGroupName(thingInMemory); if (typeName.Length == 0) { continue; } int category = MemUtil.GetCategory(thingInMemory); MemObject item = new MemObject(thingInMemory, _unpacked); MemCategory theCategory; if (!_categories.TryGetValue(category, out theCategory)) { theCategory = new MemCategory(); theCategory.Category = category; _categories.Add(category, theCategory); } theCategory.Size += item.Size; theCategory.Count++; } calculateCategoryInfo(); MemUtil.LoadSnapshotProgress(0.4f, "unpack all objs"); _unpackedInfos = new UnPackedInfos(_unpacked, _preUnpacked); _unpackedInfos.calculateCrawledDict(); List <ThingInMemory> addedList; List <ThingInMemory> unchangedList; List <ThingInMemory> removedList; getDiffDict(_unpackedInfos._unpackedThingsDict, _unpackedInfos._preunpackedThingsDict, out addedList, out removedList, out unchangedList); foreach (var thing in addedList) { _handleDiffObj(thing, sDiffType.AdditiveType, _unpacked); } foreach (var thing in removedList) { _handleDiffObj(thing, sDiffType.NegativeType, _unpacked); } foreach (var thing in unchangedList) { setUnchangedThings(thing); } MemUtil.LoadSnapshotProgress(0.8f, "check diff"); RefreshTables(); MemUtil.LoadSnapshotProgress(1.0f, "done"); }
public void RefreshData(CrawledMemorySnapshot unpackedCrawl) { _unpacked = unpackedCrawl; resetDiffDicts(); _categories.Clear(); _staticDetailInfo.clear(); foreach (ThingInMemory thingInMemory in _unpacked.allObjects) { string typeName = MemUtil.GetGroupName(thingInMemory); if (typeName.Length == 0) { continue; } int category = MemUtil.GetCategory(thingInMemory); MemObject item = new MemObject(thingInMemory, _unpacked); if (!_staticDetailInfo.isDetailStaticFileds(typeName, thingInMemory.caption, item.Size)) { MemType theType; Dictionary <string, MemType> unchangedDict; _diffDicts.TryGetValue(sDiffDictKey.unchangedDict, out unchangedDict); if (!unchangedDict.ContainsKey(typeName)) { theType = new MemType(); theType.TypeName = MemUtil.GetCategoryLiteral(thingInMemory) + typeName; theType.Category = category; theType.Objects = new List <object>(); unchangedDict.Add(typeName, theType); } else { theType = unchangedDict[typeName]; } theType.AddObject(item); } MemCategory theCategory; if (!_categories.TryGetValue(category, out theCategory)) { theCategory = new MemCategory(); theCategory.Category = category; _categories.Add(category, theCategory); } theCategory.Size += item.Size; theCategory.Count++; } calculateCategoryInfo(); RefreshTables(); }
public static Dictionary <int, MemCategory> PopulateCategories(CrawledMemorySnapshot snapshot) { var categories = new Dictionary <int, MemCategory>(); foreach (ThingInMemory thingInMemory in snapshot.allObjects) { int category = MemUtil.GetCategory(thingInMemory); MemCategory theCategory; if (!categories.TryGetValue(category, out theCategory)) { theCategory = new MemCategory(); theCategory.Category = category; categories.Add(category, theCategory); } theCategory.Size += thingInMemory.size; theCategory.Count++; } return(categories); }
public void RefreshData(CrawledMemorySnapshot unpackedCrawl, CrawledMemorySnapshot preUnpackedCrawl = null) { _unpacked = unpackedCrawl; _preUnpacked = preUnpackedCrawl; _types.Clear(); _categories.Clear(); _staticDetailInfo.clear(); foreach (ThingInMemory thingInMemory in _unpacked.allObjects) { string typeName = MemUtil.GetGroupName(thingInMemory); if (typeName.Length == 0) { continue; } int category = MemUtil.GetCategory(thingInMemory); MemObject item = new MemObject(thingInMemory, _unpacked); if (!_staticDetailInfo.isDetailStaticFileds(typeName, thingInMemory.caption, item.Size)) { MemType theType; if (!_types.ContainsKey(typeName)) { theType = new MemType(); theType.TypeName = MemUtil.GetCategoryLiteral(thingInMemory) + typeName; theType.Category = category; theType.Objects = new List <object>(); _types.Add(typeName, theType); } else { theType = _types[typeName]; } theType.AddObject(item); } MemCategory theCategory; if (!_categories.TryGetValue(category, out theCategory)) { theCategory = new MemCategory(); theCategory.Category = category; _categories.Add(category, theCategory); } theCategory.Size += item.Size; theCategory.Count++; } int[] sizes = new int[MemConst.MemTypeCategories.Length]; int[] counts = new int[MemConst.MemTypeCategories.Length]; foreach (var item in _categories) { sizes[0] += item.Value.Size; counts[0] += item.Value.Count; if (item.Key == 1) { sizes[1] += item.Value.Size; counts[1] += item.Value.Count; } else if (item.Key == 2) { sizes[2] += item.Value.Size; counts[2] += item.Value.Count; } else { sizes[3] += item.Value.Size; counts[3] += item.Value.Count; } } for (int i = 0; i < _categoryLiterals.Length; i++) { _categoryLiterals[i] = string.Format("{0} ({1}, {2})", MemConst.MemTypeCategories[i], counts[i], EditorUtility.FormatBytes(sizes[i])); } freshUnpackInfos(); checkAddtiveThings(); checkNegativeThings(); RefreshTables(); }