locked
SyncStatistics RRS feed

  • Question

  • Hello. I have an application which synchronize one SQL Server 2008 with one SQL Server 2008 Express. I added a performance measurement and found a confusing result of time used for synchronization. Here is the code that I used:

    Stopwatch timer = new Stopwatch();
    timer.Start();
    SyncStatistics stats = syncOrchestrator.Synchronize();
    timer.Stop();
    long result1 = (stats.SyncEndTime - stats.SyncStartTime).Milliseconds;
    long result2 = timer.ElapsedMilliseconds

    When I compare result1 with result2, I found these two numbers didn't match. Though I don't expect thest two are the same, sometimes the gap is pretty big.
    For example, in one test, result1 is 900 ms with result2 is 19400 ms.

    Could someone tell me what causes such difference?

    • Edited by yunwwang Wednesday, August 8, 2012 8:57 PM
    Wednesday, August 8, 2012 8:54 PM

All replies

  • Hi, I think when calculating result1 you should have .TotalMilliseconds so you're not just getting the milliseconds component of a second (0-999).
    Tuesday, August 14, 2012 6:34 AM