unsafe public static bool IsSubtype(SharedHeapService.Allocation *childData, SystemType parent) { UIntPtr childHandle = SharedHeapService.GetType(childData); return(IsSubtype(childHandle, parent.id)); }
// // The goal of this routine is to focus on the shared heap operations // themselves. So we allocate and then free the same amount of memory // repeatedly, which (for small region allocations) won't cause us to // go to the Page manager in steady state. // public static void TimeCycle(int bytes, int iterations) { ulong before = Processor.CycleCount; for (int loop = 0; loop < iterations; loop++) { SharedHeapService.Allocation *mem; mem = (SharedHeapService.Allocation *) SharedHeapService.Allocate((UIntPtr)bytes, typeof(byte).GetSystemType(), 0); SharedHeapService.Free(mem); } ulong after = Processor.CycleCount; // // Tell the world. // Console.Write("\nTested {0} alloc/free iterations of {1} bytes\n", iterations, bytes); Console.Write("Total cycles: {0}\n", after - before); Console.Write("\n\n"); }