A long long time ago I identifies performance issues in the coverage plugins...
Once the coverage.xml gets sufficiently large, you will hit the issue. Part of the problem is that we need to capture all the source code that has coverage results in order to be able to paint the source code. Another part of the problem is that we need to merge multiple coverage.xml files to produce an aggregate view of code coverage. These are "non-trivial" problems. In general you can work around by chucking more memory at the jvm that is doing the aggregation (i.e. the slave JVM) that will at least prevent the GC churn that slows things massively, however it is a work around as the core issue is the algorithm used to parse, merge and aggregate has some fundamental flaws. I have been threatening to rewrite them for some time.... Still no sign of my mythical "coverage" plugin But when it does land, I promise it will be kick-ass ;-) On 29 June 2012 12:02, Mikael Petterson <[email protected]> wrote: > Hi, > > I suspected the publishing of Cobertura coverage report taking way too long. > I upgraded from 1.3 -> 1.5 but no change ( I suspected that since change > list did not mention anything). > > I decided to check how long this step takes so ( after recommendation from > Ulli H.) I installed Timestamper ( nice plugin). > > And I found out that it takes ~ 22 minutes to publish Cobertura coverage > report! > > 08:19:08 Publishing Cobertura coverage report... > 08:41:07 Publishing Cobertura coverage results... > > Since build with tests and reports takes only 6 min I find it strange. > > I notice one difference here since we have the coverage.xml in a vob ( > clearcase). Pattern used to > Search for file is: > > *vobs/<path to cobertura xml>/coverage.xml > > Will this increase publish of report? Or is there a an operation in the code > below that is known to take time? > > > I downloaded src and tried to build 1.5 ( to be able to debug) but got the > following error: > > found : hudson.model.AbstractBuild<capture#336 of ?,capture#473 of ?> > required: hudson.maven.MavenBuild > if(build instanceof MavenBuild) { > ^ > /home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:233: > inconvertible types > found : hudson.model.AbstractBuild<capture#515 of ?,capture#236 of ?> > required: hudson.maven.MavenBuild > MavenBuild mavenBuild = (MavenBuild)build; > ^ > /home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:238: > inconvertible types > found : hudson.model.AbstractBuild<capture#919 of ?,capture#763 of ?> > required: hudson.maven.MavenModuleSetBuild > } else if(build instanceof MavenModuleSetBuild) { > ^ > /home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:239: > inconvertible types > found : hudson.model.AbstractBuild<capture#858 of ?,capture#685 of ?> > required: hudson.maven.MavenModuleSetBuild > MavenModuleSetBuild moduleSetBuild = (MavenModuleSetBuild)build; > ^ > /home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/targets/CoverageResult.java:446: > warning: [deprecation] > generateGraph(org.kohsuke.stapler.StaplerRequest,org.kohsuke.stapler.StaplerResponse,org.jfree.chart.JFreeChart,int,int) > in hudson.util.ChartUtil has been deprecated > ChartUtil.generateGraph(req, rsp, createChart(dsb.build()), 500, > 200); > > > Any ideas? > > > Br, > > //mikael > > listener.getLogger().println("Publishing Cobertura coverage report..."); > final FilePath[] moduleRoots = build.getModuleRoots(); > final boolean multipleModuleRoots = > moduleRoots != null && moduleRoots.length > 1; > final FilePath moduleRoot = multipleModuleRoots ? > build.getWorkspace() : build.getModuleRoot(); > final File buildCoberturaDir = build.getRootDir(); > FilePath buildTarget = new FilePath(buildCoberturaDir); > > FilePath[] reports = new FilePath[0]; > try { > reports = moduleRoot.list(coberturaReportFile); > > // if the build has failed, then there's not > // much point in reporting an error > if (build.getResult().isWorseOrEqualTo(Result.FAILURE) && > reports.length == 0) > return true; > > } catch (IOException e) { > Util.displayIOException(e, listener); > e.printStackTrace(listener.fatalError("Unable to find coverage > results")); > build.setResult(Result.FAILURE); > } > > if (reports.length == 0) { > String msg = "No coverage results were found using the pattern > '" > + coberturaReportFile + "' relative to '" > + moduleRoot.getRemote() + "'." > + " Did you enter a pattern relative to the correct directory?" > + " Did you generate the XML report(s) for Cobertura?"; > listener.getLogger().println(msg); > build.setResult(Result.FAILURE); > return true; > } > > for (int i = 0; i < reports.length; i++) { > final FilePath targetPath = new FilePath(buildTarget, "coverage" > + (i == 0 ? "" : i) + ".xml"); > try { > reports[i].copyTo(targetPath); > } catch (IOException e) { > Util.displayIOException(e, listener); > e.printStackTrace(listener.fatalError("Unable to copy > coverage from " + reports[i] + " to " + buildTarget)); > build.setResult(Result.FAILURE); > } > } > > listener.getLogger().println("Publishing Cobertura coverage > results..."); >
