{"id":19832947,"url":"https://github.com/tinywan/webman-xhprof","last_synced_at":"2025-05-01T16:33:48.516Z","repository":{"id":171925826,"uuid":"648609738","full_name":"Tinywan/webman-xhprof","owner":"Tinywan","description":"XHProf PHP tool for webman plugin","archived":false,"fork":false,"pushed_at":"2024-02-20T07:31:38.000Z","size":1193,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-31T20:13:03.544Z","etag":null,"topics":["composer","php7","tinywan","webman","webman-framework","workerman","xhprof"],"latest_commit_sha":null,"homepage":"https://www.workerman.net/plugin/125","language":"PHP","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/Tinywan.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}},"created_at":"2023-06-02T11:25:07.000Z","updated_at":"2024-06-28T12:59:07.000Z","dependencies_parsed_at":"2024-01-25T08:15:10.930Z","dependency_job_id":null,"html_url":"https://github.com/Tinywan/webman-xhprof","commit_stats":null,"previous_names":["tinywan/webman-xhprof"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinywan%2Fwebman-xhprof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinywan%2Fwebman-xhprof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinywan%2Fwebman-xhprof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinywan%2Fwebman-xhprof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tinywan","download_url":"https://codeload.github.com/Tinywan/webman-xhprof/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224269111,"owners_count":17283630,"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":["composer","php7","tinywan","webman","webman-framework","workerman","xhprof"],"created_at":"2024-11-12T11:39:04.741Z","updated_at":"2024-11-12T11:39:05.479Z","avatar_url":"https://github.com/Tinywan.png","language":"PHP","readme":"# XHProf PHP tool for webman plugin\n[![Latest Stable Version](http://poser.pugx.org/tinywan/webman-xhprof/v)](https://packagist.org/packages/tinywan/webman-xhprof) [![Total Downloads](http://poser.pugx.org/tinywan/webman-xhprof/downloads)](https://packagist.org/packages/tinywan/webman-xhprof) [![Latest Unstable Version](http://poser.pugx.org/tinywan/webman-xhprof/v/unstable)](https://packagist.org/packages/tinywan/webman-xhprof) [![License](http://poser.pugx.org/tinywan/webman-xhprof/license)](https://packagist.org/packages/tinywan/webman-xhprof) [![PHP Version Require](http://poser.pugx.org/tinywan/webman-xhprof/require/php)](https://packagist.org/packages/tinywan/webman-xhprof)\n\n# 简介\n\n[XHProf](https://www.php.net/manual/zh/intro.xhprof.php) 是一个分层PHP性能分析工具。它报告函数级别的请求次数和各种指标，包括阻塞时间，CPU时间和内存使用情况。一个函数的开销，可细分成调用者和被调用者的开销，XHProf数据收集阶段，它记录调用次数的追踪和包容性的指标弧在动态callgraph的一个程序。它独有的数据计算的报告/后处理阶段。\n\n在数据收集时，XHProfd通过检测循环来处理递归的函数调用，并通过给递归调用中每个深度的调用一个有用的命名来避开死循环。XHProf分析报告有助于理解被执行的代码的结构，它有一个简单的HTML的用户界面（ PHP写成的）。基于浏览器的性能分析用户界面能更容易查看，或是与同行们分享成果。也能绘制调用关系图。\n\n# 安装\n\n```php\ncomposer require tinywan/webman-xhprof\n```\n\n# [XHProf](https://www.php.net/manual/zh/intro.xhprof.php) 安装\n\n下载\n```javascript\nwget https://pecl.php.net/get/xhprof-2.3.9.tgz\ntar -zxvf xhprof-2.3.9.tgz\ncd ./xhprof-2.3.9/extension\nphpize\n./configure --with-php-config=/usr/local/php-7.4/bin/php-config\nmake\nmake install\n```\n\n`php.ini` 配置\n\n```php\n[xhprof]\nextension=xhprof.so;\nxhprof.output_dir=/tmp/xhprof;\n```\n\n确认是否安装成功\n\n```javascript\n/var/www # php --ri xhprof\n\nxhprof\n\nxhprof support =\u003e enabled\nVersion =\u003e 2.3.9\n```\n# 使用\n\n配置 `config/middleware.php`\n\n```php\nreturn [\n    '' =\u003e [\n        \\Tinywan\\Xhprof\\XhprofMiddleware::class,\n    ]\n];\n```\n\n# 查看\n\n访问地址 `http://webman.xhprof.com/xhprof/xhprof_html/index.php`\n\n\u003e Existing runs\n\n![displaying_top.png](./displaying_top.png)\n\n\u003e Webman\\App::Webman\\{closure}\n\n![Webman\\App::Webman\\{closure}](./webman.png)\n\n\u003e 图形化展示\n\n![图形化展示](./webman-gpl.png)\n\n# 其他\n\n```shell\nFunction Name：方法名称。\nCalls：方法被调用的次数。\nCalls%：方法调用次数在同级方法总数调用次数中所占的百分比。\nIncl.Wall Time(microsec)：方法执行花费的时间，包括子方法的执行时间。（单位：微秒）\nIWall%：方法执行花费的时间百分比。\nExcl. Wall Time(microsec)：方法本身执行花费的时间，不包括子方法的执行时间。（单位：微秒）\nEWall%：方法本身执行花费的时间百分比。\nIncl. CPU(microsecs)：方法执行花费的CPU时间，包括子方法的执行时间。（单位：微秒）\nICpu%：方法执行花费的CPU时间百分比。\nExcl. CPU(microsec)：方法本身执行花费的CPU时间，不包括子方法的执行时间。（单位：微秒）\nECPU%：方法本身执行花费的CPU时间百分比。\nIncl.MemUse(bytes)：方法执行占用的内存，包括子方法执行占用的内存。（单位：字节）\nIMemUse%：方法执行占用的内存百分比。\nExcl.MemUse(bytes)：方法本身执行占用的内存，不包括子方法执行占用的内存。（单位：字节）\nEMemUse%：方法本身执行占用的内存百分比。\nIncl.PeakMemUse(bytes)：Incl.MemUse峰值。（单位：字节）\nIPeakMemUse%：Incl.MemUse峰值百分比。\nExcl.PeakMemUse(bytes)：Excl.MemUse峰值。单位：（字节）\nEPeakMemUse%：Excl.MemUse峰值百分比。\n```\n\n## xhprof 简单代理配置\n\n```\nserver {\n    server_name webman.xhprof.com;\n\n    root /var/www/webman-admin/vendor/tinywan/webman-xhprof/src;\n\n    location / {\n        if (!-e $request_filename) {\n            rewrite ^(.*)$ /index.php?s=/$1 last;\n        }\n    }\n\n    location ~ \\.php(.*)$ {\n        try_files $fastcgi_script_name =404;\n\n        fastcgi_pass php74:9000;\n        fastcgi_index index.php;\n        fastcgi_split_path_info ^((?U).+\\.php)(/?.+)$;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_param PATH_INFO $fastcgi_path_info;\n        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;\n\n        include fastcgi_params;\n    }\n}\n```\n\n访问地址：`http://webman.xhprof.com/xhprof/xhprof_html/index.php`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinywan%2Fwebman-xhprof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinywan%2Fwebman-xhprof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinywan%2Fwebman-xhprof/lists"}