示例#1
0
            static unsafe void Deserialize(ref DeserializationContext context, out AllocationRanges output)
            {
                if (context.SourceLength < 4)
                {
                    throw new InvalidDataException();
                }

                int count = *(int *)(context.Source + 0);
                var array = ImmutableArrayPool <Range> .Allocate(count);

                uint offset   = 4;
                uint itemSize = BlittableSerializer <Range> .Size;

                if (context.SourceLength < (4 + (itemSize * count)))
                {
                    throw new InvalidDataException();
                }

                for (int i = 0; i < count; i++)
                {
                    context.DeserializeValue(
                        BlittableSerializer <Range> .Deserialize,
                        offset, itemSize, out array.Array[array.Offset + i]
                        );

                    offset += itemSize;
                }

                output = new AllocationRanges(array);
            }
示例#2
0
        static void DeserializeHeapList(ref DeserializationContext context, out HeapSnapshot.HeapInfo[] output)
        {
            var br = new BinaryReader(context.Stream);

            int count = br.ReadInt32();

            output = new HeapSnapshot.HeapInfo[count];

            uint offset = 4;
            uint size   = BlittableSerializer <HeapSnapshot.HeapInfo> .Size;

            for (int i = 0; i < count; i++)
            {
                context.DeserializeValue(BlittableSerializer <HeapSnapshot.HeapInfo> .Deserialize, offset, size, out output[i]);
                offset += size;
            }
        }
示例#3
0
        static void Deserialize(ref DeserializationContext context, out HeapSnapshotInfo output)
        {
            var br = new BinaryReader(context.Stream, Encoding.UTF8);

            var index     = br.ReadInt32();
            var timestamp = DateTime.Parse(br.ReadString());
            var filename  = br.ReadString();

            var heapFragmentation = br.ReadSingle();

            var largestFree     = br.ReadInt64();
            var largestOccupied = br.ReadInt64();

            var averageFree     = br.ReadInt64();
            var averageOccupied = br.ReadInt64();

            var bytesAllocated = br.ReadInt64();
            var bytesOverhead  = br.ReadInt64();
            var bytesTotal     = br.ReadInt64();

            var allocationCount = br.ReadInt32();

            var memoryOffset = br.ReadUInt32();

            MemoryStatistics memory;

            context.DeserializeValue(memoryOffset, out memory);

            output = new HeapSnapshotInfo(
                index, timestamp, filename, memory,
                heapFragmentation, largestFree, largestOccupied,
                averageFree, averageOccupied,
                bytesAllocated, bytesOverhead, bytesTotal,
                allocationCount
                );
        }
示例#4
0
        static void DeserializeHeapList(ref DeserializationContext context, out HeapSnapshot.HeapInfo[] output)
        {
            var br = new BinaryReader(context.Stream);

            int count = br.ReadInt32();
            output = new HeapSnapshot.HeapInfo[count];

            uint offset = 4;
            uint size = BlittableSerializer<HeapSnapshot.HeapInfo>.Size;
            for (int i = 0; i < count; i++) {
                context.DeserializeValue(BlittableSerializer<HeapSnapshot.HeapInfo>.Deserialize, offset, size, out output[i]);
                offset += size;
            }
        }