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.5.tar.gz (4.7 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for qgprofiler-0.1.5.tar.gz
Algorithm Hash digest
SHA256 189ac109a15f3f4f258ab3540ca26e2a9fb3dfac675248648e6513c54c234716
MD5 4d9ca33d1f5306abe1b0970a1bd45663
BLAKE2b-256 b9f645d869fdc815e70f27ec8f275a74195de2720f301bb094939471488438f4

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