Example #1
0
        /// <summary>
        /// Convert the TraceEvent callStack 'callStackIdx' into a StackSourceCallStack.  'callStackIdx is
        /// assumed to be related to the traceEvent 'data'.   'data' is used to determine the process and thread
        /// of the stack.  (TODO data may not be needed anymore as callStackIndexes do encode their thread (and thus process)).
        /// </summary>
        public StackSourceCallStackIndex GetCallStack(CallStackIndex callStackIndex, TraceEvent data)
        {
            // This only happens if only have ONLY the thread and process (no addressses)
            // TODO do we care about this case?  Should we remove?
            var thread = data.Thread();
            StackSourceCallStackIndex topOfStack;

            if (thread == null)
            {
                var process = data.Process();
                if (process != null)
                {
                    topOfStack = GetCallStackForProcess(process);
                }
                else
                {
                    topOfStack = StackSourceCallStackIndex.Invalid;
                }
            }
            else
            {
                topOfStack = GetCallStackForThread(thread);
            }

            return(GetCallStack(callStackIndex, topOfStack, m_callStackMap));
        }
Example #2
0
        private void CheckForNewProcess(TraceEvent data)
        {
            var process = data.Process();

            if (process != null)
            {
                if (m_simulators[(int)process.ProcessIndex] == null)
                {
                    m_simulators[(int)process.ProcessIndex] = CreateNewSimulator(process);
                }
            }
        }
Example #3
0
        private void AddUnkownAsyncDurationIfNeeded(StartStopActivity startStopActivity, double unknownStartTimeMSec, TraceEvent data)
        {
            Debug.Assert(0 < unknownStartTimeMSec);
            Debug.Assert(unknownStartTimeMSec <= data.TimeStampRelativeMSec);

            if (startStopActivity.IsStopped)
            {
                return;
            }

            // We dont bother with times that are too small, we consider 1msec the threshold
            double delta = data.TimeStampRelativeMSec - unknownStartTimeMSec;

            if (delta < 1)
            {
                return;
            }

            // Add a sample with the amount of unknown duration.
            var sample = new StackSourceSample(m_outputStackSource);

            sample.Metric           = (float)delta;
            sample.TimeRelativeMSec = unknownStartTimeMSec;

            StackSourceCallStackIndex stackIndex        = m_startStopActivities.GetStartStopActivityStack(m_outputStackSource, startStopActivity, data.Process());
            StackSourceFrameIndex     unknownAsyncFrame = m_outputStackSource.Interner.FrameIntern("UNKNOWN_ASYNC");

            stackIndex        = m_outputStackSource.Interner.CallStackIntern(unknownAsyncFrame, stackIndex);
            sample.StackIndex = stackIndex;

            // We can't add the samples right now because AWAIT nodes might overlap and we have to take these back.
            // The add the to this list so that they can be trimmed at that time if needed.

            List <StackSourceSample> list = m_startStopActivityToAsyncUnknownSamples.Get((int)startStopActivity.Index);

            if (list == null)
            {
                list = new List <StackSourceSample>();
                m_startStopActivityToAsyncUnknownSamples.Set((int)startStopActivity.Index, list);
            }
            list.Add(sample);
        }