Execution time report
<p><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);">Hello, </span><br><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);">I want to know how to send to a label, or a text, the execution time of the report.</span><br><br><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);">Thank you</span></p>
0
Comments
-
<p>Generation phase? If we take a look at the order of events for generation (<a data-ipb='nomediaparse' href='http://www.eclipse.org/birt/documentation/integrating/scripting.php'>http://www.eclipse.org/birt/documentation/integrating/scripting.php</a>), you'll find the following:</p>
<p> </p>
<p><img src="http://www.eclipse.org/birt/img/documentation/integrating/eventgen.jpg" alt="eventgen.jpg"></p>
<p> </p>
<p>First, we will save the start time in the <em>initialize </em>event. We first need to detect which phase initialize is called because it's called twice, once for generation and another during rendering.</p>
<pre class="_prettyXprint _lang-">
if(reportContext.getTaskType() == Packages.org.eclipse.birt.report.engine.api.IEngineTask.TASK_RUN){
reportContext.setGlobalVariable("startTime", new Date());
}
</pre>
<p>Second, we will take the time at the afterFactory event. We'll calculate the difference between the end and start time, and save this in a persistent global variable.</p>
<pre class="_prettyXprint _lang-">
var elapsedTime = new Date() - reportContext.getGlobalVariable ("startTime");
reportContext.setPersistentGlobalVariable ("reportRenderTime", elapsedTime.toString());
// This debugging is only available in commercial BIRT
//
// Messages will appear in the Eclipse > Error Log window
//
//var logger = java.util.logging.Logger.getLogger("birt.report.logger");
//logger.warning ( elapsedTime ); // Time in milliseconds
</pre>
<p>Finally, we'll insert a label into the report, and modify its <em>onRender </em>event. We will write out the elapsed time in milliseconds in the label's text.</p>
<pre class="_prettyXprint _lang-">
this.text = 'Report generation time (ms): ' + reportContext.getPersistentGlobalVariable("reportRenderTime");
</pre>
<p>This report was tested in OS BIRT 3.7.2, and in iHub 16.2.</p>
<p> </p>
Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management