neobytes/contrib/auto_gdb/README.md
gladcow 1c9ed7806a GDB automation with Python script to measure memory usage in dashd (#1609)
* standart STL containers and Masternode-related classes processing

* masternode-related classes

* fix st containers processing,  use reflection to process simple classes

* Content descrioption in README.md

* Increase python scripts performance

Use gdb objects instead strings and type info for creating Pyton wrappers

* fixed simple classes list

* addition to README

* fix nits

* missed `the`

Co-Authored-By: gladcow <sergey@dash.org>

* fix nits

Co-Authored-By: gladcow <sergey@dash.org>

* fixed grammatical issues

Co-Authored-By: gladcow <sergey@dash.org>

* fixed phrase construction

Co-Authored-By: gladcow <sergey@dash.org>

* missed point

Co-Authored-By: gladcow <sergey@dash.org>

* fixed grammatical issues

Co-Authored-By: gladcow <sergey@dash.org>

* remove double space

Co-Authored-By: gladcow <sergey@dash.org>

* fixed grammatical issues

Co-Authored-By: gladcow <sergey@dash.org>
2018-10-23 14:15:08 +03:00

46 lines
1.8 KiB
Markdown

# Contents
This directory contains tools to automatically get data about the memory consumption by some objects in dashd process with the help of GDB debugger.
## dash_dbg.sh
This shell script attaches GDB to the running dashd process (should be built with debug info), executes debug.gdb script and detaches.
By default it uses testnet settings, see script comments to attach it to mainnet dashd.
## debug.gdb
Contains debugger instructions to execute during attach: loads python code and executes it for the objects we want to investigate.
## log_size.py
Contains definition of the gdb command log_size. After this script loads it can be called from gdb command line or other gdb scripts.
Command params:
`log_size arg0 arg1`
`arg0` - name of object whose memory will be written in log file
`arg1` - name of the log file
Example:
```
log_size mnodeman "memlog.txt"
```
## used_size.py
Contains definition of the gdb command used_size. After loading of this script it can be called from gdb command line or other gdb scripts.
Command params:
`used_size arg0 arg1`
`arg0` - variable to store memory used by the object
`arg1` - name of object whose memory will be calculated and stored in the first argument
Example:
```
>(gdb) set $size = 0
>(gdb) used_size $size mnodeman
>(gdb) p $size
```
## stl_containers.py
Contains helper classes to calculate memory used by the STL containers (list, vector, map, set, pair).
## simple_class_obj.py
Contains a helper class to calculate the memory used by an object as a sum of the memory used by its fields.
All processed objects of such type are listed in the this file, you can add new types you are interested in to this list.
If a type is not listed here, its size is the return of sizeof (except STL containers which are processed in stl_containers.py).
## common_helpers.py
Several helper functions that are used in other python code.