Does anyone have any code that can be used to test the speed of running some code. From my research (Performance Tool capable of testing code for speed, Lightweight load & performance testing frameworks), it appears that people simply use tools to do this (JMeter, HPLoadRunner).

But, I am looking to see if there is a piece of code that can be embedded in the script to monitor the speed of executing the code.

2 Answers 2


For more detailed performance of code I would look into profilers. That way you can analyse which parts of the code took long.

Load-testing tools gives you a benchmark from the outside. It can help you with comparing speed of versions against each other, but not analyse code problems.

I would try a services like NewRelic which gives transactional insights. It follows all the method calls of the application and reports how long they took, just like profiler, but now embedded into the test or production environment. Run a load test against the environment and analyse the results.

  • Great response. But more research for me :) I am more than happy to do this... Many Thanks
    – OA345
    Sep 11, 2017 at 11:44

If your application has a CLI under Unix, you can use

time yourapplication arg1 arg2
  • I am running the application in LINUX (using AMPPS). So, I will check this out. Please, do arg1 & arg2 refer to the times it took to run the code and end.. Like: supportline.microfocus.com/documentation/books/sx2011sp1/… ?
    – OA345
    Sep 11, 2017 at 11:47
  • No, arg1 and arg2 are the arguments for the SUT. If you pass different arguments, naturally, the application with have different runtimes (which does not mean same arguments == same runtime exactly, of course). Sep 11, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.