Skip to main content

Profiler with time deterministic profiling of functions

Project description

qgprofiler
==============

Installation
--------------
using pip:

```sh
$ pip install qgprofiler
```

using setuptools:

```sh
$ git clone https://github.com/quantumgraph/qgprofiler
$ cd qgprofiler
$ pip install qgprofiler
```

Usage
--------------
#### QGProfiler:

```python
from qgprofiler import QGProfiler

# filename extension can be either json or xml
qg_profiler = QGProfiler('program_root_name', '/path/to/your/file/filename.json') # program started
qg_profiler.push('test1') # test1 started

qg_profiler.push('test11') # test11 started
qg_profiler.pop() # test11 ended

qg_profiler.push('test12') # test12 started
qg_profiler.push('test121') # test121 started
qg_profiler.pop() # test121 ended
qg_profiler.pop() # test12 ended

qg_profiler.pop() # test1 ended

qg_profiler.push('test2') # test2 started
qg_profiler.pop() # test2 ended

qg_profiler.end() # program ended

qg_profiler.generate_file() # will generate the file
```

This generates a file which conatains a json
```json
{
"name": "program_root_name",
"value": 0.00142,
"children": [
{
"name": "test1",
"value": 0.00031,
"children": [
{"name": "test11", "value": 4.6e-05, "children": []},
{
"name": "test12",
"value": 0.000118,
"children": [
{"name": "test121", "value": 3.8e-05, "children": []}
]
}
]
},
{"name": "test2", "value": 3.6e-05, "children": []}
]
}
```

File generated if .xml is given as extension
```xml
<program_root_name value="0.00142">
<test1 value="0.000309">
<test11 value="4.5e-05"></test11>
<test12 value="0.00012">
<test121 value="3.8e-05"></test121>
</test12>
</test1>
<test2 value="3.6e-05"></test2>
</program_root_name>
```

#### QGProfileAggregator:

```python
qg_profile_agg = QGProfileAggregator('/your/file/path/*.json', '/path/to/your/file/filename.xml')
qg_profile_agg.generate_file() # this agrregates all the json files into 1 file

```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qgprofiler-0.1.4.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file qgprofiler-0.1.4.tar.gz.

File metadata

  • Download URL: qgprofiler-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for qgprofiler-0.1.4.tar.gz
Algorithm Hash digest
SHA256 80a9cea2ceeebf1e95ecb4fb9b9461670c02c0d2144534030d8961152f5160af
MD5 11c0d289d9fd73555d931a98566c49fd
BLAKE2b-256 c1bf82a650c9e4cd76bc4bff57bc00ed7f483890dd807e439e7e3ba80e20f40f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page