{"id":18750717,"url":"https://github.com/cafebazaar/profile_function","last_synced_at":"2025-04-12T23:32:24.648Z","repository":{"id":57454993,"uuid":"142673594","full_name":"cafebazaar/profile_function","owner":"cafebazaar","description":"An easy profiling tool which collects elapsed time for functions and code blocks.","archived":false,"fork":false,"pushed_at":"2024-03-12T21:08:10.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-20T09:23:01.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cafebazaar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-28T11:55:47.000Z","updated_at":"2023-10-31T17:44:31.000Z","dependencies_parsed_at":"2024-11-07T17:12:57.451Z","dependency_job_id":"deae73af-ae49-4026-8568-f89f326a89b1","html_url":"https://github.com/cafebazaar/profile_function","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"e182e46f9ad6218349418bd1ef9abc22eb38580a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafebazaar%2Fprofile_function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafebazaar%2Fprofile_function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafebazaar%2Fprofile_function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafebazaar%2Fprofile_function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cafebazaar","download_url":"https://codeload.github.com/cafebazaar/profile_function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647258,"owners_count":21139081,"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":[],"created_at":"2024-11-07T17:12:54.579Z","updated_at":"2025-04-12T23:32:23.405Z","avatar_url":"https://github.com/cafebazaar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Description \nA simple profiling tool which collects elapsed time for functions and code blocks.\n\n## Usage\n\nUsing `statsd`:\n```python\nfrom profile_function import ProfileFunction, StatsdBackend\nimport statsd\n\nstatsd_client = statsd.StatsClient('localhost', 8125)\npf = ProfileFunction(StatsdBackend(statsd_client))\n\n@pf.profile_function(group=\"rpc\")\ndef f(x, y):\n    s = 0\n    with pf.profile_block(\"for-loop\"):\n        for i in range(x):\n           s += i * x + y \n    return s\n```\n\nUsing logger:\n```python\nfrom profile_function import ProfileFunction, LoggerBackend\nimport logging\n\nlogger = logging.getLogger(__name__)\npf = ProfileFunction(LoggerBackend(logger, log_level=logging.DEBUG))\n\n@pf.profile_function(group=\"rpc\")\ndef f(x, y):\n    s = 0\n    with pf.profile_block(\"for-loop\"):\n        for i in range(x):\n           s += i * x + y \n    return s\n```\n\n## Install\n\nYou can install `profile_function` using pip: \n```bash\n$ pip install profile-function\n```\n\nIf you are using `statsd` you need to install it first. This project does not mentioned `statsd` as it own dependency. This command may be useful then:\n```bash\n$ pip install statsd\n```\n\n## Development:\nYou can write your own collector if you need by implementing `CollectorBackend`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafebazaar%2Fprofile_function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcafebazaar%2Fprofile_function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafebazaar%2Fprofile_function/lists"}