Пример #1
0
        void CreateForwardReference(ulong targetAddress, GcObject source, int referenceNumber)
        {
            ForwardReference nextForwardReference;

            addressToForwardReferences.TryGetValue(targetAddress, out nextForwardReference);
            addressToForwardReferences[targetAddress] = new ForwardReference(source, referenceNumber, nextForwardReference);
        }
Пример #2
0
        private void ReadEventPipeTimeInfo()
        {
            // Read and check the type name
            _deserializer.ReadStringAndVerify("Microsoft.DotNet.Runtime.EventPipeFile");

            // Read tag and check
            _deserializer.ReadByteAndVerify(0x6 /*EndObject tag*/);

            // Read end of event stream marker
            ForwardReference reference = _deserializer.ReadForwardReference();

            _endOfEventStream = _deserializer.ResolveForwardReference(reference, preserveCurrent: true);

            // Read the date and time of trace start.
            var year         = _deserializer.ReadInt16();
            var month        = _deserializer.ReadInt16();
            var dayOfWeek    = _deserializer.ReadInt16();
            var day          = _deserializer.ReadInt16();
            var hour         = _deserializer.ReadInt16();
            var minute       = _deserializer.ReadInt16();
            var second       = _deserializer.ReadInt16();
            var milliseconds = _deserializer.ReadInt16();

            _syncTimeUTC = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc);

            // Read the start timestamp.
            sessionStartTimeQPC = (long)_deserializer.ReadInt64();
            _syncTimeQPC        = sessionStartTimeQPC;

            // Read the clock frequency.
            _QPCFreq = _deserializer.ReadInt64();
        }
Пример #3
0
        GcObject CreateRootObject()
        {
            GcObject rootObject = GcObject.CreateGcObject(rootCount);

            rootObject.TypeSizeStackTraceId = GetOrCreateGcType("<root>");
            GcObject unknownObject = GcObject.CreateGcObject(0);

            unknownObject.TypeSizeStackTraceId = GetOrCreateGcType("<unknown type>");
            for (int i = 0; i < rootCount; i++)
            {
                if (roots[i] == null)
                {
                    roots[i] = idToObject[rootIDs[i]];
                    if (roots[i] == null)
                    {
                        roots[i] = unknownObject;
                    }
                }
                roots[i].parent        = null;
                roots[i].InterestLevel = InterestLevel.Interesting;
                rootObject.SetReference(i, roots[i]);
            }
            // patch up any unresolved forward references by making them point to "unknownObject"
            foreach (ForwardReference head in addressToForwardReferences.Values)
            {
                for (ForwardReference forwardReference = head; forwardReference != null; forwardReference = forwardReference.next)
                {
                    forwardReference.source.SetReference(forwardReference.referenceNumber, unknownObject);
                }
            }
            addressToForwardReferences.Clear();
            return(rootObject);
        }
Пример #4
0
        public void FromStream(Deserializer deserializer)
        {
            _fileFormatVersionNumber = deserializer.VersionBeingRead;

            if (deserializer.VersionBeingRead >= 3)
            {
                var startEventStreamReference = deserializer.ReadForwardReference();
                _startEventOfStream = deserializer.ResolveForwardReference(startEventStreamReference, preserveCurrent: true);
            }
            ForwardReference reference = deserializer.ReadForwardReference();

            _endOfEventStream = deserializer.ResolveForwardReference(reference, preserveCurrent: true);

            // The start time is stored as a SystemTime which is a bunch of shorts, convert to DateTime.
            short year         = deserializer.ReadInt16();
            short month        = deserializer.ReadInt16();
            short dayOfWeek    = deserializer.ReadInt16();
            short day          = deserializer.ReadInt16();
            short hour         = deserializer.ReadInt16();
            short minute       = deserializer.ReadInt16();
            short second       = deserializer.ReadInt16();
            short milliseconds = deserializer.ReadInt16();

            _syncTimeUTC = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc);
            deserializer.Read(out _syncTimeQPC);
            deserializer.Read(out _QPCFreq);

            sessionStartTimeQPC = _syncTimeQPC;

            if (deserializer.VersionBeingRead >= 3)
            {
                deserializer.Read(out pointerSize);
                deserializer.Read(out _processId);
                deserializer.Read(out numberOfProcessors);
                deserializer.Read(out _expectedCPUSamplingRate);
            }
            else
            {
                _processId         = 0; // V1 && V2 tests expect 0 for process Id
                pointerSize        = 8; // V1 EventPipe only supports Linux which is x64 only.
                numberOfProcessors = 1;

                _startEventOfStream = deserializer.Current;      // Events immediately after the header.
            }
        }
 internal ForwardReference(GcObject source, int referenceNumber, ForwardReference next)
 {
     this.source          = source;
     this.referenceNumber = referenceNumber;
     this.next            = next;
 }