How to control the dump of coverage result

Technote (FAQ)


Question

How do you control the dump of coverage result with IBM Rational Test RealTime (TestRT)?

Cause

The Coverage dump happens, when the program under test exits. If program contains a loop and never terminate, it is necessary to make the dump manually.

Answer

To control the dump, you need to customise the Target Deployment Port (TDP) with the macro RTRT_OPEN_MODE and add the pragma _ATCPQ_DUMP within your code.



How data retrieval mechanism works

First here is short description about how Test RealTime uses the data retrieval mechanism.

The running application (test driver or instrumented application) opens the file or connection at initialization time using priv_init/usr_init. Then it fulfils the atl_buffer with ASCII characters on each error detection or on dump request.

As soon as the atl_buffer is full, Test RealTime cllas the priv_writeln/usr_writeln to flush the data on the file or connection. Then Test RealTime continues the application or the dump report without closing the file or connection. Once the dump report ends, the application continues normally.

At the end of the test driver or end of the application (on exit) the file/connection is then closed executing priv_close/usr_close.

In your case, to control the dump you force the dump at a specific location in your code using the following things.


RTRT_OPEN_MODE
This macro override the open mode used to open the result file by priv_open() method when RTRT_IO = RTRT_STD.


_ATCPQ_DUMP
This is an instrumentation pragma that you must add into your source code to introduce a manual trace dump, when required for runtime analysis tools.



Method

  1. Open your XDP file with the TDP editor.

  2. Click Library Settings > Data retrieval and Error message output > IO Settings > set RTRT_OPEN_MODE.






  3. Add the pragma in your source, where you want to start the dump

    #pragma attol insert _ATCPQ_DUMP(<reset>);

Where <reset> can be one of the following value or combination of them with binary OR.



Pragma Function
_ATCPQ_RESET does a dump And when the execution will finish a new dump will be done.
_ATCPQ_CLOSE closes the result file at the end of the requested dump.
_ATCPQ_COV dumps coverage results.
_ATCPQ_RESET_COV resets the coverage status after the dump.
_ATCPQ_QTF dumps performance results
_ATCPQ_RESET_QTF resets the performance status after the dump
_ATCPQ_FREE_FRQ frees all old memory blocks after the dump.
_ATCPQ_PRF dumps memory profiling report.
_ATCPQ_CHK_WL dumps ABWL, and FMWL report
_ATCPQ_ALL to dump all of them

_ATCP_RESET is set to _ATCPQ_ALL as default but can be defined on compilation command.

0 or 1 does the same action as _ATCPQ_ALL.


You can insert this pragma automatically by clicking the Insert Dump button in the Text Editor toolbar.




Alternatively, do a right click, where you want to add the pragma.



Examples


Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


Once RTRT_OPEN_MODE has been set, find in your source code where it's the best place to make the dump.



FIRST CODE EXAMPLE



int Run(void)
{
int counter = 0;

While (1)
{
SimuInit();
#pragma attol insert _ATCPQ_DUMP(_ATCPQ_RESET);
/* will do a dump here And when the execution will finish a new dump will be done */

counter ++;
SimuErase();
}

}




SECOND CODE EXAMPLE

This example uses _ATCPQ_RESET and _ATCPQ_CLOSE Therefore the code does an open action on the next result dump with the runtime priv_open method.



int Run(void)
{
int counter = 0;

While (1)
{
SimuInit();
#pragma attol insert _ATCPQ_DUMP(_ATCPQ_RESET | _ATCPQ_CLOSE);
/* will do a dump and close the file when the execution will finish a
new dump will be done but as there is no file open then the runtime
will open/reopen the file for the final dump */

counter ++;
SimuErase();
}

}




Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Test RealTime
Runtime Analysis: C

Software version:

7.5, 7.5.0.1, 7.5.0.2, 7.5.0.3, 7.5.0.4, 7.5.0.5, 7.5.0.6, 8.0, 8.0.0.1, 8.0.0.2, 8.0.0.3, 8.0.0.4

Operating system(s):

HP-UX, Linux, Solaris, Windows

Reference #:

1618247

Modified date:

2013-06-28

Translate my page

Machine Translation

Content navigation