0

i want to see if there is a elegant way to create a mechanism which can track if the runtime of a function have degraded for a particular test release over release.

Let say in my software if there are 100 high level function, i will like to see what function have degraded in runtime release to release. Assuming i am running same test across releases and logging the runtime of top level (100 high level) functions in a text file for comparison. Few people in other threads commented to use macro, but wrapping 100 function calls around macro is ugly and painful. Any better way to solve this problem.

David
  • 4,634
  • 7
  • 35
  • 42

2 Answers2

1

If you created your unit tests correctly (if at all) you can create a macro to define your tests and automatically log time for each one. Since ideally each unit test uses as little different kinds of functionality as possible if one of your tests takes longer than expected by a certain margin you can just flag that with your data and if you look at the test you will be able to determine what is slowing down (usually what you're testing)

Jesus Ramos
  • 22,940
  • 10
  • 58
  • 88
  • It's not possible to make unit test which cover each and every function throughly. We already have bunch of real customer test cases. The goal to regress any timing degradation in those test.so really need a way to log runtime of 100 top level function. – David Aug 31 '11 at 07:11
  • You should be able to test general functionality and use the tests as a semi-coarse grain test to figure out which functionality is slowing down. You then use this test to determine which of these functions is the one that is performing slowly. As mentioned with version control you can literally just look at the changes to the code and see what made it slower. – Jesus Ramos Aug 31 '11 at 13:32
1
  1. Time your functions and write the result in a log file.
  2. Compare the log file for each release with the result from earlier releases.

You can also use automatic tools for the job, like gprof. Other profiling tools are listed on wikipedia

Community
  • 1
  • 1
Klas Lindbäck
  • 33,105
  • 5
  • 57
  • 82