Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Guidelines required on Xamarin time profiler

$
0
0

Hi, I tried Xamarin time profiler for profiling a xamarin android application. But the results seem to be weird. I profiled the following code snippet.
void TestMethod()
{
//Stopwatch stopwatch = new Stopwatch();
//stopwatch.Start();
for (int i = 0; i < 5; i++)
{
Thread.Sleep(2000);
}
//stopwatch.Stop();
//Console.WriteLine("Time for testmethod(): " + stopwatch.ElapsedMilliseconds);
}

The stopwatch.ElapsedMilliseconds outputs "10002ms" but when I check it in xamarin profiler it displays "4.90s". Why is this difference? What exactly xamarin profiler is capturing?

Instead of using Thread.Sleep, I even tried following code snippet. Still there is a huge difference between what I could see in profiler and the output from stopwatch.ElapsedMilliseconds.

void TestMethod()
    {
        //Stopwatch stopwatch = new Stopwatch();
        //stopwatch.Start();
        for (int i = 0; i < 1000000; i++)
        {
            Console.WriteLine("Test output");
        }
        //stopwatch.Stop();
        //Console.WriteLine("Time for testmethod(): " + stopwatch.ElapsedMilliseconds);
    }

Note: I'm using xamarin profiler beta version 1.6.1.483. Also tried stable version 1.6.0.27. Result was not what I expected.


Viewing all articles
Browse latest Browse all 204402

Trending Articles