{"id":16305195,"url":"https://github.com/moznion/lua-cputime","last_synced_at":"2025-08-18T07:08:08.265Z","repository":{"id":145078041,"uuid":"150688671","full_name":"moznion/lua-cputime","owner":"moznion","description":"A bridge library for CPU time measurement","archived":false,"fork":false,"pushed_at":"2018-10-11T03:02:57.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T16:11:34.187Z","etag":null,"topics":["lua"],"latest_commit_sha":null,"homepage":"https://luarocks.org/modules/moznion/cputime","language":"C","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/moznion.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-09-28T05:09:39.000Z","updated_at":"2024-01-30T08:27:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"d912b670-5d63-48e7-afee-a5f6408575d1","html_url":"https://github.com/moznion/lua-cputime","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"ba9bf89e0a77a22b3411aeecd1deb473d93463bc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/moznion/lua-cputime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Flua-cputime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Flua-cputime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Flua-cputime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Flua-cputime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moznion","download_url":"https://codeload.github.com/moznion/lua-cputime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moznion%2Flua-cputime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270957009,"owners_count":24675041,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["lua"],"created_at":"2024-10-10T21:05:59.566Z","updated_at":"2025-08-18T07:08:08.248Z","avatar_url":"https://github.com/moznion.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"lua-cputime\n==\n\nA wrapper library for CPU time measurement.\n\nSynopsis\n--\n\n```lua\nlocal cputime = require 'cputime'\n\nlocal utime, stime, err = cputime.get_process_cputime()\nif err ~= nil then\n  -- error handling...\nend\n```\n\nSee also [example](/example/).\n\nDescription\n--\n\nThis package provides methods to measure (and dispense) the CPU time.\nThis library bridges to `getrusage()` function of `sys/time.h` and `sys/resource.h` on UNIX system; on the other hand, this library wraps `GetProcessTimes()` and `GetThreadTimes()` on Windows environment.\n\nFunctions\n--\n\n### `get_process_cputime()`\n\nThis function returns the measured CPU time of current process.\n\n### `get_thread_cputime()`\n\nThis function returns the measured CPU time of current thread. This function is only supported following OS:\n\n- Linux (since 2.6.26)\n- Windows\n\n#### Return value\n\nThe above methods returns values that accords the following order:\n\n- utime (number or nil): user CPU time. This variable represents microseconds.\n- stime (number or nil): system CPU time. This variable represents microseconds.\n- err (string or nil): error response\n\nWhen err is nil, other values are actual number value. On the other hand, when err is not nil, other values are nil.\n\nSee also\n--\n\n- http://man7.org/linux/man-pages/man2/getrusage.2.html\n- [GetProcessTimes()](https://msdn.microsoft.com/library/cc429139.aspx)\n- [GetThreadTimes()](https://msdn.microsoft.com/library/cc429147.aspx)\n\nLicense\n--\n\n```\nThe MIT License (MIT)\nCopyright © 2018 moznion, http://moznion.net/ \u003cmoznion@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the “Software”), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoznion%2Flua-cputime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoznion%2Flua-cputime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoznion%2Flua-cputime/lists"}