{"id":16612960,"url":"https://github.com/ttys3/get-cpu-frequency-slow","last_synced_at":"2026-04-23T10:33:43.877Z","repository":{"id":101550164,"uuid":"436350373","full_name":"ttys3/get-cpu-frequency-slow","owner":"ttys3","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-10T14:48:39.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T20:42:58.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/ttys3.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":"2021-12-08T18:22:59.000Z","updated_at":"2021-12-10T14:48:42.000Z","dependencies_parsed_at":"2023-06-05T10:30:44.912Z","dependency_job_id":null,"html_url":"https://github.com/ttys3/get-cpu-frequency-slow","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ttys3/get-cpu-frequency-slow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fget-cpu-frequency-slow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fget-cpu-frequency-slow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fget-cpu-frequency-slow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fget-cpu-frequency-slow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttys3","download_url":"https://codeload.github.com/ttys3/get-cpu-frequency-slow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys3%2Fget-cpu-frequency-slow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32176739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-12T01:45:28.053Z","updated_at":"2026-04-23T10:33:38.863Z","avatar_url":"https://github.com/ttys3.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-cpu-frequency-slow\n\nthe func `get_cpu_frequency` took from https://docs.rs/crate/sysinfo/0.19.2/source/src/linux/processor.rs\nmainly for debugging and verify that delta 0.10.x slowdown problem is caused by `sysinfo` crate\nsee https://github.com/dandavison/delta/issues/839\n\n## usage\n\n```shell\nget-cpu-frequency-slow [your_machine_logic_CPU_num]\n\n# or force only read /proc/cpuinfo\nget-cpu-frequency-slow [your_machine_logic_CPU_num] true\n```\n\n## demo result\n\ntest env:\n\n```\n------------\nOS: Arch Linux x86_64\nKernel: 5.15.6-arch2-1\nShell: zsh 5.8\nResolution: 3840x2160\nTerminal: tmux\nCPU: Intel i9-9900 (16) @ 5.000GHz\nGPU: NVIDIA GeForce GTX 1060 3GB\nMemory: 6747MiB / 32038MiB\n```\n\na single run will cost about `16ms`, thus 16 core CPU result in about `256ms`\n\n```\n./target/release/get-cpu-frequency-slow 1\nnum_cpu=1\ntotal time elapsed in get_cpu_frequency()x1 is: 15.934353ms\n./target/release/get-cpu-frequency-slow\nnum_cpu=16\ntotal time elapsed in get_cpu_frequency()x16 is: 252.667394ms\n```\n\n\nmost of the time it will look like this:\n\n```shell\n./target/release/get-cpu-frequency-slow\ntotal time elapsed in get_cpu_frequency() is: 264.490103ms\n\n❯ make run\n./target/release/get-cpu-frequency-slow\ntotal time elapsed in get_cpu_frequency() is: 264.542344ms\n\n❯ make run\n./target/release/get-cpu-frequency-slow\ntotal time elapsed in get_cpu_frequency() is: 265.281557ms\n\n❯ make run\n./target/release/get-cpu-frequency-slow\ntotal time elapsed in get_cpu_frequency() is: 264.696121ms\n```\n\nbut there's also **rarely** result in very low latency result, like this:\n\n```\n❯ make run\n./target/release/get-cpu-frequency-slow\ntotal time elapsed in get_cpu_frequency() is: 275.174µs\n```\n\n## Important notice\n\nplease note that directly read `/proc/cpuinfo` is rather fast.\n\nthis program is only used to demonstrate the slowdown problem when reading `/sys/devices/system/cpu/cpu{}/cpufreq/scaling_cur_freq`\n\n```shell\n# with read /sys/devices/system/cpu/cpu{}/cpufreq/scaling_cur_freq\n❯ ./target/release/get-cpu-frequency-slow 16\nnum_cpu=16 force_cpuinfo=false\ntotal time elapsed in get_cpu_frequency()x16 is: 281.183772ms\n\n# directly read /proc/cpuinfo\n❯ ./target/release/get-cpu-frequency-slow 16 true\nnum_cpu=16 force_cpuinfo=true\nskip readding cpu freq from sysfs, directly to /proc/cpuinfo\ntotal time elapsed in get_cpu_frequency()x16 is: 2.989249ms\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys3%2Fget-cpu-frequency-slow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttys3%2Fget-cpu-frequency-slow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys3%2Fget-cpu-frequency-slow/lists"}