{"id":16935683,"url":"https://github.com/codeskyblue/airfps","last_synced_at":"2025-11-05T10:30:33.091Z","repository":{"id":26120825,"uuid":"29565332","full_name":"codeskyblue/airfps","owner":"codeskyblue","description":"For mobile phone game to get FPS: frame per second.","archived":false,"fork":false,"pushed_at":"2015-02-10T07:57:00.000Z","size":468,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-27T12:44:51.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeskyblue.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}},"created_at":"2015-01-21T01:45:47.000Z","updated_at":"2020-06-12T18:09:46.000Z","dependencies_parsed_at":"2022-08-27T03:17:45.169Z","dependency_job_id":null,"html_url":"https://github.com/codeskyblue/airfps","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fairfps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fairfps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fairfps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fairfps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeskyblue","download_url":"https://codeload.github.com/codeskyblue/airfps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239456411,"owners_count":19641843,"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-10-13T20:55:07.492Z","updated_at":"2025-11-05T10:30:33.041Z","avatar_url":"https://github.com/codeskyblue.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## airfps\nGet FPS(frame per second) on android. Root privileges required.\n\n## Still developing\nNot working for now.\n\n目前遇到了点瓶颈。只hook函数eglSwapBuffers看来还不够。(忽略了点细节，只要在adb开发选项中把硬件刷新关了就可以了)\n\n需要从基础工作开始研究了。\n\n1. [ELF格式解析](study-diary/ELF.md)\n2. [ptrace学习](study-diary/ptrace.md)\n3. [inject函数的编写](study-diary/inject.md)\n4. [注入1+1 != 2](study-diary/hook.md)\n\n## 编译指南\n代码中用了Golang，Android-NDK. [Golang-mobile](https://github.com/golang/mobile)的官网推荐用docker\n\n\tdocker pull golang/mobile\n\tdocker run -v $GOPATH/src:/src golang/mobile /bin/bash -c 'cd /src/your/project \u0026\u0026 ./make.bash'\n\n不过手工搭建个环境也不复杂，参考着[Dockerfile](https://github.com/golang/mobile/blob/master/Dockerfile)中的描述一点点的来就可以。\nGolang需要1.4+的版本，直接下载个就好 \u003chttp://golang.org/dl/\u003e\n\n不要忘了把CGO打开，我有时就会忘了`export CGO_ENABLED=1`\n\n## 感谢\n* [未完成的项目realfps](https://github.com/cuitteam/RealFPS)\n* [fpsmeter反编译分析](http://blog.csdn.net/freshui/article/details/9245511#comments)\n* [jinzhuojun的CSDN-如何写出一个显示fps的东西](http://blog.csdn.net/jinzhuojun/article/details/10428435)\n* [hook的原理](http://bbs.pediy.com/showthread.php?t=157419)\n\n## Demo\n\nfunction `__android_log_print` should not appear in `hook_entry` function.\n\n\tcd study-diary\n\tmake install\n\tcd ..\n\tmake\n\t\n\tadb shell \n\tcd /data/local/tmp/\n\texport LD_LIBRARY_PATH=$PWD\n\t./bar\n\n\tadb shell\n\t./airfps -l libfps.so -pname ./bar # hack\n\t./airfps -l libfps.so -pname ./bar # unhack\n\t./airfps -l libfps.so -pname ./bar # hack\n\n\tsu\n\tcd /data/local/tmp\n\t./airfps -l libfps.so -rf eglSwapBuffers -rl /system/lib/libsurfaceflinger.so\n\n\tadb shell\n\ttail -f /data/local/tmp/log.txt\n\n## LICENSE\nUnder [GPL v2](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fairfps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeskyblue%2Fairfps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fairfps/lists"}