This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Clocked
=======

A library to enable easier profiling, based _**loosely**_ on
[MiniProfiler](http://miniprofiler.com/) For a more full-featured
implementation for use in web development, check out the [GAE Mini Profiler]
(https://github.com/Khan/gae_mini_profiler) This library is meant to be more
lightweight than a full MiniProfiler implementation so that you can quickly
load it into a project and start timing things.

Use Case
========
I was looking to profile some code and came across [this blog post]
(http://www.huyng.com/posts/python-performance-analysis/) that covers things
quite nicely. However, the coarse and fine grain timing sections leaves a lot
up to reader and aren't very robust, so this library is meant to fill the gap.

This library is meant to be used to do higher-level profiling,
where you litter your code with profiling statements and generate a report to
quickly find where your code is spending all of it's time. From there,
fall back to tools like [timeit](https://docs.python.org/2/library/timeit
.html) or [line_profiler](https://github.com/rkern/line_profiler)

To start, initialize the session by calling

```python
Clocked.initialize('at the root scope!')
```

Then run your code with ``clocked`` decorators and/or ``with Clocked``
statements. At the end of the session, output a report with either
``Clocked.verbose_report()`` or ``Clocked.hotspot_report()`` to see some
timing information.

Supported ways to decorate
--------------------------

#### class level

```python
@clocked
class MyClass(object):

def will_be_timed_one(self):
...

def will_be_timed_two(self):
...

```

#### function level

```python
class MyClass(object):

@clocked
def will_be_timed(self):
...

def will_not_be_timed(self):
...

```

Decorators aren't specific to classes, so you can apply them to individual
functions like so

```python
@clocked
def some_function():
...
```

How to use inline
-----------------

You can use the Clocked object to time something without using a decorator

```python
with Clocked("i'm timing this!"):
...
```

Generate a report
-----------------

To get at the timing information, the simplest thing to do is generate a report

```python
>>> Clocked.verbose_report()
"""
All timing information:
-----------------------
test raw simple (326.5 ms)
loop 1 (326.5 ms)
"""
>>> Clocked.hotspot_report()
"""
Hotspots:
---------
loop 4 (164.5 ms [19.9, 22.0], 8 hits)
loop 3 (160.8 ms [19.9, 20.9], 8 hits)
loop 2 (1.0 ms [0.2, 0.3], 4 hits)
loop 1 (0.2 ms [0.2, 0.2], 1 hits)
test raw simple (0.0 ms [0.0, 0.0], 1 hits)
"""
```

Performance
-----------

To improve performance when testing single-threaded applications,
enable faster uuid generation by turning on thread unsafe uuid generation with
``clocked.cuuid.toggle_thread_unsafe_uuid(True)``
Release History

Release History

0.62

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.61

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
clocked-0.62.zip (11.9 kB) Copy SHA256 Checksum SHA256 Source Nov 16, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting