{"id":19895253,"url":"https://github.com/venthur/litestats","last_synced_at":"2025-05-02T20:30:51.392Z","repository":{"id":57438752,"uuid":"152750283","full_name":"venthur/litestats","owner":"venthur","description":"Converts Python Profiling Stats into Sqllite3","archived":false,"fork":false,"pushed_at":"2023-08-23T06:28:39.000Z","size":15,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T05:11:32.642Z","etag":null,"topics":["profiling","python","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/venthur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-12T12:53:31.000Z","updated_at":"2024-02-08T18:38:03.000Z","dependencies_parsed_at":"2024-11-12T18:41:33.939Z","dependency_job_id":"5d44cb6c-aa62-49f2-b609-ce3800dd4745","html_url":"https://github.com/venthur/litestats","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":"0.34782608695652173","last_synced_commit":"adb6219f0dc710fb956d1e1423cb6ef4f18132d8"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/venthur%2Flitestats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/venthur%2Flitestats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/venthur%2Flitestats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/venthur%2Flitestats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/venthur","download_url":"https://codeload.github.com/venthur/litestats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252104009,"owners_count":21695400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["profiling","python","sqlite"],"created_at":"2024-11-12T18:36:04.478Z","updated_at":"2025-05-02T20:30:51.054Z","avatar_url":"https://github.com/venthur.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Litestats\n\nProfiling in Python has always been easy, however, analyzing the\nprofiler's output not so much. After the profile has been created you\ncan use Python's `pstats` module but it feels quite clumsy and not\nreally empowering.\n\nEnter litestats! Litestats is a simple command line tool that takes the\noutput of the Python profiler and transforms the data into a sqlite3\ndatabase. You can now easily analyze the profiler output using `sqlite`\non the command line, the `sqlitebrowser` for a graphical interface or\nuse the data base as the foundation of your very own tooling around the\nanalysis.\n\n## How does it work?\n\nLitestats reads the dump of the profiler and creates a normalized\ndata base with tree tables:\n\n  * `functions`: contains each function (callers and callees) with\n    filename, line number and function name\n  * `stats` contains the statistics (primitive/total calls,\n    total/cumulative time) for all functions\n  * `calls` a caller-callee mapping\n\nWhile this provides an exact representation of the dump, those tables\nwould be cumbersome to use. So litestats additionally creates three\nviews resembling `pstats` `print_stats`, `print_callers` and\n`print_callees` functionality:\n\n  * `pstats`\n  * `callers`\n  * `callees`\n\n## Install\n\nLitestats has **no requirements** other than Python itself:\n\n```bash\n$ pip install litestats\n```\n\n\n## Usage\n\n```bash\n$ # run the profiler and dump the output\n$ python3 -m cProfile -o example.prof example.py\n$ # convert dump to sqlite3 db\n$ litestats example.prof\n$ # example.prof.sqlite created\n```\n\nYou can now use the sqlite3 data base to investigate the profiler dump:\n\n```sql\nsqlite\u003e select *\n   ...\u003e from pstats\n   ...\u003e order by cumtime desc\n   ...\u003e limit 20;\n\nncalls      tottime     ttpercall             cumtime     ctpercall   filename:lineno(function)\n----------  ----------  --------------------  ----------  ----------  ------------------------------------\n18/1        0.000161    8.94444444444444e-06  0.067797    0.067797    ~:0(\u003cbuilt-in method builtins.exec\u003e)\n1           1.0e-06     1.0e-06               0.067755    0.067755    \u003cstring\u003e:1(\u003cmodule\u003e)\n1           4.0e-06     4.0e-06               0.067754    0.067754    /usr/lib/python3.7/runpy.py:195(run_\n1           6.0e-06     6.0e-06               0.066135    0.066135    /usr/lib/python3.7/runpy.py:62(_run_\n1           1.1e-05     1.1e-05               0.066113    0.066113    /home/venthur/Documents/projects/lit\n1           6.6e-05     6.6e-05               0.055152    0.055152    /home/venthur/Documents/projects/lit\n1           4.1e-05     4.1e-05               0.0549      0.0549      /home/venthur/Documents/projects/lit\n1           0.050196    0.050196              0.050196    0.050196    ~:0(\u003cmethod 'executescript' of 'sqli\n20/3        8.9e-05     4.45e-06              0.011064    0.003688    \u003cfrozen importlib._bootstrap\u003e:978(_f\n20/3        4.8e-05     2.4e-06               0.011005    0.00366833  \u003cfrozen importlib._bootstrap\u003e:948(_f\n20/3        7.5e-05     3.75e-06              0.01083     0.00361     \u003cfrozen importlib._bootstrap\u003e:663(_l\n15/3        3.5e-05     2.33333333333333e-06  0.01073     0.00357666  \u003cfrozen importlib._bootstrap_externa\n29/5        2.5e-05     8.62068965517241e-07  0.010215    0.002043    \u003cfrozen importlib._bootstrap\u003e:211(_c\n3           6.0e-06     2.0e-06               0.010087    0.00336233  ~:0(\u003cbuilt-in method builtins.__impo\n28/6        9.0e-06     3.21428571428571e-07  0.008977    0.00149616  \u003cfrozen importlib._bootstrap\u003e:1009(_\n1           9.0e-06     9.0e-06               0.00841     0.00841     /home/venthur/Documents/projects/lit\n16          0.000138    8.625e-06             0.004802    0.00030012  \u003cfrozen importlib._bootstrap_externa\n1           4.5e-05     4.5e-05               0.004143    0.004143    /usr/lib/python3.7/logging/__init__.\n1           0.004038    0.004038              0.004038    0.004038    ~:0(\u003cmethod 'commit' of 'sqlite3.Con\n13          3.3e-05     2.53846153846154e-06  0.002368    0.00018215  \u003cfrozen importlib._bootstrap_externa\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventhur%2Flitestats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fventhur%2Flitestats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fventhur%2Flitestats/lists"}