Module Expr Str Import alias If UnaryOpNot Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr Dict FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad orelse If Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Assign NameStore ListComp Call NameLoad NameLoad comprehension NameStore NameLoad orelse If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list Import alias Import alias Import alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Dict Expr Call AttributeLoad NameLoad attr Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str NameLoad Lambda arguments args NameParam defaults BoolOpOr BoolOpAnd SubscriptLoad NameLoad Index Str BinOpDiv SubscriptLoad NameLoad Index Str Call NameLoad SubscriptLoad NameLoad Index Str Num Lambda arguments args NameParam defaults BinOpDiv SubscriptLoad NameLoad Index Str Call SubscriptLoad NameLoad Index Str NameLoad Lambda arguments args NameParam defaults BoolOpOr BoolOpAnd SubscriptLoad NameLoad Index Str BinOpDiv SubscriptLoad NameLoad Index Str Call NameLoad SubscriptLoad NameLoad Index Str Num Lambda arguments args NameParam defaults BinOpDiv SubscriptLoad NameLoad Index Str Call SubscriptLoad NameLoad Index Str NameLoad Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Num Lambda arguments args NameParam defaults BinOpDiv Call NameLoad SubscriptLoad NameLoad Index Str Call SubscriptLoad NameLoad Index Str NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Num Num Lambda arguments args NameParam defaults BinOpSub Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Dict Assign NameStore Lambda arguments args NameParam defaults BinOpSub Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad AugAssignAdd AttributeStore NameLoad attr Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad AugAssignAdd AttributeStore NameLoad attr Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore Num Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr While NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call NameLoad NameLoad If CompareLtLtE Num NameLoad NameLoad body Break Assign NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AugAssignAdd AttributeStore NameLoad attr Call NameLoad NameLoad Return NameLoad decorator_list decorator_list Assign NameStore Lambda arguments args NameParam defaults BoolOpOr BoolOpAnd SubscriptLoad NameLoad Index Str BinOpDiv SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Num ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call AttributeLoad NameLoad attr Str NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr Str body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr AugAssignAdd SubscriptStore NameLoad Index Str Num AugAssignAdd SubscriptStore NameLoad Index Str Num Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Call AttributeLoad NameLoad attr Dict Str Str Str Str Str Str Str Str NameLoad NameLoad Lambda arguments args NameParam defaults BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num Num NameLoad kwarg body Expr Str Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd SubscriptStore NameLoad Index Str NameLoad If AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index Str Str orelse Assign NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str BoolOpOr Call NameLoad NameLoad Str NameLoad AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr Assign NameStore BinOpSub SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd SubscriptStore NameLoad Index Str NameLoad AugAssignSub SubscriptStore NameLoad Index Str Num If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Dict Assign NameStore Call AttributeLoad NameLoad attr NameLoad Dict Str Str Str Str Str NameLoad NameLoad Num Num NameLoad If BoolOpOr CompareIs SubscriptLoad NameLoad Index Str NameLoad CompareLt NameLoad SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str NameLoad If BoolOpOr CompareIs SubscriptLoad NameLoad Index Str NameLoad CompareGt NameLoad SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd SubscriptStore NameLoad Index Str Num AugAssignAdd SubscriptStore NameLoad Index Str NameLoad If BoolOpAnd NameLoad CompareGt NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str ListLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If CompareGt Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Num decorator_list decorator_list Import alias Assign AttributeStore AttributeLoad NameLoad attr attr Call NameLoad Import alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body Import alias handlers ExceptHandler type NameLoad body TryExcept body Import alias identifier handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Call NameLoad Assign NameStore Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad Assign NameStore Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults body Assign NameStore Str Assign NameStore Str If NameLoad body Assign NameStore Str orelse Assign NameStore Str Return BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad decorator_list Return NameLoad decorator_list ClassDef bases NameLoad body Assign NameStore Dict Str Str Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Call NameLoad Str Str Str Str Str NameLoad Str NameLoad Str Str Dict Str Str Str NameLoad Str NameLoad Dict Str Str Str Str Str Str Str Str Dict Str Str Str Str Str Str Str NameLoad Str NameLoad Dict Str Str Str Call NameLoad Str Str NameLoad FunctionDef arguments args NameParam defaults body Expr Yield Str For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr body Expr Yield BinOpMod Str NameLoad For TupleStore NameStore TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore BinOpMod NameLoad Num If CompareEq NameLoad Num body Expr Yield Str Expr Yield BinOpMod Str Call NameLoad If CompareEq NameLoad Num body Expr Yield Str If CompareEq NameLoad Num body Expr Yield Str orelse If CompareEq NameLoad Num body Expr Yield Str Expr Yield Str For TupleStore NameStore NameStore NameStore NameLoad body Expr Yield BinOpMod Str NameLoad For NameStore NameLoad body Expr Yield BinOpMod Str NameLoad Expr Yield Str For NameStore NameLoad body Expr Yield Str For NameStore NameLoad body Expr Yield BinOpMod Str NameLoad Expr Yield Str Expr Yield Str Expr Yield Str decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Dict If Call NameLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad BinOpAdd ListLoad Str NameLoad NameLoad orelse If Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpMod NameLoad NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Expr Yield TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr body For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue If CompareNotIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore ListLoad NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpMod NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore NameLoad body For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue If CompareNotIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue If Call NameLoad NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpMod NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad NameLoad decorator_list If CompareIsNot NameLoad NameLoad body FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad AttributeLoad NameLoad attr attr Index Str Str Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Num decorator_list Assign AttributeStore NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Index Str NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict Str Str NameLoad ListLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Dict Index Str NameLoad Raise Call AttributeLoad NameLoad attr Str decorator_list Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict Str Str NameLoad ListLoad Str decorator_list
N/A N/A CPStats, a package for collecting and reporting on program statistics.

Overview
========

Statistics about program operation are an invaluable monitoring and debugging
tool. Unfortunately, the gathering and reporting of these critical values is
usually ad-hoc. This package aims to add a centralized place for gathering
statistical performance data, a structure for recording that data which
provides for extrapolation of that data into more useful information,
and a method of serving that data to both human investigators and
monitoring software. Let's examine each of those in more detail.

Data Gathering
--------------

Just as Python's `logging` module provides a common importable for gathering
and sending messages, performance statistics would benefit from a similar
common mechanism, and one that does *not* require each package which wishes
to collect stats to import a third-party module. Therefore, we choose to
re-use the `logging` module by adding a `statistics` object to it.

That `logging.statistics` object is a nested dict. It is not a custom class,
because that would 1) require libraries and applications to import a third-
party module in order to participate, 2) inhibit innovation in extrapolation
approaches and in reporting tools, and 3) be slow. There are, however, some
specifications regarding the structure of the dict.

    {
   +----"SQLAlchemy": {
   |        "Inserts": 4389745,
   |        "Inserts per Second":
   |            lambda s: s["Inserts"] / (time() - s["Start"]),
   |  C +---"Table Statistics": {
   |  o |        "widgets": {-----------+
 N |  l |            "Rows": 1.3M,      | Record
 a |  l |            "Inserts": 400,    |
 m |  e |        },---------------------+
 e |  c |        "froobles": {
 s |  t |            "Rows": 7845,
 p |  i |            "Inserts": 0,
 a |  o |        },
 c |  n +---},
 e |        "Slow Queries":
   |            [{"Query": "SELECT * FROM widgets;",
   |              "Processing Time": 47.840923343,
   |              },
   |             ],
   +----},
    }

The `logging.statistics` dict has four levels. The topmost level is nothing
more than a set of names to introduce modularity, usually along the lines of
package names. If the SQLAlchemy project wanted to participate, for example,
it might populate the item `logging.statistics['SQLAlchemy']`, whose value
would be a second-layer dict we call a "namespace". Namespaces help multiple
packages to avoid collisions over key names, and make reports easier to read,
to boot. The maintainers of SQLAlchemy should feel free to use more than one
namespace if needed (such as 'SQLAlchemy ORM'). Note that there are no case
or other syntax constraints on the namespace names; they should be chosen
to be maximally readable by humans (neither too short nor too long).

Each namespace, then, is a dict of named statistical values, such as
'Requests/sec' or 'Uptime'. You should choose names which will look
good on a report: spaces and capitalization are just fine.

In addition to scalars, values in a namespace MAY be a (third-layer)
dict, or a list, called a "collection". For example, the CherryPy StatsTool
keeps track of what each request is doing (or has most recently done)
in a 'Requests' collection, where each key is a thread ID; each
value in the subdict MUST be a fourth dict (whew!) of statistical data about
each thread. We call each subdict in the collection a "record". Similarly,
the StatsTool also keeps a list of slow queries, where each record contains
data about each slow query, in order.

Values in a namespace or record may also be functions, which brings us to:

Extrapolation
-------------

The collection of statistical data needs to be fast, as close to unnoticeable
as possible to the host program. That requires us to minimize I/O, for example,
but in Python it also means we need to minimize function calls. So when you
are designing your namespace and record values, try to insert the most basic
scalar values you already have on hand.

When it comes time to report on the gathered data, however, we usually have
much more freedom in what we can calculate. Therefore, whenever reporting
tools (like the provided StatsPage CherryPy class) fetch the contents of
`logging.statistics` for reporting, they first call `extrapolate_statistics`
(passing the whole `statistics` dict as the only argument). This makes a
deep copy of the statistics dict so that the reporting tool can both iterate
over it and even change it without harming the original. But it also expands
any functions in the dict by calling them. For example, you might have a
'Current Time' entry in the namespace with the value "lambda scope: time.time()".
The "scope" parameter is the current namespace dict (or record, if we're
currently expanding one of those instead), allowing you access to existing
static entries. If you're truly evil, you can even modify more than one entry
at a time.

However, don't try to calculate an entry and then use its value in further
extrapolations; the order in which the functions are called is not guaranteed.
This can lead to a certain amount of duplicated work (or a redesign of your
schema), but that's better than complicating the spec.

After the whole thing has been extrapolated, it's time for:

Reporting
---------

The StatsPage class grabs the `logging.statistics` dict, extrapolates it all,
and then transforms it to HTML for easy viewing. Each namespace gets its own
header and attribute table, plus an extra table for each collection. This is
NOT part of the statistics specification; other tools can format how they like.

You can control which columns are output and how they are formatted by updating
StatsPage.formatting, which is a dict that mirrors the keys and nesting of
`logging.statistics`. The difference is that, instead of data values, it has
formatting values. Use None for a given key to indicate to the StatsPage that a
given column should not be output. Use a string with formatting (such as '%.3f')
to interpolate the value(s), or use a callable (such as lambda v: v.isoformat())
for more advanced formatting. Any entry which is not mentioned in the formatting
dict is output unchanged.

Monitoring
----------

Although the HTML output takes pains to assign unique id's to each <td> with
statistical data, you're probably better off fetching /cpstats/data, which
outputs the whole (extrapolated) `logging.statistics` dict in JSON format.
That is probably easier to parse, and doesn't have any formatting controls,
so you get the "original" data in a consistently-serialized format.
Note: there's no treatment yet for datetime objects. Try time.time() instead
for now if you can. Nagios will probably thank you.

Turning Collection Off
----------------------

It is recommended each namespace have an "Enabled" item which, if False,
stops collection (but not reporting) of statistical data. Applications
SHOULD provide controls to pause and resume collection by setting these
entries to False or True, if present.


Usage
=====

To collect statistics on CherryPy applications:

    from cherrypy.lib import cpstats
    appconfig['/']['tools.cpstats.on'] = True

To collect statistics on your own code:

    import logging
    # Initialize the repository
    if not hasattr(logging, 'statistics'): logging.statistics = {}
    # Initialize my namespace
    mystats = logging.statistics.setdefault('My Stuff', {})
    # Initialize my namespace's scalars and collections
    mystats.update({
        'Enabled': True,
        'Start Time': time.time(),
        'Important Events': 0,
        'Events/Second': lambda s: (
            (s['Important Events'] / (time.time() - s['Start Time']))),
        })
    ...
    for event in events:
        ...
        # Collect stats
        if mystats.get('Enabled', False):
            mystats['Important Events'] += 1

To report statistics:

    root.cpstats = cpstats.StatsPage()

To format statistics reports:

    See 'Reporting', above.

 N/A logging N/A N/A N/A hasattr logging statistics N/A N/A N/A logging statistics N/A extrapolate_statistics N/A N/A scope N/A N/A N/A Return an extrapolated copy of the given scope. N/A c N/A N/A N/A k v N/A list N/A N/A scope items N/A N/A N/A isinstance v dict N/A N/A v N/A extrapolate_statistics v N/A N/A N/A isinstance v N/A list tuple N/A N/A v N/A N/A extrapolate_statistics record N/A record v N/A N/A N/A hasattr v __call__ N/A N/A v N/A v scope N/A N/A c N/A k v N/A c N/A N/A threading N/A time N/A cherrypy N/A appstats N/A N/A N/A logging statistics setdefault CherryPy Applications N/A N/A N/A N/A appstats update N/A Enabled Bytes Read/Request Bytes Read/Second Bytes Written/Request Bytes Written/Second Current Time Current Requests Requests/Second Server Version Start Time Total Bytes Read Total Bytes Written Total Requests Total Time Uptime Requests True N/A N/A N/A s N/A N/A N/A N/A s N/A Total Requests N/A N/A s N/A Total Bytes Read N/A float N/A s N/A Total Requests 0.0 N/A N/A N/A s N/A N/A N/A s N/A Total Bytes Read N/A N/A s N/A Uptime s N/A N/A N/A s N/A N/A N/A N/A s N/A Total Requests N/A N/A s N/A Total Bytes Written N/A float N/A s N/A Total Requests 0.0 N/A N/A N/A s N/A N/A N/A s N/A Total Bytes Written N/A N/A s N/A Uptime s N/A N/A N/A s N/A N/A N/A time time 0 N/A N/A N/A s N/A N/A N/A float N/A s N/A Total Requests N/A N/A s N/A Uptime s N/A cherrypy __version__ N/A N/A time time 0 0 0 0 N/A N/A N/A s N/A N/A N/A N/A time time N/A s N/A Start Time N/A N/A proc_time N/A N/A N/A s N/A N/A N/A N/A time time N/A s N/A Start Time ByteCountWrapper N/A object N/A N/A Wraps a file-like object, counting the number of bytes read. __init__ N/A N/A self rfile N/A N/A N/A N/A self rfile rfile N/A N/A self bytes_read 0 N/A read N/A N/A self size N/A -1 N/A N/A data N/A N/A N/A self rfile read size N/A N/A self bytes_read N/A len data N/A data N/A readline N/A N/A self size N/A -1 N/A N/A data N/A N/A N/A self rfile readline size N/A N/A self bytes_read N/A len data N/A data N/A readlines N/A N/A self sizehint N/A 0 N/A N/A total 0 N/A lines N/A N/A line N/A N/A self readline N/A line N/A N/A N/A N/A lines append line N/A total N/A len line N/A N/A 0 sizehint total N/A N/A N/A line N/A N/A self readline N/A lines N/A close N/A N/A self N/A N/A N/A N/A N/A N/A self rfile close N/A __iter__ N/A N/A self N/A N/A N/A self N/A next N/A N/A self N/A N/A N/A data N/A N/A N/A self rfile next N/A N/A self bytes_read N/A len data N/A data N/A N/A N/A average_uriset_time N/A N/A N/A s N/A N/A N/A N/A s N/A Count N/A N/A s N/A Sum N/A s N/A Count 0 StatsTool N/A N/A cherrypy Tool N/A N/A Record various information about the current request. __init__ N/A N/A self N/A N/A N/A N/A N/A N/A cherrypy Tool __init__ self on_end_request N/A self record_stop N/A _setup N/A N/A self N/A N/A N/A Hook this tool into cherrypy.request.
        
        The standard CherryPy request object will automatically call this
        method when the tool is "turned on" in config.
         N/A N/A N/A appstats get Enabled False N/A N/A N/A N/A N/A cherrypy Tool _setup self N/A N/A N/A self record_start N/A record_start N/A N/A self N/A N/A N/A Record the beginning of a request. N/A request N/A N/A cherrypy serving request N/A N/A N/A hasattr N/A request rfile bytes_read N/A N/A N/A request rfile N/A ByteCountWrapper N/A request rfile N/A N/A N/A request body fp N/A request rfile N/A r N/A request remote N/A N/A appstats N/A Current Requests 1 N/A N/A appstats N/A Total Requests 1 N/A N/A N/A appstats N/A Requests N/A N/A N/A threading _get_ident N/A Bytes Read Bytes Written Client End Time Processing Time Request-Line Response Status Start Time None None N/A N/A N/A s N/A N/A %s:%s N/A N/A r ip N/A r port None proc_time N/A request request_line None N/A N/A time time N/A record_stop N/A N/A self uriset slow_queries slow_queries_count debug N/A None 1.0 100 False kwargs N/A N/A Record the end of a request. N/A resp N/A N/A cherrypy serving response N/A w N/A N/A appstats N/A Requests N/A N/A N/A threading _get_ident N/A r N/A N/A N/A cherrypy request rfile bytes_read N/A N/A w N/A Bytes Read r N/A N/A appstats N/A Total Bytes Read r N/A N/A resp stream N/A N/A N/A w N/A Bytes Written chunked N/A N/A cl N/A int N/A N/A N/A resp headers get Content-Length 0 N/A N/A w N/A Bytes Written cl N/A N/A appstats N/A Total Bytes Written cl N/A N/A w N/A Response Status N/A N/A getattr resp output_status None N/A resp status N/A N/A w N/A End Time N/A N/A time time N/A p N/A N/A w N/A End Time N/A w N/A Start Time N/A N/A w N/A Processing Time p N/A N/A appstats N/A Total Time p N/A N/A appstats N/A Current Requests 1 N/A debug N/A N/A N/A N/A cherrypy log N/A Stats recorded: %s N/A repr w TOOLS.CPSTATS N/A uriset N/A N/A rs N/A N/A appstats setdefault URI Set Tracking N/A N/A r N/A N/A rs setdefault uriset N/A Min Max Count Sum Avg None None 0 0 average_uriset_time N/A N/A N/A N/A r N/A Min None N/A p N/A r N/A Min N/A N/A N/A r N/A Min p N/A N/A N/A N/A r N/A Max None N/A p N/A r N/A Max N/A N/A N/A r N/A Max p N/A N/A r N/A Count 1 N/A N/A r N/A Sum p N/A N/A slow_queries N/A p slow_queries N/A N/A sq N/A N/A appstats setdefault Slow Queries N/A N/A N/A N/A sq append N/A N/A w copy N/A N/A N/A len sq slow_queries_count N/A N/A N/A N/A sq pop 0 N/A N/A N/A cherrypy N/A N/A N/A cherrypy tools cpstats N/A StatsTool N/A os N/A thisdir N/A N/A N/A os path abspath N/A N/A N/A os path dirname __file__ N/A N/A N/A json N/A N/A N/A ImportError N/A N/A N/A N/A simplejson json N/A N/A N/A ImportError N/A N/A json None N/A missing N/A object N/A locale_date N/A N/A N/A v N/A N/A N/A time strftime %c N/A N/A time gmtime v N/A iso_format N/A N/A N/A v N/A N/A N/A time strftime %Y-%m-%d %H:%M:%S N/A N/A time gmtime v pause_resume N/A N/A ns N/A N/A _pause_resume N/A N/A enabled N/A N/A N/A pause_disabled N/A resume_disabled N/A enabled N/A N/A resume_disabled disabled="disabled"  N/A N/A pause_disabled disabled="disabled"  N/A N/A 
            <form action="pause" method="POST" style="display:inline">
            <input type="hidden" name="namespace" value="%s" />
            <input type="submit" value="Pause" %s/>
            </form>
            <form action="resume" method="POST" style="display:inline">
            <input type="hidden" name="namespace" value="%s" />
            <input type="submit" value="Resume" %s/>
            </form>
             N/A ns pause_disabled ns resume_disabled N/A N/A _pause_resume N/A StatsPage N/A object N/A N/A formatting N/A CherryPy Applications CherryPy WSGIServer N/A Enabled Bytes Read/Request Bytes Read/Second Bytes Written/Request Bytes Written/Second Current Time Requests/Second Start Time Total Time Uptime Slow Queries URI Set Tracking Requests N/A pause_resume CherryPy Applications %.3f %.3f %.3f %.3f iso_format %.3f iso_format %.3f %.3f N/A End Time Processing Time Start Time None %.3f iso_format N/A Avg Max Min Sum %.3f %.3f %.3f %.3f N/A Bytes Read Bytes Written End Time Processing Time Start Time %s %s None %.3f None N/A Enabled Connections/second Start time N/A pause_resume CherryPy WSGIServer %.3f iso_format index N/A N/A self N/A N/A N/A N/A 
<html>
<head>
    <title>Statistics</title>
<style>

th, td {
    padding: 0.25em 0.5em;
    border: 1px solid #666699;
}

table {
    border-collapse: collapse;
}

table.stats1 {
    width: 100%;
}

table.stats1 th {
    font-weight: bold;
    text-align: right;
    background-color: #CCD5DD;
}

table.stats2, h2 {
    margin-left: 50px;
}

table.stats2 th {
    font-weight: bold;
    text-align: center;
    background-color: #CCD5DD;
}

</style>
</head>
<body>
 N/A N/A title scalars collections N/A N/A self get_namespaces N/A N/A N/A N/A 
<h1>%s</h1>

<table class='stats1'>
    <tbody>
 title N/A N/A i N/A key value N/A enumerate scalars N/A N/A colnum N/A i 3 N/A N/A colnum 0 N/A N/A N/A 
        <tr> N/A N/A N/A 
            <th>%(key)s</th><td id='%(title)s-%(key)s'>%(value)s</td> N/A vars N/A N/A colnum 2 N/A N/A N/A 
        </tr> N/A N/A colnum 0 N/A N/A N/A 
            <th></th><td></td>
            <th></th><td></td>
        </tr> N/A N/A N/A colnum 1 N/A N/A N/A 
            <th></th><td></td>
        </tr> N/A N/A 
    </tbody>
</table> N/A N/A subtitle headers subrows collections N/A N/A N/A N/A 
<h2>%s</h2>
<table class='stats2'>
    <thead>
        <tr> subtitle N/A key headers N/A N/A N/A N/A 
            <th>%s</th> key N/A N/A 
        </tr>
    </thead>
    <tbody> N/A subrow subrows N/A N/A N/A 
        <tr> N/A value subrow N/A N/A N/A N/A 
            <td>%s</td> value N/A N/A 
        </tr> N/A N/A 
    </tbody>
</table> N/A N/A 
</body>
</html>
 N/A N/A N/A index exposed True get_namespaces N/A N/A self N/A N/A N/A Yield (title, scalars, collections) for each namespace. N/A s N/A extrapolate_statistics N/A logging statistics N/A N/A title ns N/A sorted N/A N/A s items N/A N/A scalars N/A N/A collections N/A N/A ns_fmt N/A N/A N/A self formatting get title N/A N/A N/A k v N/A sorted N/A N/A ns items N/A N/A fmt N/A N/A ns_fmt get k N/A N/A N/A isinstance v dict N/A N/A N/A headers subrows N/A N/A self get_dict_collection v fmt N/A N/A N/A collections append N/A k N/A N/A ID headers subrows N/A N/A N/A isinstance v N/A list tuple N/A N/A N/A headers subrows N/A N/A self get_list_collection v fmt N/A N/A N/A collections append N/A k headers subrows N/A N/A format N/A N/A ns_fmt get k missing N/A N/A format None N/A N/A N/A N/A hasattr format __call__ N/A N/A v N/A format v N/A N/A N/A format missing N/A N/A v N/A format v N/A N/A N/A scalars append N/A k v N/A N/A N/A title scalars collections N/A get_dict_collection N/A N/A self v formatting N/A N/A N/A Return ([headers], [rows]) for the given collection. N/A headers N/A N/A record N/A N/A v itervalues N/A N/A k3 record N/A N/A format N/A N/A formatting get k3 missing N/A N/A format None N/A N/A N/A N/A k3 headers N/A N/A N/A N/A headers append k3 N/A N/A N/A headers sort N/A subrows N/A N/A N/A k2 record N/A sorted N/A N/A v items N/A N/A subrow N/A k2 N/A k3 headers N/A N/A v3 N/A N/A record get k3 N/A format N/A N/A formatting get k3 missing N/A N/A format None N/A N/A N/A N/A hasattr format __call__ N/A N/A v3 N/A format v3 N/A N/A N/A format missing N/A N/A v3 N/A format v3 N/A N/A N/A subrow append v3 N/A N/A N/A subrows append subrow N/A N/A headers subrows N/A get_list_collection N/A N/A self v formatting N/A N/A N/A Return ([headers], [subrows]) for the given collection. N/A headers N/A N/A record v N/A N/A k3 record N/A N/A format N/A N/A formatting get k3 missing N/A N/A format None N/A N/A N/A N/A k3 headers N/A N/A N/A N/A headers append k3 N/A N/A N/A headers sort N/A subrows N/A N/A record v N/A N/A subrow N/A N/A k3 headers N/A N/A v3 N/A N/A record get k3 N/A format N/A N/A formatting get k3 missing N/A N/A format None N/A N/A N/A N/A hasattr format __call__ N/A N/A v3 N/A format v3 N/A N/A N/A format missing N/A N/A v3 N/A format v3 N/A N/A N/A subrow append v3 N/A N/A N/A subrows append subrow N/A N/A headers subrows N/A N/A N/A json None N/A data N/A N/A self N/A N/A N/A s N/A extrapolate_statistics N/A logging statistics N/A N/A N/A N/A cherrypy response headers N/A Content-Type application/json N/A N/A N/A json dumps s sort_keys True indent 4 N/A N/A N/A data exposed True pause N/A N/A self namespace N/A N/A N/A N/A N/A N/A N/A logging statistics get namespace N/A N/A Enabled False N/A N/A N/A cherrypy HTTPRedirect ./ N/A N/A N/A pause exposed True N/A N/A pause cp_config N/A tools.allow.on tools.allow.methods True N/A POST resume N/A N/A self namespace N/A N/A N/A N/A N/A N/A N/A logging statistics get namespace N/A N/A Enabled True N/A N/A N/A cherrypy HTTPRedirect ./ N/A N/A N/A resume exposed True N/A N/A resume cp_config N/A tools.allow.on tools.allow.methods True N/A POST N/A