Giter Site home page Giter Site logo

profiling's Introduction

Profiling

The profiling package is an interactive Python profiler. It is inspired from Unity 3D profiler. This package provides these features:

  1. Profiling statistics keep the frame stack.
  2. An interactive TUI profiling statistics viewer.
  3. Utilities for remote profiling.
  4. Thread or greenlet aware CPU timer.
  5. Supports both of Python 2 and Python 3.

[![Build Status] (https://travis-ci.org/what-studio/profiling.svg)] (https://travis-ci.org/what-studio/profiling) [![Coverage Status] (https://coveralls.io/repos/what-studio/profiling/badge.png)] (https://coveralls.io/r/what-studio/profiling)

Installation

This project is under development yet. So you should install it via GitHub instead of PyPI:

pip install git+https://github.com/what-studio/profiling.git

Profiling

To profile a single program, simply run profile command:

$ python -m profiling profile your-program.py

Then an interactive viewer will be executed:

If your program uses greenlets, choose greenlet timer:

$ python -m profiling profile your-program.py --timer=greenlet

With --dump option, it saves the profiling result to a file. You can browse save result by view command:

$ python -m profiling profile your-program.py --dump=your-program.prf
$ python -m profiling view your-program.prf

Live-profiling

If your program has a long life time like a web server, profiling result at the end of progam doesn't help you. You will need a continuos profiler. It works by live-profile command:

$ python -m profiling live-profile webserver.py

See a demo.

There's a live-profiling server also. The server doesn't profile the program at ordinary times. But when a client connects to the server, it runs profiler and reports to the all connected clients. Start a server with remote-profile command:

$ python -m profiling remote-profile webserver.py --bind 127.0.0.1:8912

Then run a client with view command:

$ python -m profiling view 127.0.0.1:8912

Viewer key commands

  • q - Quit.
  • space - Pause/Resume.
  • and - Navigate frames.
  • - Expand the frame.
  • - Fold the frame.
  • > - Go to the hotspot.
  • esc - Defocus.
  • [ and ] - Change sorting colunm.

Licensing

This project is opened under the BSD 3-Clause license.

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.