Esempio n. 1
0
        private static ulong[] GetPmcCounters(UInt16 extendedDataCount, IntPtr extendedData)
        {
            for (int ext = 0; ext < extendedDataCount; ext++)
            {
                unsafe
                {
                    EventHeaderExtendedDataItem extendedDataItem =
                        *((EventHeaderExtendedDataItem *)extendedData.ToPointer());
                    if (extendedDataItem.ExtType != EventHeaderExtType.PmcCounters)
                    {
                        continue;
                    }

                    int len      = extendedDataItem.DataSize / sizeof(UInt64);
                    var pmcCodes = new ulong[len];
                    fixed(UInt64 *pCodes = pmcCodes)
                    {
                        TypeServiceUtil.MemCopy((byte *)extendedDataItem.DataPtr.ToPointer(), (byte *)pCodes,
                                                len * sizeof(UInt64));
                    }

                    return(pmcCodes);
                }
            }

            return(s_EmptyPmcCounters);
        }
Esempio n. 2
0
        private static Guid GetRelatedActivityId(UInt16 extendedDataCount, IntPtr extendedData, UInt16 flags)
        {
            Guid relatedActivityId = Guid.Empty;

            for (int ext = 0; ext < extendedDataCount; ext++)
            {
                unsafe
                {
                    EventHeaderExtendedDataItem extendedDataItem =
                        *((EventHeaderExtendedDataItem *)extendedData.ToPointer());
                    if (extendedDataItem.ExtType != EventHeaderExtType.RelatedActivityId)
                    {
                        continue;
                    }


                    var value = new byte[16];
                    fixed(byte *pb = value)
                    {
                        TypeServiceUtil.MemCopy((byte *)extendedDataItem.DataPtr.ToPointer(), pb, 16);
                    }

                    relatedActivityId = new Guid(value);
                    break;
                }
            }

            return(relatedActivityId);
        }
Esempio n. 3
0
        public byte[] ReadBytes(uint length)
        {
            var value = new byte[length];

            fixed(byte *pb = value)
            {
                TypeServiceUtil.MemCopy(_data, pb, (int)length);
            }

            _data += length;
            return(value);
        }