示例#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);
        }
示例#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);
        }