All Projects → jmdana → Memprof

jmdana / Memprof

Licence: gpl-3.0
A memory profiler for Python. As easy as adding a decorator!

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Memprof

rmem
MTuner SDK - Memory profiling library
Stars: ✭ 25 (-78.26%)
Mutual labels:  profiler, memory
Unityheapexplorer
A Memory Profiler, Debugger and Analyzer for Unity 2019.3 and newer.
Stars: ✭ 179 (+55.65%)
Mutual labels:  memory, profiler
audria
audria - A Utility for Detailed Ressource Inspection of Applications
Stars: ✭ 35 (-69.57%)
Mutual labels:  profiler, memory
Loli profiler
Memory instrumentation tool for android app&game developers.
Stars: ✭ 179 (+55.65%)
Mutual labels:  memory, profiler
profiling
Non-discriminatory profiling of Ruby code leveraging the ruby-prof gem
Stars: ✭ 12 (-89.57%)
Mutual labels:  profiler, memory
Xpedite
A non-sampling profiler purpose built to measure and optimize performance of ultra low latency/real time systems
Stars: ✭ 89 (-22.61%)
Mutual labels:  profiler
Iglance
Free system monitor for OSX and macOS. See all system information at a glance in the menu bar.
Stars: ✭ 1,358 (+1080.87%)
Mutual labels:  memory
Opencover
A code coverage tool for .NET 2 and above (WINDOWS OS only), support for 32 and 64 processes with both branch and sequence points
Stars: ✭ 1,256 (+992.17%)
Mutual labels:  profiler
Memorymonitor
内存监控器
Stars: ✭ 79 (-31.3%)
Mutual labels:  memory
Jvm Profiler
JVM Profiler Sending Metrics to Kafka, Console Output or Custom Reporter
Stars: ✭ 1,558 (+1254.78%)
Mutual labels:  profiler
Easy profiler
Lightweight profiler library for c++
Stars: ✭ 1,594 (+1286.09%)
Mutual labels:  profiler
Mcelog
Linux kernel machine check handling middleware
Stars: ✭ 96 (-16.52%)
Mutual labels:  memory
Semile
Profile what you care, monitor how it goes (support C/C++)
Stars: ✭ 89 (-22.61%)
Mutual labels:  profiler
Optick
C++ Profiler For Games
Stars: ✭ 1,364 (+1086.09%)
Mutual labels:  profiler
Ipc
Public domain single header inter process communication primitives
Stars: ✭ 85 (-26.09%)
Mutual labels:  memory
Xhgui
Web interface for XHProf profiling data can store data in MongoDB or PDO database
Stars: ✭ 1,507 (+1210.43%)
Mutual labels:  profiler
Mesh
A memory allocator that automatically reduces the memory footprint of C/C++ applications.
Stars: ✭ 1,243 (+980.87%)
Mutual labels:  memory
Lwmem
Lightweight dynamic memory manager library for embedded systems with memory constraints. It implements malloc, calloc, realloc and free functions
Stars: ✭ 92 (-20%)
Mutual labels:  memory
Node Cache
a node internal (in-memory) caching module
Stars: ✭ 1,660 (+1343.48%)
Mutual labels:  memory
Sharlayan
Visit us on Discord! https://discord.gg/aCzSANp
Stars: ✭ 91 (-20.87%)
Mutual labels:  memory

memprof

memprof is a memory profiler for Python.

It logs and plots the memory usage of all the variables during the execution of the decorated methods.

Installation

Stable


::

    sudo pip install --upgrade memprof

or ::

    sudo easy_install --upgrade memprof

or (Debian testing/unstable) ::

    sudo apt-get install python-memprof
       

Development

::

git clone git://github.com/jmdana/memprof.git
cd memprof
sudo python setup.py install

or ::

sudo pip install git+https://github.com/jmdana/memprof

Usage

Using memprof is as easy as adding a decorator to the methods that you want to profile: ::

@memprof
def foo():

And importing the module just by including the line below at the beginning of your Python file: ::

from memprof import memprof

Now you can run as usual and logfiles with the names of your methods will be created (e.g. foo.log).

Generating plots


The logfiles are not very interesting so you might prefer to use the
``-p``/``--plot`` flag: ::

    python -m memprof --plot <python_file>
    python -m memprof -p <python_file>

Which, in addition to the logfile, will generate a plot (``foo.png``):

.. figure:: examples/foo.png
   :alt: Example plot

The grey bar indicates that the ``foo`` method wasn't running at that
point.

The flag may also be passed as an argument to the decorator: ::

    @memprof(plot = True)

Please keep in mind that the former takes precedence over the latter.

Adjusting the threshold

You may also want to specify a threshold. The value will be the minimum size for a variable to appear in the plot (but it will always appear in the logfile!). The default value is 1048576 (1 MB) but you can specify a different threshold (in bytes) with the -t/--threshold flag: ::

python -m memprof --threshold 1024 <python_file>
python -m memprof -t 1024 <python_file>

The threshold may also be passed as an argument to the decorator: ::

@memprof(threshold = 1024)

Please keep in mind that the former takes precedence over the latter.

mp_plot


If, after running ``memprof``, you want to change the threshold and
generate a new plot (or you forgot to use the ``-p``/``--plot`` flag
with ``memprof``), you don't have to re-run! Just call the command: ::

    mp_plot [-h] [-t THRESHOLD] logfiles [logfiles ...]

and generate the plots again doing something like: ::

    mp_plot -t 128 logfile1.log logfile2.log

or: ::

    mp_plot -t 1024 *.log

etc.

Contact
-------

Mailing list

Copyright 2013-2019, Jose M. Dana

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].