Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Maven - Performance profiling of code executed by JUNIT

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any maven plugin available which can be used to profile the performance / execution time of the entire chain of APIs/code that gets run during a JUNIT execution.

E.g. If JUNIT is run on methodA() which calls methodB() which calls methodC() I want the full time breakup as

Total time for methodA
...Total time for methodB
.....Total time for methodC

I want a report generated so that it can be included for "site" phase.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None that I know. But an option to give the timing for methodA (in your example) should be easy enough to add to the Surefire plugin. Getting the timings of the other methods would require some Aspect programming.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly me. I looked at the site generated by Maven for one of my projects and guess what? The Surefire Report already shows the timings for each unit test case. Of course, that is the timing for the unit test case method, which is the method that would call methodA in your example.

But I thought a little further on this issue, and while unit test timing my be a quick and dirty way to get some performance numbers, the numbers are probably meaningless. For several reasons.

First, calling a series of methods only once can result in a large variation of results between one build and the next. There are just too many variables with bootstrapping an application to count on perf numbers obtained at that time. In typical perf testing, you have a warm-up phase phase, a steady state phase, and a ramp down phase. Only the timings during the steady state phase have any meaning.

Second, unit tests are single threaded. So you will have no idea of how things performed under stress, or even under normal usage.

Overall, if you want performance numbers, incorporate JMeter or some similar tool into your build and let it gather perf data for you.
 
I will suppress my every urge. But not this shameless plug:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic