public MemoryLogItem(String unparsedText, int id) { mPair = null; String[]arr = unparsedText.Split(','); int size; int request; uint location; int time; String name; mId = id; if (arr[0] == ItemTypeName[(int)ItemType.Label] ) { name = arr[2]; location = 0; size = 0; request = 0; time = Convert.ToInt32(arr[1]); } else if (arr[0] == ItemTypeName[(int)ItemType.Alloc] ) { name = arr[1]; location = Convert.ToUInt32(arr[2], 16); size = Convert.ToInt32(arr[3]); request = 1;// Convert.ToInt32(arr[4]); time = Convert.ToInt32(arr[6]); } else if ( arr[0] == ItemTypeName[(int)ItemType.Free] ) { name = arr[1]; location = Convert.ToUInt32(arr[2], 16); size = Convert.ToInt32(arr[3]); request = 2;// Convert.ToInt32(arr[4]); time = Convert.ToInt32(arr[6]); } else if ( arr[0] == ItemTypeName[(int)ItemType.Size]) { name = arr[1]; location = Convert.ToUInt32(arr[2], 16); size = Convert.ToInt32(arr[3]); request = 0; time = Convert.ToInt32(arr[5]); } else { // bad data return ; } if ( name == null ) { Console.WriteLine( "null: " + location ); } Initialize(name, arr[0], size, request, location, time); }
private Rectangle CreateRectangle(MemoryLogItem memLogItem) { // Map this item onto the visible space. int startX = MemoryToVisible( memLogItem.Location ); int endX = MemoryToVisible( memLogItem.EndPoint ); if ( endX - startX < 1 ) endX = startX + 1; if ( startX >= mDestRegion.Size.Width || endX <= 0 || endX - startX < 1 ) { // Item completely invisible. Don't draw return new Rectangle( 0, 0, 0, 0 ); } return new Rectangle(startX, 0, endX - startX, mDestRegion.Size.Height); }
public void Add(MemoryLogItem newItem) { mMemoryLogItems.Add(newItem); newItem.Category = mCategories.AssignCategory( newItem ); // Attempt to match a Free with it's Alloc if ( newItem.Type == MemoryLogItem.ItemType.Free ) { NameFreeBlock(); } if (mEndTick < newItem.Time) { mEndTick = newItem.Time; } mNumOperations++; if (newItem.Type != MemoryLogItem.ItemType.Label && newItem.Type != MemoryLogItem.ItemType.Size ) { if (mMemoryAddressStart > newItem.Location) { mMemoryAddressStart = newItem.Location; } if (mMemoryAddressEnd < (newItem.Location + newItem.Size)) { mMemoryAddressEnd = Convert.ToUInt32(newItem.Location + newItem.Size); } mMemorySize = mMemoryAddressEnd - mMemoryAddressStart; } }