Red Gate forums :: View topic - Time (%) field in source code window
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Performance Profiler 6
ANTS Performance Profiler 6 forum

Time (%) field in source code window

Search in ANTS Performance Profiler 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
RichWildUK



Joined: 28 Jun 2010
Posts: 3

PostPosted: Mon Jun 28, 2010 2:05 pm    Post subject: Time (%) field in source code window Reply with quote

Hi,

I wonder if anyone can clarify for me what the column "Time (%)" actually signifies in the source code window when looking at the results?

There's some informatin on this page: http://www.red-gate.com/supportcenter/Content.aspx?p=ANTS%20Performance%20Profiler&c=ANTS_Performance_Profiler/help/5.0/app_Working_with_source_code.htm&toc=ANTS_Performance_Profiler/help/5.0/toc789215.htm

...which says something like "...line-level timings are shown for each line of code (as well as average time and hit count).", but I'm not sure what the means preceisly.

What are the line level percentages actually a percentage of? I would have thought it would be either:
- percentage of time spent on that line compared to total time spent in the entire program (selected part only, of course); or
- percentage of time spent on that line compared to the total time spent in that function.

Only, if you add the percentages in that column up for the particular function I've selected, it comes to well over 100%, which confuses me.

The other thought I had was that this is a multi-threaded application and I'm running it on a dual-core system - could this mean my total percentages for the entire program should add up to 200%, not 100%, and explain the above? (I have been running it based on processor timings rather than clock timings, because I'm running it on my own pc and multitasking with other stuff.) Help!

Many thanks Smile

(P.S. I'm using verion 5.2 which I bought last month on a 'no updates' basis, but I couldn't see the version 5 forum!)
Back to top
View user's profile Send private message
slaphead99



Joined: 10 Mar 2010
Posts: 93

PostPosted: Mon Jun 28, 2010 7:22 pm    Post subject: Reply with quote

Yes- the percentage values are always with respect to *all* the data that has been selected (default- all of the data).

You get 100% per core.

Does that help you to see the consistency in the results you are getting?
Back to top
View user's profile Send private message
RichWildUK



Joined: 28 Jun 2010
Posts: 3

PostPosted: Tue Jun 29, 2010 8:26 am    Post subject: Reply with quote

Thanks - that clarifies things. So presumably on my dual core system the sum of the percentages is then 200%. This should help me interpret the results properly - cheers.
Back to top
View user's profile Send private message
slaphead99



Joined: 10 Mar 2010
Posts: 93

PostPosted: Thu Jul 01, 2010 12:59 pm    Post subject: Reply with quote

That's right: 2 cores -> 200%

Happy profiling Smile
Back to top
View user's profile Send private message
kay.one



Joined: 03 Jul 2010
Posts: 2

PostPosted: Sat Jul 03, 2010 6:49 am    Post subject: Reply with quote

Then how can this code show 100% time spent on a quad core cpu,

Code:
           
string text;
while (true)
{
    var text = "Text" + DateTime.Now;
}


Just to make sure that the 100% doesn't mean that its 100 of a core since its running on a single thread, I put this together,


Code:

   class Program
    {
        static void Main(string[] args)
        {
            new Thread(Do1).Start();
            new Thread(Do2).Start();
            new Thread(Do3).Start();
            new Thread(Do4).Start();

            Console.ReadLine();
        }

        private static void Do1()
        {
            while (true)
            {
                var text = "Text" + DateTime.Now;
            }
        }

        private static void Do2()
        {
            while (true)
            {
                var text = "Text" + DateTime.Now;
            }
        }

        private static void Do3()
        {
            while (true)
            {
                var text = "Text" + DateTime.Now;
            }
        }

        private static void Do4()
        {
            while (true)
            {
                var text = "Text" + DateTime.Now;
            }
        }
    }



which ran on all cores without profiler attached, but when I attached a profiler it started using a single core and each loop showed 24% cpu time,

I am completely lost on what these numbers actually mean, and why does it start running on a single core when profiler is attached!!!
Back to top
View user's profile Send private message
RichWildUK



Joined: 28 Jun 2010
Posts: 3

PostPosted: Mon Jul 05, 2010 9:10 am    Post subject: Reply with quote

Hi kay.one,

I wonder, when you first created the profile, what did you select under "default timing display": "CPU" or "Wall Clock"?

I think if you select "Wall Clock" you'll get results out of 100% no matter how many cpus you're using, and I believe it defaults to Wall Clock unless you change it.

rich.
Back to top
View user's profile Send private message
kay.one



Joined: 03 Jul 2010
Posts: 2

PostPosted: Mon Jul 05, 2010 5:08 pm    Post subject: Re: Reply with quote

RichWildUK wrote:
Hi kay.one,

I wonder, when you first created the profile, what did you select under "default timing display": "CPU" or "Wall Clock"?

I think if you select "Wall Clock" you'll get results out of 100% no matter how many cpus you're using, and I believe it defaults to Wall Clock unless you change it.

rich.



Actually I tried to change it to wall-clock, and the numbers changed like this:

Loops: 4*17%
Console.ReadLine(): 17%
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group