{ "info": { "author": "QuantumGraph", "author_email": "contact@quantumgraph.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: Freeware", "Programming Language :: Python", "Topic :: Utilities" ], "description": "\nqgprofiler\n==============\n\nQGProfiler is a simple, user controlled profiler. It differs from \nother profilers in that it provides the programmer the control of\ngranularity with which various parts of the program are profiled.\nBy doing this, the programmer can keep profiling overhead low \n(QGProfiler is meant to be used in production), while still getting\nvisibility in the most important components of the program.\n\n\nInstallation\n--------------\nusing pip:\n\n```sh\n$ pip install qgprofiler\n```\n\nusing setuptools:\n\n```sh\n$ git clone https://github.com/quantumgraph/qgprofiler\n$ cd qgprofiler\n$ python setup.py install\n```\n\nUsage\n--------------\n\nThis module consists two main classes **QGProfiler** and **QGProfileAggregator**. Their usage is described and demonstrated below.\n\n### QGProfiler:\n\nQGProfiler takes 2 definite arguments and 1 optional argument:\n - name for the program (this will be the root name of the stack)\n - output filename with path (the filename should end with .json or .xml; if path is not specified than it generates in the current folder with the given file name) \n - an optional custom attributes which can be attached to the node and can be updated ```attributes={'somename': 'max', 'anothername': 'sum'}``` (value can be either 'max' or 'sum'; QGProfiler will do the computation to float up the values to the parent node by the type it has been defined; the idea is to use this feature for calculating memory with max and no.of db calls made with sum feature and so on..)\n\nThis class contains few functions which can be used to evaluate the time taken by each function/module and the number of times the same function/module has been called. The time taken is determined by using simple \n - ```push('name')``` (name can be function name/db query/class module/etc.), \n - ```pop()``` when the execution of the function is done or \n - ```pop_all()``` which helps user to pop all the nodes in stack if the user lost count of how many pushes done. After the end of the program user has to call \n - ```end()``` to end the root program time and then \n - ```generate_file()``` is used for generating either xml or json file. By default QGProfiler will not round the number of values while generate_file to get maximum precision, you can round those values by passing an argument like ```generate_file(rounding_no=6)``` or just ```generate_file(6)```. \n\nA Brief Example is illustrated below with the output to get started:\n\n```python\nimport time\nfrom qgprofiler import QGProfiler\n\n# filename extension can be either json or xml\nqg_profiler = QGProfiler('program_root_name', '/path/to/your/file/filename.json', {'mem': 'max'}) # program started\nqg_profiler.push('test1') # test1 started\ntime.sleep(0.1) # sleep follows that some program is executed\nqg_profiler.update('mem', 10)# update will update the attribute of the node\n\nqg_profiler.push('test11') # test11 started\ntime.sleep(0.5)\nqg_profiler.pop() # test11 ended\n\nqg_profiler.push('test12') # test12 started\ntime.sleep(0.5)\nqg_profiler.update('mem', 10)\nqg_profiler.push('test121') # test121 started\ntime.sleep(1.0)\nqg_profiler.update('mem', 30)\nqg_profiler.pop() # test121 ended\nqg_profiler.pop() # test12 ended\n\nqg_profiler.push('test12') # test12 started\ntime.sleep(0.5)\nqg_profiler.pop() # test121 ended\n\nqg_profiler.pop() # test1 ended\n\nqg_profiler.push('test2') # test2 started\ntime.sleep(0.1)\nqg_profiler.update('mem', 10)\nqg_profiler.pop() # test2 ended\n\nqg_profiler.push('test2') # test2 started\ntime.sleep(0.1)\nqg_profiler.update('mem', 20)\nqg_profiler.pop() # test2 ended\n\nqg_profiler.end() # program ended\n\nqg_profiler.generate_file() # will generate the file\n```\n\nThis generates a file which contains a json\n```json\n{\n \"count\": 1,\n \"name\": \"program_root_name\",\n \"value\": 2.808331,\n \"overhead\": 3.5e-05,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 30}},\n \"children\": [{\n \"count\": 1,\n \"name\": \"test1\",\n \"value\": 2.606762,\n \"overhead\": 0.00013199999999999998,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 30}},\n \"children\": [{\n \"count\": 1,\n \"name\": \"test11\",\n \"value\": 0.501054,\n \"overhead\": 0.00031099999999999997,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 0}},\n \"children\": []\n }, {\n \"count\": 2,\n \"name\": \"test12\",\n \"value\": 2.0043670000000002,\n \"overhead\": 0.000463,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 30}},\n \"children\": [{\n \"count\": 1,\n \"name\": \"test121\",\n \"value\": 1.001872,\n \"overhead\": 0.000338,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 30}},\n \"children\": []\n }]\n }]\n }, {\n \"count\": 2,\n \"name\": \"test2\",\n \"value\": 0.20094299999999998,\n \"overhead\": 0.000297,\n \"attributes\": {\"mem\": {\"type\": \"max\", \"value\": 20}},\n \"children\": []\n }]\n}\n```\n\nFile generated if .xml is given as extension in the filename\n```xml\n\n \n \n \n \n \n \n \n\n```\n\n### QGProfileAggregator:\n\nQGProfileAggregator takes 2 arguments:\n - input filepath (takes unix level command, ex: ~/path/*.xml; takes all xml files specified in the given path)\n - output filename with path (the filename should end with .json or .xml or .html; if path is not specified than it generates in the current folder with the given file name) \n\nThis class contains one function ```generate_file()``` which will aggregate all the files data (.xml or .json whichever is specified or it takes all the files if specified * and process only .xml / .json). This will generate .xml / .json file whichever is specified in output filename. By default QGAggregator will set an argument for rounding the number of value to 6 digits to generate_file, you can overwite it by passing it as argument like ```generate_file(rounding_no=4)``` or just ```generate_file(4)```. If the generated file output is .json or .xml, the format will be as shown as above. But if .html is given as the extension, it will generate a flame graph using d3 which requires active internet connection to download the required js files, and the graph will look like \n\n![Alt text](/qgprofiler/images/flamegraph-1.png?raw=true \"Flame Graph\")\n\nA Brief Example is illustrated below to use it:\n\n```python\nfrom qgprofiler import QGProfileAggregator\n\nqg_profile_agg = QGProfileAggregator('/your/file/path/*.xml', '/path/to/your/file/filename.xml')\nqg_profile_agg.generate_file() # this agrregates all the json/xml files into 1 file\n\n```\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/quantumgraph/qgprofiler", "keywords": "profiler", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "qgprofiler", "package_url": "https://pypi.org/project/qgprofiler/", "platform": "", "project_url": "https://pypi.org/project/qgprofiler/", "project_urls": { "Homepage": "https://github.com/quantumgraph/qgprofiler" }, "release_url": "https://pypi.org/project/qgprofiler/0.1.14/", "requires_dist": null, "requires_python": "", "summary": "Profiler with time deterministic profiling of functions", "version": "0.1.14" }, "last_serial": 3102594, "releases": { "0.1.10": [ { "comment_text": "", "digests": { "md5": "afdde7afb38576a0708cc10d6263b222", "sha256": "33fb152612b6589021d6dd5bab5b09040c910903f5c662c6cc70e9db6995d16e" }, "downloads": -1, "filename": "qgprofiler-0.1.10.tar.gz", "has_sig": false, "md5_digest": "afdde7afb38576a0708cc10d6263b222", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7286, "upload_time": "2017-01-20T13:39:28", "url": "https://files.pythonhosted.org/packages/a1/5c/5d06c49a3dbbe2459ba1814799b2493613654bd50663df925a4e06587ef0/qgprofiler-0.1.10.tar.gz" } ], "0.1.11": [ { "comment_text": "", "digests": { "md5": "61d569ba066d0dfe0c15394433f45824", "sha256": "61f6d6788c0e1417feb34fed17dc5f02b2147fa4410e318e253ca37d2d4d5591" }, "downloads": -1, "filename": "qgprofiler-0.1.11.tar.gz", "has_sig": false, "md5_digest": "61d569ba066d0dfe0c15394433f45824", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7909, "upload_time": "2017-01-23T05:36:55", "url": "https://files.pythonhosted.org/packages/7f/c1/187f7c9d5d51a967882c678fdaed8af6f5b32b6358096a8efbf6c0c03655/qgprofiler-0.1.11.tar.gz" } ], "0.1.12": [ { "comment_text": "", "digests": { "md5": "6b3e82fecd4300484c80786b33483e70", "sha256": "4a99c8deb2c483e3884ec65be6c5a3b5ffe285a26a137b367712904c7573e060" }, "downloads": -1, "filename": "qgprofiler-0.1.12.tar.gz", "has_sig": false, "md5_digest": "6b3e82fecd4300484c80786b33483e70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8100, "upload_time": "2017-01-30T09:38:57", "url": "https://files.pythonhosted.org/packages/4f/99/3d68601443880983a8f87b09c057060ad0493ba414b60c33e908a6375236/qgprofiler-0.1.12.tar.gz" } ], "0.1.13": [ { "comment_text": "", "digests": { "md5": "d50e06ecce6d68f14ff975b89552dcb8", "sha256": "03544e4b5e919afdbe5801c0ac1d293acdf2afd3225105e42dedc63473f799ac" }, "downloads": -1, "filename": "qgprofiler-0.1.13.tar.gz", "has_sig": false, "md5_digest": "d50e06ecce6d68f14ff975b89552dcb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12241, "upload_time": "2017-02-07T11:13:34", "url": "https://files.pythonhosted.org/packages/56/be/29130c52bf6cf7b7930eb40116d19ec2641a458421c08f4a8590673cfb63/qgprofiler-0.1.13.tar.gz" } ], "0.1.14": [ { "comment_text": "", "digests": { "md5": "018bc4523a076b0d3bc8ecf583cc4256", "sha256": "55a5ee136a39ef66c427b5abdf056bfb049fc37cca76861f41f59fd6117df1fb" }, "downloads": -1, "filename": "qgprofiler-0.1.14.tar.gz", "has_sig": false, "md5_digest": "018bc4523a076b0d3bc8ecf583cc4256", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12303, "upload_time": "2017-08-17T05:54:53", "url": "https://files.pythonhosted.org/packages/90/77/44de43ab6b63895529c116559630130a58d060819c073a2b14ee8669dcc1/qgprofiler-0.1.14.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2cf627de85ba3bc0a5d514c3af945e1c", "sha256": "88c556f4120aa83051311a4f7b9c8b1e365fcc88f132e6b18257204a61b6b9ab" }, "downloads": -1, "filename": "qgprofiler-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2cf627de85ba3bc0a5d514c3af945e1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2974, "upload_time": "2017-01-16T06:04:55", "url": "https://files.pythonhosted.org/packages/23/9e/c28fca0567b9145dd17ca7b443dbafeb9c76111c484145be8b1d5b35c5d9/qgprofiler-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c5095639e4bea04def6a4405891c35af", "sha256": "6e5b61d06087d08d7e07d2573a55a0daaa4cb84fa40a5e3556883caa4c1d3a76" }, "downloads": -1, "filename": "qgprofiler-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c5095639e4bea04def6a4405891c35af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3769, "upload_time": "2017-01-16T06:15:32", "url": "https://files.pythonhosted.org/packages/82/54/93dd42de945502f79f1099ab175939ac8bd335cfb25e43ec30a5b9c2cff7/qgprofiler-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "11c0d289d9fd73555d931a98566c49fd", "sha256": "80a9cea2ceeebf1e95ecb4fb9b9461670c02c0d2144534030d8961152f5160af" }, "downloads": -1, "filename": "qgprofiler-0.1.4.tar.gz", "has_sig": false, "md5_digest": "11c0d289d9fd73555d931a98566c49fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4566, "upload_time": "2017-01-16T08:56:19", "url": "https://files.pythonhosted.org/packages/c1/bf/82a650c9e4cd76bc4bff57bc00ed7f483890dd807e439e7e3ba80e20f40f/qgprofiler-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "4d9ca33d1f5306abe1b0970a1bd45663", "sha256": "189ac109a15f3f4f258ab3540ca26e2a9fb3dfac675248648e6513c54c234716" }, "downloads": -1, "filename": "qgprofiler-0.1.5.tar.gz", "has_sig": false, "md5_digest": "4d9ca33d1f5306abe1b0970a1bd45663", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4742, "upload_time": "2017-01-16T12:20:56", "url": "https://files.pythonhosted.org/packages/b9/f6/45d869fdc815e70f27ec8f275a74195de2720f301bb094939471488438f4/qgprofiler-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "50d99b58320d5cc0d8c5e74d026bfed3", "sha256": "a5e8700e5f231763d8bdee4a6ae7722f39b59b4a2f026b21706428192f76a0df" }, "downloads": -1, "filename": "qgprofiler-0.1.6.tar.gz", "has_sig": false, "md5_digest": "50d99b58320d5cc0d8c5e74d026bfed3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6536, "upload_time": "2017-01-17T12:27:42", "url": "https://files.pythonhosted.org/packages/c2/b4/e4c39307896ac80d30ba58ad979cf95201f0b62d4101afb7554e8aba8f55/qgprofiler-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "5f384d0e707480fcdab167492c4a6013", "sha256": "90d7870266da1a3e1ce9ef5be0c057b78260e7d349ac0a1ea675b88d85163c5a" }, "downloads": -1, "filename": "qgprofiler-0.1.7.tar.gz", "has_sig": false, "md5_digest": "5f384d0e707480fcdab167492c4a6013", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6523, "upload_time": "2017-01-19T11:45:55", "url": "https://files.pythonhosted.org/packages/61/48/a0db482f9b5d20d1cb87cd56ee3a944ff8a3ffb13063043d50bb323846bc/qgprofiler-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "1d1eb6e1d6597a88262c8eb036e0329b", "sha256": "5c510f0868db4834d4855b787689c4c72d94b7d40040e6e3d03f4580e70e7e7f" }, "downloads": -1, "filename": "qgprofiler-0.1.8.tar.gz", "has_sig": false, "md5_digest": "1d1eb6e1d6597a88262c8eb036e0329b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6651, "upload_time": "2017-01-20T10:40:37", "url": "https://files.pythonhosted.org/packages/f9/ee/a9e569df5d0f96bcab00ac9e042cd43b17a5d44f8554d7215fe1f5522953/qgprofiler-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "52aaa1c34868ca68d7dbe6158e86c080", "sha256": "e1b5a271fe1a10432001067f01c7c080ff006671a096b93b4f7626f157da9180" }, "downloads": -1, "filename": "qgprofiler-0.1.9.tar.gz", "has_sig": false, "md5_digest": "52aaa1c34868ca68d7dbe6158e86c080", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6684, "upload_time": "2017-01-20T13:32:49", "url": "https://files.pythonhosted.org/packages/bf/9f/2deb486037b53397ea3890bb5eb125f2c23bf6169362de09061edddbada2/qgprofiler-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "018bc4523a076b0d3bc8ecf583cc4256", "sha256": "55a5ee136a39ef66c427b5abdf056bfb049fc37cca76861f41f59fd6117df1fb" }, "downloads": -1, "filename": "qgprofiler-0.1.14.tar.gz", "has_sig": false, "md5_digest": "018bc4523a076b0d3bc8ecf583cc4256", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12303, "upload_time": "2017-08-17T05:54:53", "url": "https://files.pythonhosted.org/packages/90/77/44de43ab6b63895529c116559630130a58d060819c073a2b14ee8669dcc1/qgprofiler-0.1.14.tar.gz" } ] }