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 6200665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:24:39+00:00 2026-05-24T04:24:39+00:00

What sort of algorithms are used to compute the progress of a function call?

  • 0

What sort of algorithms are used to compute the progress of a function call?

Obviously its easy to do if you have a loop, something like:

 Action<Double> notifier = d => Console.WriteLine("Completed: " + d.ToString());

 Double _interval = 0.05;

 for (int i = 0; i < 1000; i++)
            {
                int rem = default(int); 

                Math.DivRem(i, _interval, out rem);

                if (rem == 0)
                {
                    double progress = (double)i / 1000;
                    notifier(progress); 
                }
             }

But what about when you just have some generic delegate and you’d like to run it asynchronously but also notify another thread of its progress, and you can’t gaurantee that you can straightforwardly use a for-loop? Some other straightforward ways might be:

1) Time the function first (very bad for performance though if its a long running task)

2) Store past timings of the function in a log and use that (but this doesnt necessarily take into account extra variables – cpu, memory, etc. at the specific time of the task)

However do any more advanced algorithms exist, even if only to approximate the progress?

  • 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-24T04:24:39+00:00Added an answer on May 24, 2026 at 4:24 am

    The BackgroundWorker class has an update callback, but in answer to your question of a ‘generic algorithm’ for finding completion, Not really. The closest you can get is estimating based on Function Length (http://www.ndepend.com/) which will get you length in lines of code.

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

Sidebar

Related Questions

I'm wondering what sort of algorithm could be used to take something like 4.72
I have always been interested in algorithms, sort, crypto, binary trees, data compression, memory
Is the sorting algorithm used by .NET's Array.Sort() method a stable algorithm?
I have written 2 implementation of bubble sort algorithm in C and Haskell. Haskell
Which algorithm does the JavaScript Array#sort() function use? I understand that it can take
I'm looking for a simple, easy to understand algorithm to alphabetically sort an array
Most examples (if not all) that I see are the sort of a function
I have implemented a simple parallel merge sort algorithm in Java. This cuts the
I have to sort a number of integers, which can have values between 30.000.000
I have been noticing some very strange usage of O(1) in discussion of algorithms

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.