Пример #1
0
    internal void Increment(TraceEvent data)
    {
#if DEBUG
        // Debug.Assert((byte)data.opcode != unchecked((byte)-1));        // Means PrepForCallback not done.
        Debug.Assert(data.TaskName != "ERRORTASK");
        Debug.Assert(data.OpcodeName != "ERROROPCODE");
#endif
        Count++;
        TaskStats task = this[data.TaskName];
        if (task.ProviderName == null)
        {
            task.ProviderName = data.ProviderName;
        }

        CallStackIndex index    = data.CallStackIndex();
        bool           hasStack = (index != CallStackIndex.Invalid);
        if (hasStack)
        {
            StackCount++;
        }
        task.Increment(data.OpcodeName, hasStack);
        StackWalkTraceData asStackWalk = data as StackWalkTraceData;
        if (asStackWalk != null)
        {
            StackWalkStats stackWalkStats = task.ExtraData as StackWalkStats;
            if (stackWalkStats == null)
            {
                stackWalkStats = new StackWalkStats();
                task.ExtraData = stackWalkStats;
            }
            stackWalkStats.Log(asStackWalk);
        }
    }
Пример #2
0
 internal unsafe void Log(StackWalkTraceData data)
 {
     stacks++;
     for (int i = 0; i < data.FrameCount; i++)
     {
         int     value = 0;
         Address ip    = data.InstructionPointer(i);
         counts.TryGetValue((long)ip, out value);
         value++;
         counts[(long)ip] = value;
         frames++;
     }
 }