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

  • Home
  • SEARCH
  • 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 8059653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:44:31+00:00 2026-06-05T09:44:31+00:00

Our business model requires to charge users based on CPU hours/usage. Initially I was

  • 0

Our business model requires to charge users based on CPU hours/usage.

Initially I was thinking about simply using StopWatch and then use elapsed time as a unit of measure.

But the problem I see with this approach is that in the day time when 5000 users are hitting the server, the elapsed time for the same piece of code will be higher than in the night time when only 50 users are hitting the server.

Other option is to charge users based on the iterations performed on the data users passed in. There are couple of issues with this approach as well.

  • Some functions would not require any iteration over data.
  • CPU usage for x + y is lower than that of x + y * z.

What is a good way to calculate CPU usage information in C#/.Net so that it remains the same for all users for the same operation regardless of the server’s load?

Possibly, total amount of actual assembly level instructions? Is there a way to get that information in C#?

What other approached, recommendations can you share?

Thanks a lot for looking into this.

  • 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-06-05T09:44:32+00:00Added an answer on June 5, 2026 at 9:44 am

    Execute whatever your users want to run in a separate process and look for its CPU time after the process is done. This is also different from wallclock time as it only takes into account the time the process actually ran on the CPU.

    Minimal example for those who are unwilling to read documentation:

    ProcessStartInfo psi = new ProcessStartInfo(@"C:\Blah\Foo.exe");
    Process p = Process.Start(psi);
    p.WaitForExit();
    TimeSpan time = p.TotalProcessorTime;
    p.Close();
    

    You may want to run this asynchronously, though.

    No need for estimation, guessing or black magic. You cannot calculate it reliably anyway.

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

Sidebar

Related Questions

We have problem with our Qt based production server for our business application. When
Our org is planning on basing parts of our business model on the premise
We would like to publish a base model, that represents our core business data.
Okay, so we have a utility here in-house that generates business-model classes from our
We have implemented our domain model using the accountability pattern, which we are trying
We are currently considering using DotNetNuke as a base for our future portal-based and
We have a Student class in our business model. something struck me as strange,
Our business is planning on building a rather large business application with about 2000
Our business sends a newsletter to a vast number of subscribers every week. When
Our business deals with houses and over the years we have created several business

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.