Code Monkey home page Code Monkey logo

memprofiler's Introduction

memprofiler

PyPI PyPI - Python Version Binder

memprofiler is a simple extension for monitoring memory usage of Jupyter notebook cells.

Installation

It can be installed as a typical Python source package from PyPi using pip:

pip install memprofiler

Usage

A basic example of how to use this extension can be found in this interactive Jupyter notebook.

Reference

mprof_run

%mprof_run [-q] [-i INTERVAL] [-p] [profile_id]

Run memory profiler during cell execution. (cell_magic)

  • positional arguments:

    • profile_id
      Profile label. You can specify up to two keywords by separating them with :: (keyword0::keyword1). Only profile_ids with two keywords can be used in plot-related functions.
  • optional arguments:

    • -q, --quiet
      Suppress verbosity.

    • -i INTERVAL, --interval INTERVAL
      Sampling period (in seconds), default 0.01.

    • -p, --plot
      Plot the memory profile.

mprof_plot

%mprof_plot [-t TITLE] [--groupby {0,1}] profile_ids [profile_ids ...]

Plot detailed memory profiler results. (line_magic)

  • positional arguments:

    • profile_ids
      Profile identifiers made by mprof_run. Supports regex.
  • optional arguments:

    • -t TITLE, --title TITLE
      String shown as plot title.

    • --groupby <{0,1}>
      Identifier number used to group the results, default 1.

mprof_barplot

%mprof_barplot [-t TITLE] [--variable {time,memory}] [--barmode {group,stack}] [--groupby {0,1}] profile_ids [profile_ids ...]

Plot only-memory or only-time results in a bar chart. (line_magic)

  • positional arguments:

    • profile_ids
      Profile labels made by mprof_run. Supports regex.
  • optional arguments:

    • -t TITLE, --title TITLE
      String shown as plot title.

    • --variable <{time,memory}>
      Variable to plot, default 'memory'.

    • --barmode <{group,stack}>
      Bar char mode, default 'group'.

    • --groupby <{0,1}>
      Identifier number used to group the results, default 1.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the BSD 3-Clause License. See LICENSE for more information.

Acknowledgements

memprofiler's People

Contributors

aleixalcacer avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

francescalted

memprofiler's Issues

Bar charts

In %mprof_plot:

  • Use --time flag to plot the time in a bar chart.
  • Use --memory flag to plot the memory peak in a bar chart.

Consider increasing the resolution of the "download plot" button

The current resolution of the plots when using the "download plot" button is a bit too poor for e.g. blog publication. It would be nice if resolution can be tailored somehow (via a flag of %mprof_plot) or just set the default to more resolution (1000 x 1400 instead of 500 x 700 which is the default).

More info on customizing plotly resolutions at: https://plotly.com/python/configuration-options/ (section Customizing Modebar "Download Plot" Button).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.