{"id":17911431,"url":"https://github.com/tklauser/numcpus","last_synced_at":"2025-05-16T13:07:54.850Z","repository":{"id":34870673,"uuid":"161666211","full_name":"tklauser/numcpus","owner":"tklauser","description":"Go package providing information about the number of CPUs in the system","archived":false,"fork":false,"pushed_at":"2025-05-08T09:36:57.000Z","size":1090,"stargazers_count":27,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-14T00:50:49.698Z","etag":null,"topics":["bsd","cpu","cputopology","go","golang","linux","numa","offline","online","unix"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/tklauser/numcpus","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tklauser.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,"zenodo":null}},"created_at":"2018-12-13T16:31:43.000Z","updated_at":"2025-05-08T09:36:59.000Z","dependencies_parsed_at":"2024-04-25T08:46:15.906Z","dependency_job_id":"b961a04c-3a0a-429e-8ce4-bddf2a21eed9","html_url":"https://github.com/tklauser/numcpus","commit_stats":{"total_commits":190,"total_committers":2,"mean_commits":95.0,"dds":0.3052631578947368,"last_synced_commit":"f3dbdd20bd9e98c7444ac9296617d31335a667aa"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tklauser%2Fnumcpus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tklauser%2Fnumcpus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tklauser%2Fnumcpus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tklauser%2Fnumcpus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tklauser","download_url":"https://codeload.github.com/tklauser/numcpus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535829,"owners_count":22087399,"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":["bsd","cpu","cputopology","go","golang","linux","numa","offline","online","unix"],"created_at":"2024-10-28T19:38:15.521Z","updated_at":"2025-05-16T13:07:54.802Z","avatar_url":"https://github.com/tklauser.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numcpus\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/tklauser/numcpus.svg)](https://pkg.go.dev/github.com/tklauser/numcpus)\n[![GitHub Action Status](https://github.com/tklauser/numcpus/workflows/Tests/badge.svg)](https://github.com/tklauser/numcpus/actions?query=workflow%3ATests)\n\nPackage numcpus provides information about the number of CPUs in the system.\n\nIt gets the number of CPUs (online, offline, present, possible, configured or\nkernel maximum) on Linux, Darwin, FreeBSD, NetBSD, OpenBSD, DragonflyBSD or\nSolaris/Illumos systems.\n\nOn Linux, the information is retrieved by reading the corresponding CPU\ntopology files in `/sys/devices/system/cpu`.\n\nOn BSD systems, the information is retrieved using the `hw.ncpu` and\n`hw.ncpuonline` sysctls, if supported.\n\nNot all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD,\nDragonflyBSD and Solaris/Illumos. ErrNotSupported is returned in case a\nfunction is not supported on a particular platform.\n\n## Usage\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/tklauser/numcpus\"\n)\n\nfunc main() {\n\tonline, err := numcpus.GetOnline()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"GetOnline: %v\\n\", err)\n\t}\n\tfmt.Printf(\"online CPUs: %v\\n\", online)\n\n\tpossible, err := numcpus.GetPossible()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"GetPossible: %v\\n\", err)\n\t}\n\tfmt.Printf(\"possible CPUs: %v\\n\", possible)\n}\n```\n\n## References\n\n* [Linux kernel sysfs documentation for CPU attributes](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu)\n* [Linux kernel CPU topology documentation](https://www.kernel.org/doc/Documentation/cputopology.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftklauser%2Fnumcpus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftklauser%2Fnumcpus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftklauser%2Fnumcpus/lists"}