Skip to content

Commit

Permalink
Merge 7d28963 into 6763652
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Dec 2, 2016
2 parents 6763652 + 7d28963 commit 9905688
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ os:

env:
matrix:
- PYTHON_VERSION=2.7
- PYTHON_VERSION=3.3
- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5
- PYTHON_VERSION=2.7 PSUTIL_VERSION=1
- PYTHON_VERSION=2.7 PSUTIL_VERSION=2
- PYTHON_VERSION=3.3 PSUTIL_VERSION=3
- PYTHON_VERSION=3.4 PSUTIL_VERSION=4
- PYTHON_VERSION=3.5 PSUTIL_VERSION=5
global:
- CONDA_DEPENDENCIES='numpy matplotlib psutil'
- PIP_DEPENDENCIES='coveralls pytest-cov'
- SETUP_XVFB=True

before_install:
- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh
- source ci-helpers/travis/setup_conda.sh

script:
- py.test --cov psrecord psrecord
- python setup.py check --restructuredtext

after_success:
- coveralls
70 changes: 42 additions & 28 deletions README.md → README.rst
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
[![Build Status](https://travis-ci.org/astrofrog/psrecord.svg?branch=master)](https://travis-ci.org/astrofrog/psrecord) [![Coverage Status](https://coveralls.io/repos/astrofrog/psrecord/badge.svg)](https://coveralls.io/r/astrofrog/psrecord)
|Build Status| |Coverage Status|

About
=====

``psrecord`` is a small utility that uses the
[psutil](https://code.google.com/p/psutil/) library to record the CPU and
memory activity of a process. The package is still under development and is
therefore experimental.
`psutil <https://code.google.com/p/psutil/>`__ library to record the CPU
and memory activity of a process. The package is still under development
and is therefore experimental.

The code is released under a Simplified BSD License, which is given in the
``LICENSE`` file.
The code is released under a Simplified BSD License, which is given in
the ``LICENSE`` file.

Requirements
============

* Python 2.x or 3.x
* [psutil](https://code.google.com/p/psutil/)
* [matplotlib](http://www.matplotlib.org) (optional, used for plotting)
- Python 2.7 or 3.3 and higher
- `psutil <https://code.google.com/p/psutil/>`__
- `matplotlib <http://www.matplotlib.org>`__ (optional, used for
plotting)

Installation
============

To install:
To install, simply do::

pip install psrecord

or if you want the latest developer version:

git clone https://github.com/astrofrog/psrecord
cd psrecord
python setup.py install

Usage
=====

Expand All @@ -39,11 +34,15 @@ Basics

To record the CPU and memory activity of an existing process to a file:

::

psrecord 1330 --log activity.txt

where ``1330`` is an example of a process ID which you can find with ``ps`` or
``top``. You can also use ``psrecord`` to start up a process by specifying the
command in quotes:
where ``1330`` is an example of a process ID which you can find with
``ps`` or ``top``. You can also use ``psrecord`` to start up a process
by specifying the command in quotes:

::

psrecord "hyperion model.rtin model.rtout" --log activity.txt

Expand All @@ -52,27 +51,35 @@ Plotting

To make a plot of the activity:

::

psrecord 1330 --plot plot.png

This will produce a plot such as:

![screenshot](screenshot.png)
.. image:: https://github.com/astrofrog/psrecord/raw/master/screenshot.png

You can combine these options to write the activity to a file and make a plot
at the same time:
You can combine these options to write the activity to a file and make a
plot at the same time:

::

psrecord 1330 --log activity.txt --plot plot.png

Duration and intervals
----------------------

By default, the monitoring will continue until the process is stopped. You can
also specify a maximum duration in seconds:
By default, the monitoring will continue until the process is stopped.
You can also specify a maximum duration in seconds:

::

psrecord 1330 --log activity.txt --duration 10

Finally, the process is polled as often as possible by default, but it is
possible to set the time between samples in seconds:
Finally, the process is polled as often as possible by default, but it
is possible to set the time between samples in seconds:

::

psrecord 1330 --log activity.txt --interval 2

Expand All @@ -81,10 +88,17 @@ Subprocesses

To include sub-processes in the CPU and memory stats, use:

::

psrecord 1330 --log activity.txt --include-children

Reporting issues
================

Please report any issues in the
[issue tracker](https://github.com/astrofrog/psrecord/issues).
Please report any issues in the `issue
tracker <https://github.com/astrofrog/psrecord/issues>`__.

.. |Build Status| image:: https://travis-ci.org/astrofrog/psrecord.svg?branch=master
:target: https://travis-ci.org/astrofrog/psrecord
.. |Coverage Status| image:: https://coveralls.io/repos/astrofrog/psrecord/badge.svg
:target: https://coveralls.io/r/astrofrog/psrecord

0 comments on commit 9905688

Please sign in to comment.