Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Profiler tool for PHP. forp is a lightweight PHP extension which provides CPU and memory profiling datas.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

!under development!

Build Status

Introduction

forp is a lightweight PHP extension which provides duration and memory profiling datas. forp is non intrusive, it provides PHP annotations to complete its work.

PHP functions

  • forp_start() : start forp collector
  • forp_end() : stop forp collector
  • forp_dump() : return stack as flat array
  • forp_print() : display forp stack (SAPI CLI)

forp_start() flags

  • FORP_FLAG_CPU : activate duration collect
  • FORP_FLAG_MEMORY : activate memory collect
  • FORP_FLAG_ANNOTATIONS : activate annotations handling

php.ini options

  • forp.max_nesting_level : default 50
  • forp.no_internals : default 0

Annotations

  • @ProfileGroup

Sets groups that function belongs.

/**
 * @ProfileGroup("data loading","rendering")
 */
function exec($query) {
    /* ... */
}
  • @ProfileCaption

Adds caption to function. Caption string may contain references (#) to parameters of the function.

/**
 * @ProfileCaption("Find row for pk #1")
 */
public function findByPk($pk) {
    /* ... */
}
  • @ProfileAlias

Gives an alias name to a function. Useful for anonymous functions

/**
 * @ProfileAlias("MyAnonymousFunction")
 */
$fn = function() {
    /* ... */
}
  • @ProfileHighlight

Adds a frame around output generated by the function.

/**
 * @ProfileHighlight("1")
 */
function render($datas) {
    /* ... */
}

Linux Install

  • make
git clone https://github.com/aterrien/forp
cd forp
phpize
./configure
make
make test
make install
  • php.ini
extension=forp.so

Win32 Install

For PHP 5.3 - Thread Safe (by default) : https://github.com/downloads/ichiriac/forp/php53_x86_ts_forp.dll

For PHP 5.3 - Non Thread Safe : https://github.com/downloads/ichiriac/forp/php53_x86_nts_forp.dll

Something went wrong with that request. Please try again.