VerySleepy / verysleepy

Very Sleepy, a sampling CPU profiler for Windows
http://www.codersnotes.com/sleepy
GNU General Public License v2.0
1.05k stars 103 forks source link

Child Calls time distribution misleading #25

Closed tpecholt closed 8 years ago

tpecholt commented 9 years ago

I am a VerySleepy user. The program is invaluable but it has one bug which annoys me a lot.

The Child Calls window shows wrong values in Samples and %Calls columns. The problem here is exclusive time (spent in function body itself) is not shown anywhere so one of the child calls (first one?) is artificially increased probably because of matching total time with sum of all child calls. That is very misleading especially when inspected function has significant exclusive time.

I propose to add another line to the listbox for exclusive time.

CyberShadow commented 9 years ago

Sorry, but I cannot reproduce the problem you're describing.

I wrote the following program:

int foo = 42;

__inline void work() 
{
    for (int i=1; i<100000; i++)
        foo *= i;
}

__declspec(noinline) void f1() { work(); }
__declspec(noinline) void f2() { work(); }

int main()
{
    for (int i=1; i<100000; i++)
    {
        work();

        f1();

        f2();
    }

    return foo;
}

I compiled it as follows:

cl /Ox /Zi test.cpp 

I verified with a disassembler that the code is compiled (inlined / not inlined) as expected.

With Very Sleepy, after a quick profile, I see the following Child Calls result for the main function:

I do not see anything unexpected about these results.

The overall results are also as expected (main, f1 and f2 have 33/31/35% exclusive and 100/31/35% inclusive respectively).

CyberShadow commented 9 years ago

@tpecholt Can you clarify, or can we close this?