[14] | 1 | |
---|
| 2 | _memory_profile - It shows the amount of memory used by every pacakge. |
---|
| 3 | _________________________________________________________________ |
---|
| 4 | |
---|
| 5 | _memory_profile [-f <filename>] [-h] [-p] [-u <units>] |
---|
| 6 | |
---|
| 7 | This command intregrates the output from purify with a function map |
---|
| 8 | generated by a perlscript plus another perlscript to generate a memory |
---|
| 9 | profile of vis. |
---|
| 10 | |
---|
| 11 | This command relies on the output of purify to a file to call the script |
---|
| 12 | "memoryaccount" and produce a summary of how much memory has been allocated |
---|
| 13 | by each package. Although this command may appear simple it requires the |
---|
| 14 | interaction of two scripts and three files, so special care should be taken |
---|
| 15 | when attempting to modify it. |
---|
| 16 | |
---|
| 17 | Here is the way it works. The code in this command is conditionally compiled |
---|
| 18 | depending on the definition of the symbol PURIFY. If the symbol is not |
---|
| 19 | defined, the program prints a message notifying that the command is not |
---|
| 20 | operative in this executable. If PURIFY has been defined, there are certain |
---|
| 21 | things that are assumed. The executable has been linked with purify. The |
---|
| 22 | output of purify is being redirected to a file with name purify.log. The |
---|
| 23 | perl script memoryaccount is in $VIS/common/share and it is executable. |
---|
| 24 | There exists a file mapping function names to packages in the same place |
---|
| 25 | whose name is .fmap. |
---|
| 26 | |
---|
| 27 | The command then calls purify_all_inuse() to force purify to dump to the |
---|
| 28 | file purify.log the information about the memory that is currently visible |
---|
| 29 | to the program. This memory is not the total memory allocated by the program |
---|
| 30 | since there may be leaked memory that is no longer accessible. A temporary |
---|
| 31 | file is created and the script memoryaccount is called to analyze the file |
---|
| 32 | purify.log and write in the temporary file the memory profile obtained from |
---|
| 33 | it. Once the script is done, the temporary file is dumped to vis_stdout and |
---|
| 34 | deleted. |
---|
| 35 | |
---|
| 36 | Since most of the computation in this command is done by the pearlscript |
---|
| 37 | memoryaccount, for more information please refer to the message printed when |
---|
| 38 | the script is invoked with the option -h. Command options: |
---|
| 39 | |
---|
| 40 | -f <filename> |
---|
| 41 | File to read the dump from. The default is purify.log. This option |
---|
| 42 | should be used if and only if the option -log-file has been used at |
---|
| 43 | the linking stage when building the executable. |
---|
| 44 | |
---|
| 45 | -h |
---|
| 46 | Print the command usage. |
---|
| 47 | |
---|
| 48 | -p |
---|
| 49 | Print also the packages that did not allocated any visible memory |
---|
| 50 | |
---|
| 51 | -u <units> |
---|
| 52 | Units to print the memory usage in. It may be "b" for bytes, "k" for |
---|
| 53 | kilobytes, "m" for megabytes and "g" for gigabytes. The default is |
---|
| 54 | bytes. |
---|
| 55 | _________________________________________________________________ |
---|
| 56 | |
---|
| 57 | Last updated on 20100410 00h02 |
---|