Calculating Elapsed Time

Scenario

If a page contains a large report, it could be slower to load and render compared to pages with small or no reports. To create benchmarks, measure the time it takes for Confluence to display the report.

This recipe shows you how to calculate the duration of elapsed time it takes for Confluence to generate a report.

Result

 

Recipe

Apps

Reporting for Confluence Server & Data Center

Apps

Reporting for Confluence Server & Data Center

Level

Intermediate

Estimated time

30 minutes

Macros

Report Info, Report Variable

Suppliers

Date Supplier, Global Supplier, Variable Supplier

Storage format

You can copy and paste this code into the Confluence Source Editor:

<p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="db258930-a626-44b4-9e5d-94ffadefada1" ac:name="report-variable" ac:schema-version="1"> <ac:parameter ac:name="value">%global:current date%</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:parameter ac:name="">ReportStarted</ac:parameter> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="1837562b-b439-4a97-92d4-17b819c00eac" ac:name="report-variable" ac:schema-version="1"> <ac:parameter ac:name="value">%global:current date%</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:parameter ac:name="">ReportFinished</ac:parameter> <ac:rich-text-body> <p> <br/> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> <table> <tbody> <tr> <th> <p>Report Date</p> </th> <td> <p> <ac:structured-macro ac:macro-id="0eff7aaa-7707-4281-89f3-4905c066438d" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="format">yyyy-MM-dd</ac:parameter> <ac:parameter ac:name="">variable:ReportFinished</ac:parameter> </ac:structured-macro> </p> </td> <th> <p>Started</p> </th> <td> <p> <ac:structured-macro ac:macro-id="44375ed9-894a-482f-98b6-64841c26cae6" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="format">HH:mm:ss</ac:parameter> <ac:parameter ac:name="">variable:ReportStarted</ac:parameter> </ac:structured-macro> </p> </td> <th> <p>Finished</p> </th> <td> <p> <ac:structured-macro ac:macro-id="48dabb90-ec55-45fa-a6e7-9cc2759b51f3" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="format">HH:mm:ss</ac:parameter> <ac:parameter ac:name="">variable:ReportFinished</ac:parameter> </ac:structured-macro> </p> </td> <th> <p>Elapsed Time</p> </th> <td> <div class="content-wrapper"> <p class="auto-cursor-target"> <br/> </p> <ac:structured-macro ac:macro-id="83f8fbb1-300b-45ae-bd6c-973ceeae84ab" ac:name="report-eval" ac:schema-version="1"> <ac:parameter ac:name="format">#,##0.00</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:parameter ac:name="">Result</ac:parameter> <ac:plain-text-body><![CDATA[(%variable:ReportFinished > date:milliseconds% - %variable:ReportStarted > date:milliseconds%) / (1000) ]]></ac:plain-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br/> </p> </div> </td> </tr> </tbody> </table> <p class="auto-cursor-target"> <br/> </p>

Macro structure

You can recreate the example in the editor view:

 

Steps

  • N/A

Line-by-Line Explanation

  • N/A

 

Â