Memory Operations Tracker Probe

From OC Systems Wiki!
Revision as of 16:10, 28 October 2020 by Swn (talk | contribs) (UAL Parameters)
Jump to: navigation, search

Memory Operations Tracker Probe: memoptb.ual

(Since 4.5.3).

The memoptb.ual predefined probe tracks the use of memory operations (move, compare, set, ...) within an application program and shared libraries. The probe records the location, number, and size of memory operations. The tracking information is recorded as the application runs and is formatted to produce a report.

Memory operation tracking allows you to determine where there may be hidden "slow" operations in your application. The memory operation tracking information can be used to locate where generated code may be slow in your application.


Usage

This probe is applied at run time using aprobe as described under Profile UAL Parameters below. Memory operation tracking data will be collected for the standard memory functions: memmove, memcpy, memcmp, memset, bzero. This probe is also capable of tracking memory operations which have been converted to string instructions on Linux x86/x86_64 and calls to AIX low-core millicode functions.

The memory operation tracking information is logged to the APD file for later processing by apformat. At format time a report is generated detailing where memory operation points are located and sorted by size and number. The memory operation points are organized by unique traceback paths.

The default parameters will track memory operation sizes greater than 100 bytes, but upper and lower bonds can be set to focus on specific sizes (and reduce the amount of collected data). Instrumentation of x86/x86_64 string instructions and AIX low-core millicode is on by default for the application module but can be turned off or enabled for other modules.

UAL Parameters

memoptb.ual is specified on the aprobe command line or in an APO file as described in Command Line. The specific options are:

aprobe  -u memoptb.ual    [-p "param-list"] your_program

where param_list may include:

-C
don't track compares [FALSE]
-D
don't enable tracking at program start [FALSE]
-d Depth
traceback depth [9]
-F
don't track fills [FALSE]
-i
report tracebacks inline in the tables
-I
don't instrument x86/_64 string instructions or AIX low-core calls [FALSE]
-l LowerBound
lower bound size cut off for operations; larger operations will be tracked [1000]
-M
don't track moves [FALSE]
-S
don't track sets [FALSE]
-s SigNum
use signal SigNum to enable/disable tracking [0]
-u UpperBound
upper bound size cut off for operations; smaller operations will be tracked [0]
-Z
don't track zeros [FALSE]
[module ...]
modules to instrument for string instructions or low-core calls [application module]

Examples

The following would track memory operations 1000 bytes or larger in the application module:

aprobe -u memooptb main.exe

The following will track memory operations between 40 and 50 bytes in two shared libraries:

aprobe -u memooptb -p "-l 40 -u 50 my_shared_libary1.so my_shared_libary2.so" main.exe

Memory Operation Tracker Performance Issues

See Performance_Issues for a general discussion of factors that affect performance.

Because operations are logged as they occur, long-running programs may need larger APD sizes. Use the -s option to increase the size of App files, and use the -n option to increase the number of APD files in the app ring. See APD File for more information.


Memory Operations Tracker Report

This is an example report on Linux x86 with some standard memory operation functions and some x86 string instructions:

Memory Operations Tracker Probe 4.5.2 (201023)
Copyright 1993-2019 OC Systems, Inc. All rights reserved.
For support/questions send mail to support@ocsystems.com.

PID: 25235 - Summary of options
   Program start: Fri Oct 23 17:29:45.743505 2020
Options:
   TracebackDepth:   9
   SizeLowerBound:   1000
   SizeUpperBound:   0
   Track Compares:   1
   Track Fills:      1
   Track Moves:      1
   Track Sets:       1
   Track Zeros:      1
   Instrument Ins:   1

------------------------------------------------------------------
Ops sorted by size:
------------------------------------------------------------------
TbkId |     Op    |    NumOps    |     TotalOpSize |     AvgOpSize
------------------------------------------------------------------
@8    	  MEMSET	     1000	   4000000	      4000
@9    	    STOS	     1000	   4000000	      4000
@10   	    STOS	     1000	   4000000	      4000
@4    	    MOVS	     1000	   4000000	      4000
@5    	    MOVS	     1000	   4000000	      4000
@6    	    MOVS	     1000	   4000000	      4000
@7    	  MEMSET	     1000	   4000000	      4000
@2    	  MEMCMP	     1000	   4000000	      4000
@3    	    MOVS	     1000	   4000000	      4000
@1    	  MEMCMP	     1000	   4000000	      4000
------------------------------------------------------------------
Ops sorted by count:
------------------------------------------------------------------
TbkId |     Op    |    NumOps    |     TotalOpSize |     AvgOpSize
------------------------------------------------------------------
@8    	  MEMSET	     1000	   4000000	      4000
@9    	    STOS	     1000	   4000000	      4000
@10   	    STOS	     1000	   4000000	      4000
@4    	    MOVS	     1000	   4000000	      4000
@5    	    MOVS	     1000	   4000000	      4000
@6    	    MOVS	     1000	   4000000	      4000
@7    	  MEMSET	     1000	   4000000	      4000
@2    	  MEMCMP	     1000	   4000000	      4000
@3    	    MOVS	     1000	   4000000	      4000
@1    	  MEMCMP	     1000	   4000000	      4000
---------------------------------------------------------
Op traceback ids:
---------------------------------------------------------
@8        MEMSET       1000   4000000

         "__memset_sse2()" in "libc.so"
     ==> extern:"main()" at line 24 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@9          STOS       1000   4000000

         extern:"main()" at line 25 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@10         STOS       1000   4000000

         extern:"main()" at line 26 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@4          MOVS       1000   4000000

         extern:"main()" at line 20 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@5          MOVS       1000   4000000

         extern:"main()" at line 21 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@6          MOVS       1000   4000000

         extern:"main()" at line 22 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@7        MEMSET       1000   4000000

         "__memset_sse2()" in "libc.so"
     ==> extern:"main()" at line 23 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@2        MEMCMP       1000   4000000

         "__GI_memcmp()" in "libc.so"
     ==> extern:"main()" at line 16 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@3          MOVS       1000   4000000

         extern:"main()" at line 19 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

@1        MEMCMP       1000   4000000

         "__GI_memcmp()" in "libc.so"
     ==> extern:"main()" at line 15 (main.c)
     ==> extern:"__libc_start_main()" + 0x00f2 in "libc.so"
     ==> Unknown symbol at 0x80483a0 in "main.exe"

 

This report shows output on AIX with some standard memory operation functions and some low-core calls.

Memory Operations Tracker Probe 4.5.2-64 (201023)
Copyright 1993-2019 OC Systems, Inc. All rights reserved.
For support/questions send mail to support@ocsystems.com.

PID: 10158244 - Summary of options
   Program start: Fri Oct 23 18:59:04.157421 2020
Options:
   TracebackDepth:   9
   SizeLowerBound:   1000
   SizeUpperBound:   0
   Track Compares:   1
   Track Fills:      1
   Track Moves:      1
   Track Sets:       1
   Track Zeros:      1
   Instrument Ins:   1

------------------------------------------------------------------
Ops sorted by size:
------------------------------------------------------------------
TbkId |     Op    |    NumOps    |     TotalOpSize |     AvgOpSize
------------------------------------------------------------------
@9    	   BZERO	     1000	   4000000	      4000
@10   	   BZERO	     1000	   4000000	      4000
@2    	  MEMCMP	     1000	   4000000	      4000
@4    	 MEMMOVE	     1000	   4000000	      4000
@8    	    FILL	     1000	   4000000	      4000
@5    	 MEMMOVE	     1000	   4000000	      4000
@3    	 MEMMOVE	     1000	   4000000	      4000
@6    	 MEMMOVE	     1000	   4000000	      4000
@7    	    FILL	     1000	   4000000	      4000
@11   	  MEMCMP	      999	   3996000	      4000
@1    	  MEMCMP	        1	      4000	      4000
------------------------------------------------------------------
Ops sorted by count:
------------------------------------------------------------------
TbkId |     Op    |    NumOps    |     TotalOpSize |     AvgOpSize
------------------------------------------------------------------
@10   	   BZERO	     1000	   4000000	      4000
@2    	  MEMCMP	     1000	   4000000	      4000
@4    	 MEMMOVE	     1000	   4000000	      4000
@8    	    FILL	     1000	   4000000	      4000
@9    	   BZERO	     1000	   4000000	      4000
@5    	 MEMMOVE	     1000	   4000000	      4000
@7    	    FILL	     1000	   4000000	      4000
@3    	 MEMMOVE	     1000	   4000000	      4000
@6    	 MEMMOVE	     1000	   4000000	      4000
@11   	  MEMCMP	      999	   3996000	      4000
@1    	  MEMCMP	        1	      4000	      4000
---------------------------------------------------------
Op traceback ids:
---------------------------------------------------------
@8          FILL       1000   4000000

         extern:"main()" at line 24 (main.c)
     ==> Unknown symbol at 0x100001828

@9         BZERO       1000   4000000

         extern:"bzero()"
     ==> extern:"main()" at line 25 (main.c)
     ==> extern:"__start()" + 0x0070

@10        BZERO       1000   4000000

         extern:"bzero()"
     ==> extern:"main()" at line 26 (main.c)
     ==> extern:"__start()" + 0x0070

@11       MEMCMP        999   3996000

         extern:"main()" at line 15 (main.c)
     ==> extern:"main()" at line 26 (main.c)

@4       MEMMOVE       1000   4000000

         extern:"memcpy()"
     ==> extern:"main()" at line 20 (main.c)
     ==> extern:"__start()" + 0x0070

@5       MEMMOVE       1000   4000000

         extern:"main()" at line 21 (main.c)
     ==> extern:"main()" at line 20 (main.c)

@6       MEMMOVE       1000   4000000

         extern:"main()" at line 22 (main.c)
     ==> Unknown symbol at 0x100001520

@7          FILL       1000   4000000

         extern:"main()" at line 23 (main.c)
     ==> Unknown symbol at 0x1000016a4

@2        MEMCMP       1000   4000000

         extern:"main()" at line 16 (main.c)
     ==> Unknown symbol at 0x100001218

@3       MEMMOVE       1000   4000000

         extern:"memcpy()"
     ==> extern:"main()" at line 19 (main.c)
     ==> extern:"__start()" + 0x0070

@1        MEMCMP          1   4000

         extern:"main()" at line 15 (main.c)
     ==> extern:"__start()" + 0x0070