Import and export memory analysis data

In the Momentics IDE for BlackBerry, you can import and export session data from a Memory Analysis session view.

You can import data from an XML or memory analysis trace file. You can export memory analysis session data.

When exporting memory analysis information, the Momentics IDE lets you export the event-specific results in .csv format, or all of the session data in .xml format (for sharing). You can import the event-specific results into a spreadsheet, or perhaps you can import it to a different Momentics IDE.

Import memory analysis data

To import data from an xml or memory analysis trace file (.rmat) format:
  1. Click File > Import.
  2. Select QNX > Memory Analysis Data, and then click Next.
  3. Select a session to import. You can choose to import data from the following two formats (file extension determines the format):
    Screen showing the Import Memory Analysis Data wizard.
  4. Click Finish to perform the import.

Import session information from an XML file

To import data from an XML file:
  1. For the Input File field, click Browse to select an .xml input file.

    You don't need to select any sessions from the list because they were automatically created (using the same names) when they were exported with the prefix imported.

  2. Click Finish.

When the import process completes, you can open a Memory Analysis session and view the results.

After importing, you can rename the session by right-clicking in the session and selecting Rename.

Import event information

The import of memory analysis data is useful in two cases. If it isn't possible to start a Memory Analysis session using the Momentics IDE for BlackBerry, for example, when there is no network connection between a target and host machine, or if qconn isn't running on the target machine, you can start memory analysis on the target (see Launch using the command line with Memory Analysis enabled), and then transfer the data file to your host to perform a postmortem memory analysis. If you want to share a session, you can export it in XML format, and then later it can be imported to view the data. Compared to a trace file, the XML format is self-contained and doesn't require binaries and libraries to be present at import time.

To import a memory analysis trace file:
  1. Click File > Import.
  2. Select QNX > Memory Analysis Data, and then click Next.
  3. For the Input File field, click Browse to select an input file.

    Screen showing the Import Memory Analysis Data wizard.

  4. Choose a session from the Session to import list, or click Create New Session to create a session to import data into.
    You can select only one session for the import process.
  5. Click Next.

    Screen showing the Import Memory Analysis Data wizard.

  6. On this page, you can select an executable for the application. Click From Workspace or From File System to select an executable file.
    Although this step is optional, you should select a binary for the application; otherwise, reported events have no connection to the source code, and traces have no navigation data.

    The executable you select should be the same as the one running on the target machine.

  7. Optional: Add locations for the source folders. This step is required only if you intend to navigate to the editor from the memory analysis tables. Click Add from File System or Add From Workspace to add a source lookup path to the list.
  8. Click Finish, to begin importing.
When the importing process completes, you can open the Memory Analysis session to view the results.

Export memory analysis session data

To export memory analysis data:

  1. Click File > Export.
  2. Select QNX > Memory Analysis Data, and then click Next.

    The list shows all of the memory analysis sessions that you accumulated.

    Screen showing the Export Memory Analysis Data wizard.

  3. You can choose to export the data in the following two formats:
    • To export data in XML format, from the list, select one or more memory analysis sessions that you want to export, or from the Options area, select Select All to choose all the sessions at once.
    • To export data in CSV format (for descriptions about the format type, see Memory result formats):
      1. From the list, select one or more memory analysis sessions that you want to export, and from the Options area, select an event type that you want to export.

        Memory events — export the allocation and deallocation of events over time.

        Runtime errors — export runtime errors; these are the memory errors or leaks detected during the session.

        Band events — export band events. The QNX allocator preallocates small buffers of memory for satisfying requests for small allocations, thereby improving your performance. These bands can handle allocations of up to 16, 24, 32, 48, 64, 80, 96, and 128 bytes in size. Band events would contain information about how many of these blocks are used and freed at any given time. In the Memory Analysis tool, the Bands pane shows a graphical representation for the activity in these bands.

        Bin events — export the bin events information from the allocator. This allocator maintains counters to help gather statistics about how your application uses memory. Bins are user-defined buckets of memory that the allocator tracks. Bin events are the number of bins of a given size that are used and freed at any given time. In the Memory Analysis tool, the Bins pane shows a graphical representation of the values for these counters over time.

      2. To include column headers for the data in the exported file, select the Generate header row check box.
  4. In the Output File field, click Browse to select the output file you want to save the XML or CSV results in, or specify a new location and file name.

    If you select an output file that currently exists, you're prompted during the export process to click Yes to overwrite this file.

  5. To begin the export process, click Finish.

The resulting output file contains all of the memory analysis data for the selected session(s), based on your selected options.

When you export session information and then import it into a Memory Analysis session view to review the results, the session is the same. However, the name, date, and some other properties that are unique to a session are different.

CSV file format

When the Momentics IDE exports the event data in CSV format, the resulting data for the exported file contains different information depending on the type of event selected for export. For information about the detailed file format, see Memory result formats.

Memory result formats

Memory event results format

For a memory event (allocation/deallocation events), the data in the results file appears in the following order:

  • SESSION NAME: name of the session
  • SESSION TIME: time that the session was created. For an imported session, it is the time of the import; not the time the session was created.
  • EVENT ID: a unique ID for the memory event
  • TIME STAMP: timestamp of when the event occurred on the target machine
  • PROCESS ID: an ID for the process
  • THREAD ID: an ID for the thread
  • CPU: CPU number for multicore machines
  • ALLOC KIND: the type of allocation
  • ACTUAL SIZE: number of bytes in the allocated block
  • REQUESTED SIZE: the number of bytes that were requested
  • DEALLOCATED: indicates whether the memory block was freed
  • POINTER: pointer value associated with the event
  • SOURCE LOCATION: a source location where memory was allocated
  • ROOT LOCATION: specifies the source location for the stacj trace; typically main or a thread entry function
  • FULL TRACE: a full trace for the allocation

Bin event results format

For a bin event, the data in the results file appears in the following order:

  • SESSION NAME: name of the session
  • SESSION TIME: time that the session was created. For an imported session, it is the time of the import, not the time the session was created.
  • EVENT ID: a unique ID for the bin event
  • TIME STAMP: timestamp of when the event occurred on the target machine
  • PROCESS ID: an ID for the process
  • SIZE: size of the memory (in bytes, by powers of two — 2, 4, 8, 16, and so on, up to 4096, including larger blocks such as anything over 4 KB) in this bin
  • ALLOCATION: the number of allocations in this bin
  • DEALLOCATIONS: the amount of free memory in this bin

Runtime error event results format

For a runtime error event, the data in the results file appears in the following order:

  • SESSION NAME: name of the session
  • SESSION TIME: time that the session was created. For an imported session, it is the time of the import; not the time the session was created.
  • EVENT ID: a unique ID for the runtime error event
  • TIME STAMP: timestamp of when the event occurred on the target machine
  • PROCESS ID: an ID for the process
  • THREAD ID: an ID for the thread
  • CPU: CPU number for multicore machines
  • MESSAGE: error message returned
  • POINTER: pointer value associated with the error argument
  • TRAP FUNCTION: identifies where the error was caught
  • ALLOC KIND: specifies the type of allocation for the argument (pointer) being validated
  • SEVERITY: error severity
  • MEMORY STATE: indicates whether the pointer memory was used, or is free
  • SOURCE LOCATION: specifies the source location where the error occurred (trapped)
  • ROOT LOCATION: specifies the source location for the stacj trace; typically main or a thread entry function
  • FULL TRACE: a full trace for the error
  • FULL ALLOC TRACE: a full allocation trace for the pointer

Band event results format

For a band event, the data in the results file appears in the following order:

  • SESSION NAME: name of the session
  • SESSION TIME: time that the session was created. For an imported session, it is the time of the import, not the time the session was created.
  • EVENT ID: a unique ID for the band event
  • TIME STAMP: timestamp of when the event occurred on the target machine
  • PROCESS ID: an ID for the process
  • SIZE: size of the block (in bytes — 16, 24, 32, 48, 64, 80, 96, and 128 bytes in size) for this band
  • TOTAL BLOCKS: the total number of blocks in the band
  • FREE BLOCKS: the number of free blocks in the band

In the Momentics IDE, you can import trace data session information from a Memory Analysis session view. When importing memory analysis session information, the Momentics IDE lets you import the event-specific results for libmalloc events in .csv format, and the other session trace data in .xml format.

To include column headers for the event data in the exported CSV file, select the Generate header row check box in the Exporting Memory Analysis Data wizard.

Last modified: 2015-07-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus