perfview icon indicating copy to clipboard operation
perfview copied to clipboard

cdbstack - last sample is dropped

Open wmascia opened this issue 6 years ago • 3 comments

The last sample in the file doesn't get added. So I added the following on line 119 of DebuggerStackSource.cs just after the end of the for(;;) loop. Just a copy/paste from the code above (including the sample.Metric = 1 per Issue 1009 - No metrics in cdbstacks).

            if (stack.Count != 0)
            {

                StackSourceCallStackIndex parent = StackSourceCallStackIndex.Invalid;
                for (int i = stack.Count - 1; i >= 0; --i)
                {
                    parent = Interner.CallStackIntern(stack[i].frame, parent);
                }

                stack.Clear();

                sample.Metric = 1;
                sample.StackIndex = parent;
                sample.TimeRelativeMSec = time;
                time++;
                AddSample(sample);
            }

UPDATE: added the src file name

wmascia avatar Oct 15 '19 04:10 wmascia

@wmascia can you share the data file where you saw this issue?

brianrob avatar Oct 18 '19 20:10 brianrob

It would happen on any cdbstack file but you can use the one below. Granted you'd never actually care about this in a typical trace with bagillions of samples. I just happened to notice it when I had a small cdbstack file with an interesting frame in the last stack ...which I couldn't find in the stack viewer.

In this case A!foo and A!baz will be included but B!foo and B!baz will not.

test.cdbstack:

Call Site A!foo A!baz

Call Site B!foo B!baz

(Doh I mentioned the line number but not the src file in the OP. Just updated it)

wmascia avatar Oct 18 '19 22:10 wmascia

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

github-actions[bot] avatar Oct 19 '25 02:10 github-actions[bot]