How to measure how long is a function running?
Posted
by
rhose87
on Stack Overflow
See other posts from Stack Overflow
or by rhose87
Published on 2012-04-11T13:42:03Z
Indexed on
2012/04/13
17:29 UTC
Read the original article
Hit count: 172
I want to see how long a function is running. So I added a timer object on my form and I came out with this code:
private int counter = 0;
//inside button click I have:
timer = new Timer();
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
Result result = new Result();
result = new GeneticAlgorithms().TabuSearch(parametersTabu, functia);
timer.Stop();
and:
private void timer_Tick(object sender, EventArgs e)
{
counter++;
btnTabuSearch.Text = counter.ToString();
}
But this is not counting anything. Any ideas?
© Stack Overflow or respective owner