Giter VIP home page Giter VIP logo

zhaoyong2006 / phptrace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qihoo360/phptrace

0.0 2.0 0.0 1.11 MB

php程序跟踪和分析工具,从PHP Runtime中获取程序的上下文及函数调用情况,适用于线上快速分析定位阻塞、负载高等疑难杂症

License: GNU General Public License v2.0

Makefile 0.26% C 3.11% Shell 8.76% Ruby 0.02% PHP 0.03% C++ 82.88% Python 4.95%

phptrace's Introduction

phptrace

php程序跟踪和分析工具,从PHP Runtime中获取程序的上下文及函数调用情况,适用于线上快速分析定位阻塞、负载高等疑难杂症

phptrace介绍及使用

Building

编译cmdtool

tar -zxf phptrace-<version>.tar.gz
cd phptrace-<version>
cd cmdtool
make

编译PHP扩展

cd phpext
phpize
./configure --with-php-config=/path/to/php-config
make

Installing

cmdtool可直接使用,扩展需要安装到PHP相关目录:

make install

Usage

$ phptrace -p <PID>     #trace PHP函数调用
$ phptrace -p <PID> -s  #打印PHP调用栈

Examples

打印调用栈

$ ./phptrace -p 3130 -s
phptrace 0.1 demo, published by infra webcore team
process id = 3130
script_filename = /home/xxx/opt/nginx/webapp/block.php
[0x7f27b9a99dc8]  sleep /home/xxx/opt/nginx/webapp/block.php:6
[0x7f27b9a99d08]  say /home/xxx/opt/nginx/webapp/block.php:3
[0x7f27b9a99c50]  run /home/xxx/opt/nginx/webapp/block.php:10

trace PHP函数调用

$ ./phptrace -p 2459
1417506346.727223 run(<Null>)
1417506346.727232     say($msg = "hello world")
1417506346.727241         sleep($seconds = "1")
1417506347.727341         sleep =>      0       1.000100 
1417506347.727354     say =>    hello world     1.000122 
1417506347.727358 run =>        nil     1.000135 

phptrace's People

Contributors

chancey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.