Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 836457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:59:02+00:00 2026-05-15T04:59:02+00:00

I am trying to performance test some code. I am using a stopwatch. When

  • 0

I am trying to performance test some code. I am using a stopwatch. When I output the number of milliseconds it always tells me 0 so I thought that I would try the number of ticks. I am seeing that the number of ticks is about 20 000 to 30 000. Looking at the MSDN at TimeSpan.TicksPerMillisecond it says that is 10 000 ticks per millisecond. In that case why are the elapsed milliseconds on my stopwatch not appearing as 2 or 3?

What am I missing? I have even outputed the result on the same line. This is what I get.

Time taken: 26856 ticks, 0 ms

And it is constant.

This is my code which I have running in a loop. I realize that I am creating a new stopwatch every time which isn’t very efficient but I don’t see how it could skew my results.

Dim SW = New Stopwatch()
SW.Reset()
SW.Start()
MethodCall()
SW.Stop()
Console.WriteLine(String.Format("Time to increase counters: {0} ticks, {1} ms", SW.ElapsedTicks, SW.ElapsedMilliseconds))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:59:02+00:00Added an answer on May 15, 2026 at 4:59 am

    Stopwatch ticks are different from DateTime Ticks.

    The length of a Stopwatch tick depends on the Stopwatch frequency (one tick is one second divided by the frequency, as described in the MSDN documentation for Stopwatch.ElapsedTicks.

    It could be argued that Stopwatch.ElapsedTicks was a poor choice of a name for this property because of the potential for confusion with DateTime ticks. I would have preferred something like ElapsedRawTicks, or some other suitable adjectival qualifier to hint that these are not standard Ticks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that does some time-consuming calculations. I'm trying to performance test
The problem: I have a WCF service that I'm trying to performance test with
am trying to squeeze some performance out of this query, any help would be
i am trying to run performance counters on a .NET application and i would
I am trying to improve performance by limiting my objects in memory by using
I was trying to test the performance difference between inserting into a table directly
I'm trying to unit test some of my classes and having a problem where
I'm trying to track down some performance issues I have had with Django. There
I have been trying to perform some OpenGL ES performance optimizations in an attempt
I am trying to do some evaluation of template frameworks. For a simple performance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.