Answer the question
In order to leave comments, you need to log in
How to measure code performance directly in code?
Stopwatch won't work.
It is necessary to measure processor cycles (CPU-sampling or something like that). In code.
What for? I am writing a genetic algorithm that selects the optimal parameters for some complex method . The speed of this complex method is highly dependent on combinations of parameters. Therefore, speed is one of the criteria by which the fitness function selects the best candidates.
But the algorithm will work for about a week on a working machine, in the background, under various conditions. The processor is either free or busy, the same with the disk, so time measurements (via Stopwatch) under different conditions will simply be incomparable.
Some kind of effective time metric is neededspent by the application. Or something like CPU-sampling from VS Performance Profiler. But only right in the code. Like Stopwatch.
Or does it not happen?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question