Giter Club home page Giter Club logo

xhprof's Introduction

XHProf UI

This is a graphical front end designed to store and present the profiling information provided by the Facebook created XHProf profiling tool.

Related Tools

  • XHGui - Uses MongoDB as a backend (rather than MySQL)

Project Includes

  • It includes a header.php document you can use with PHP's auto_prepend_file directive. It sets up profiling by initilizing a few variables, and settting register_shutdown_function with the footer. Once started profiles are done when requested (?_profile=1), or randomly. Profiled pages display a link to their profile results at the bottom of the page (this can be disabled on a blacklist based for specific documents. e.g. pages generating XML, images, etc.).
  • For tips on including header.php on an nginx + php-fpm install take a look at: http://www.justincarmony.com/blog/2012/04/23/php-fpm-nginx-php_value-and-multiple-values/
  • The GUI is a bit prettier (Thanks to Graham Slater)
  • It uses a MySQL backend, the database schema is stored in xhprof_runs.php
  • There's a frontend to view different runs, compare runs to the same url, etc.

Key Features

  • Listing 25, 50 most recent runs
  • Display most expensive (cpu), longest running, or highest memory usage runs for the day
  • It introduces the concept of "Similar" URLs. Consider:
  • Highcharts is used to graph stats over requests for an easy heads up display.

Requirements

Besides a simple PHP running on your favourite web server you will also need following packages:

  • php5-xhprof
  • php5-mysql
  • graphviz (uses dot to generate callgraphs)

Installation

  • Install your favourite mix of PHP and web server
  • Install MySQL server
  • Clone the project to some folder
  • Map the sub folder xhprof_html to be accessible over HTTP
  • Move xhprof_lib/config.sample.php to xhprof_lib/config.php
  • Edit xhprof_lib/config.php
  • Update the SQL server configuration
  • Update the URL of the service (should point to xhprof_html over HTTP)
  • Update the dot_binary configuration - otherwise no call graphs!
  • Update the controlIPs variable to enable access.
  • For a development machine you can set this to false to disable IP checks.
  • Import the DB schema (it is just 1 table)
  • See the SQL at xhprof_runs.php
  • Add a PHP configuration to enable the profiling
  • If using Apache you can edit your virtual host configuration
  • Add php_admin_value auto_prepend_file "/path/to/xhprof/external/header.php"
  • Visit http://your-server/xhprof/xhprof_html/ and be amazed!
  • To get profiler information showing up there visit your page with a GET variable _profile=1.
  • For example http://localhost/?_profile=1

We Are Working On

  • The aggregation functionality is ignored completely
  • The code is... a mess. Deadlines do that to you, we're working on it
  • The default table schema isn't indexed all the places it needs to be
  • Easier ways to diff URLs

xhprof's People

Contributors

aik099 avatar beberlei avatar bertrandmalet avatar christiaan avatar dshafik avatar fragote avatar gametaunt avatar gromnan avatar helgi avatar hjr3 avatar iamkiros avatar jails avatar jwpage avatar markviafoura avatar mcarriere avatar mgdm avatar mikepsinn avatar odoucet avatar preinheimer avatar pvolyntsev avatar ritmas avatar russelldavis avatar scoates avatar sebastianbergmann avatar smalyshev avatar spk avatar tperalta82 avatar tstarling avatar willmacdonald avatar xiian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xhprof's Issues

graphviz library is missed from the requirements

Inorder to make Call graph working you need to install graphviz graphviz-devel graphviz-gd and enable it in the config.php.

$_xhprof['dot_binary'] = '/usr/bin/dot';
$_xhprof['dot_tempdir'] = '/tmp';
$_xhprof['dot_errfile'] = '/tmp/xh_dot.err';

Please add graphviz to the requirements.

Thanks

Ayman

xhprof_lib/config.php has someone elses configuration

You may want to revert a portion of this merged pull request

https://github.com/preinheimer/xhprof/blob/master/xhprof_lib/config.php

// Get some local (environment) variables from our constants file
require_once '/usr/local/viafoura/ec2metadata_constants.php';
require_once '/usr/local/viafoura/credentials.php';

global $db_credentials;

// Change these:
$_xhprof['dbtype'] = 'mysql'; // Only relevant for PDO
$_xhprof['dbhost'] = 'master.'.EC2_AVAILABILITY_ZONE.'.'.ENVIRONMENT.'.aws.viafoura.net';
$_xhprof['dbuser'] = $db_credentials[ENVIRONMENT]['username'];
$_xhprof['dbpass'] = $db_credentials[ENVIRONMENT]['password'];
$_xhprof['dbname'] = 'vf_profiling';
$_xhprof['dbadapter'] = 'Pdo';
$_xhprof['servername'] = (ENVIRONMENT == 'live')?'admin.viafoura.com':'staging.viafoura.com';
$_xhprof['namespace'] = 'myapp';
$_xhprof['url'] = (ENVIRONMENT == 'live')?'http://admin.viafoura.com/xhprof':'http://staging.viafoura.com/xhprof';

Adding index.php to links

If my web server is not configured to use index.php as default file (which is the case sometimes on nginx) some links doesn't work correctly (links on parent and child functions).
I think it can easily be fixed by changing "$base_path/?" by "$base_path/index.php?" in display/xhprof.php file.
It should not make any trouble on existing installation.

Page for a given URL only shows first 100 results logged

If more than 100 requests for the same URL have been logged and you go to view the details for that URL, it only shows you information about the first 100 requests, which makes it difficult to know what your code is currently being profiled at in relation to its history.

Ideally, it should show the latest X number of entries and allow you to browse backward. Additionally, it would be nice to be able to specify through an option on the page the number of entries it shows you at once.

It would be nice to simple download and run

Now when you have the entire environment ready to run XHprof this package require some minor manual setup, like copy a file etc, would be nice to have a composer post install script where it copy the config files and also when you run the site for first time it see no table exists it create it automatically if the user can. If not, a nice message will show telling the cause the site isn't ready yet.

Before submitting anything I prefer to create this issue to discuss and then write the code properly.

Insert failed

xhprof_runs.php in lines 431 - 433 tries to insert string in integer field.

#93

Upgrade from Facebook master

Hello,

Would a code merge from master branch at Facebook be possible to get the latest patches from there?

Thanks.

Error while using sqlite database

Encountered the following errors when used sqlite database.
I used the following configuration in the config:

$_xhprof['dbtype'] = 'sqlite:/path_to_folder/db_name';
$_xhprof['dbhost'] = '';
$_xhprof['dbuser'] = '';
$_xhprof['dbpass'] = '';
$_xhprof['dbname'] = 'db_name';
$_xhprof['dbadapter'] = 'Pdo';

There is no username and password for the sqlite.

The following error was returned:

Call to a member function fetch() on a non-object in xhprof_lib/utils/Db/Pdo.php

Compile error. PHP 5.6.18

/home/webadm/wwwroot/xhprof_new/extension/xhprof.c: In function ‘hp_get_function_name’:
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:972: warning: assignment discards qualifiers from pointer target type
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1042: warning: passing argument 1 of ‘hp_get_base_filename’ discards qualifiers from pointer target type
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:926: note: expected ‘char *’ but argument is of type ‘const char *’
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c: In function ‘hp_execute_internal’:
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1741: error: ‘zend_execute_data’ has no member named ‘Ts’
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c: In function ‘hp_compile_file’:
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1785: warning: passing argument 1 of ‘hp_get_base_filename’ discards qualifiers from pointer target type
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:926: note: expected ‘char *’ but argument is of type ‘const char *’
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c: In function ‘hp_begin’:
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1853: error: lvalue required as left operand of assignment
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1856: warning: assignment from incompatible pointer type
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1861: warning: assignment from incompatible pointer type
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c: In function ‘hp_stop’:
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1926: error: lvalue required as left operand of assignment
/home/webadm/wwwroot/xhprof_new/extension/xhprof.c:1927: warning: assignment from incompatible pointer type

Warnings during request display on single run page

The page call I was profiling was a form submit of 3 dimensional array. The code, that prints it https://github.com/preinheimer/xhprof/blob/master/xhprof_lib/templates/single_run_header_block.phtml#L132 presumes that array can't contain sub-arrays in it and uses implode on it. That in turn triggers a warning about array to string conversion.

I'm willing to make a PR with a fix, but currently the only idea I have is to display print_r output instead of doing implode.

The database is inserted with same record for the same timsestamp twice

I tried to use this package to profile PHP application. When I tried to open it read the database of what was recorded, there were two entries for the same timestamp. The first record had the pmu, wt, and cpu as what was used, but the second entry had all the values of those as 0.

xhprof-0.10.3 compile failures with Ubuntu-13.10 + Apache-2.4.6 + PHP-5.5.3

Using git version which has line...

define XHPROF_VERSION "0.10.3"

Building on latest Ubuntu... software versions follow + error spew...

net1# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.10
Release: 13.10
Codename: saucy

net1# uname -a
Linux net1.bizcooker.com 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

net1# apache2 -version
Server version: Apache/2.4.6 (Ubuntu)
Server built: Dec 5 2013 18:32:22

PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
... ... ...
net1# phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212

net1# ./configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable xhprof support... yes, shared
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands

net1# make
/bin/bash /smartbuild/work/xhprof.git/extension/libtool --mode=compile cc -I. -I/smartbuild/work/xhprof.git/extension -DPHP_ATOM_INC -I/smartbuild/work/xhprof.git/extension/include -I/smartbuild/work/xhprof.git/extension/main -I/smartbuild/work/xhprof.git/extension -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /smartbuild/work/xhprof.git/extension/xhprof.c -o xhprof.lo
libtool: compile: cc -I. -I/smartbuild/work/xhprof.git/extension -DPHP_ATOM_INC -I/smartbuild/work/xhprof.git/extension/include -I/smartbuild/work/xhprof.git/extension/main -I/smartbuild/work/xhprof.git/extension -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /smartbuild/work/xhprof.git/extension/xhprof.c -fPIC -DPIC -o .libs/xhprof.o
In file included from /usr/include/php5/main/php.h:33:0,
from /smartbuild/work/xhprof.git/extension/xhprof.c:27:
/usr/include/php5/main/php_config.h:2366:0: warning: "_GNU_SOURCE" redefined [enabled by default]
#define _GNU_SOURCE 1
^
/smartbuild/work/xhprof.git/extension/xhprof.c:24:0: note: this is the location of the previous definition

define _GNU_SOURCE

^
/smartbuild/work/xhprof.git/extension/xhprof.c: In function 'hp_get_function_name':
/smartbuild/work/xhprof.git/extension/xhprof.c:972:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
func = curr_func->common.function_name;
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1042:9: warning: passing argument 1 of 'hp_get_base_filename' discards 'const' qualifier from pointer target type [enabled by default]
filename = hp_get_base_filename((curr_func->op_array).filename);
^
/smartbuild/work/xhprof.git/extension/xhprof.c:926:14: note: expected 'char ' but argument is of type 'const char *'
static char *hp_get_base_filename(char *filename) {
^
/smartbuild/work/xhprof.git/extension/xhprof.c: In function 'hp_execute_internal':
/smartbuild/work/xhprof.git/extension/xhprof.c:1715:36: error: 'zend_execute_data' has no member named 'Ts'
#define EX(element) ((execute_data)->element)
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1716:51: note: in expansion of macro 'EX'
#define EX_T(offset) (
(temp_variable _)((char *) EX(Ts) + offset))
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1741:30: note: in expansion of macro 'EX_T'
temp_variable *retvar = &EX_T(opline->result.var);
^
/smartbuild/work/xhprof.git/extension/xhprof.c: In function 'hp_compile_file':
/smartbuild/work/xhprof.git/extension/xhprof.c:1785:3: warning: passing argument 1 of 'hp_get_base_filename' discards 'const' qualifier from pointer target type [enabled by default]
filename = hp_get_base_filename(file_handle->filename);
^
/smartbuild/work/xhprof.git/extension/xhprof.c:926:14: note: expected 'char *' but argument is of type 'const char *'
static char *hp_get_base_filename(char *filename) {
^
/smartbuild/work/xhprof.git/extension/xhprof.c: In function 'hp_begin':
/smartbuild/work/xhprof.git/extension/xhprof.c:1853:19: error: lvalue required as left operand of assignment
zend_execute = hp_execute;
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1856:28: warning: assignment from incompatible pointer type [enabled by default]
_zend_execute_internal = zend_execute_internal;
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1861:29: warning: assignment from incompatible pointer type [enabled by default]
zend_execute_internal = hp_execute_internal;
^
/smartbuild/work/xhprof.git/extension/xhprof.c: In function 'hp_stop':
/smartbuild/work/xhprof.git/extension/xhprof.c:1926:25: error: lvalue required as left operand of assignment
zend_execute = _zend_execute;
^
/smartbuild/work/xhprof.git/extension/xhprof.c:1927:25: warning: assignment from incompatible pointer type [enabled by default]
zend_execute_internal = zend_execute_internal;
^
make: *
* [xhprof.lo] Error 1

Unable to profile URL behind CDN/Load Balancer (e.g. Cloudflare)

On header.php:
if ($controlIPs === false || in_array($_SERVER['REMOTE_ADDR'], $controlIPs) || PHP_SAPI == 'cli')

This will not be vaild if behind reverse proxy e.g: cloudflare / varnish / others

Should be something like this:
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];

if(filter_var($client, FILTER_VALIDATE_IP))
{
    $ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
    $ip = $forward;
}
else
{
    $ip = $remote;
}

return $ip;

}

PHP 5.2 syntax error T_PAAMAYIM_NEKUDOTAYIM in xhprof_runs.php on line 250

when running xhprof with php 5.2 I will get the following error message

PHP Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /xhprof/xhprof_lib/utils/xhprof_runs.php on line 250

BUG:

 public static function getNextAssoc($resultSet)
  {
    $class = self::getDbClass();
    return $class::getNextAssoc($resultSet);
  }

FIX:

  public static function getNextAssoc($resultSet)
  {
    $class = self::getDbClass();
//    return $class::getNextAssoc($resultSet);

    return call_user_func($class."::getNextAssoc", $resultSet);
  }

SQL Insert Error

As per a previous #97 PR where I changed the table schema because server_id was just too small, here is a sample insert that will fail:

INSERT INTO `details` (`id`, `url`, `c_url`, `timestamp`, `server name`, `perfdata`, `type`, `cookie`, `post`, `get`, `pmu`, `wt`, `cpu`, `server_id`, `aggregateCalls_include`) VALUES('57fbf3e8c7f14', '/wp/wp-admin/plugins.php?plugin_status=all&paged=1&s&error_rep', '/wp/wp-admin/plugins.php?plugin_status=all&paged=1&s&error_rep', FROM_UNIXTIME('1476129768'), '192.168.100.182', 'x^�+���\0�_��', '1', '{\"wordpress_fb2b7f76e2c619dfcf884c05be48a525\":\"devil|1476282007|QCRWYveNGDfOh2NMXMf4SPxk9JefdoA5Z3CtjzzheMx|83effa02d40e09d6c0563447e5f4323d97088329ded1bc3c097b5425da9a54c8\",\"_profile\":\"1\",\"wordpress_logged_in_fb2b7f76e2c619dfcf884c05be48a525\":\"devil|1476282007|QCRWYveNGDfOh2NMXMf4SPxk9JefdoA5Z3CtjzzheMx|fdf80232c2e39ce6ddd3ad00abbf82d5c2bc46eef44c4c47a241e25b66b76d63\",\"wordpress_test_cookie\":\"WP Cookie check\",\"wp-settings-time-1\":\"1476129743\",\"wp-settings-1\":\"\"}', '[]', '{\"plugin_status\":\"all\",\"paged\":\"1\",\"s\":\"\",\"error_rep\":\"\"}', '0', '0', '0', 'development', '')

Will throw:

21:03:13    INSERT INTO `details` (`id`, `url`, `c_url`, `timestamp`, `server name`, `perfdata`, `type`, `cookie`, `post`, `get`, `pmu`, `wt`, `cpu`, `server_id`, `aggregateCalls_include`) VALUES('57fbf3e8c7f14', '/wp/wp-admin/plugins.php?plugin_status=all&paged=1&s&error_rep', '/wp/wp-admin/plugins.php?plugin_status=all&paged=1&s&error_rep', FROM_UNIXTIME('1476129768'), '192.168.100.182', 'x^�+���\0�_��', '1', '{\"wordpress_fb2b7f76e2c619dfcf884c05be48a525\":\"devil|1476282007|QCRWYveNGDfOh2NMXMf4SPxk9JefdoA5Z3CtjzzheMx|83effa02d40e09d6c0563447e5f4323d97088329ded1bc3c097b5425da9a54c8\",\"_profile\":\"1\",\"wordpress_logged_in_fb2b7f76e2c619dfcf884c05be48a525\":\"devil|1476282007|QCRWYveNGDfOh2NMXMf4SPxk9JefdoA5Z3CtjzzheMx|fdf80232c2e39ce6ddd3ad00abbf82d5c2bc46eef44c4c47a241e25b66b76d63\",\"wordpress_test_cookie\":\"WP Cookie check\",\"wp-settings-time-1\":\"1476129743\",\"wp-settings-1\":\"\"}', '[]', '{\"plugin_status\":\"all\",\"paged\":\"1\",\"s\":\"\",\"error_rep\":\"\"}', '0', '0', '0', 'development', '')  Error Code: 1406. Data too long for column 'server_id' at row 1 0,00075 sec

if you change "development" to let's say, dev, it will work.

Also, on your config.sample.php you have servername='myserver'; which doesn't have 3 chars, but has 8.

On the previous PR you mentioned that strict comes disabled by default, maybe on previous versions of mysql.

Tested on mysql default package from ubuntu 16.04, as well as the .deb package from mysql.com and they both come with strict_mode on, so it does not truncate the values, it just throws anerror and doesn't insert anything, personally I think it should have a bigger char allowance.

Before mysql 5.7.7 this was not enabled by default:
http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_strict_mode

This is not a bug, anyways.

Undefined variable: controlIPs

Sometimes I get a blank page with:

Notice: Undefined variable: controlIPs in /Users/simon/Sites-src/xhprof/xhprof_html/index.php on line 9
Call Stack: 0.0002 641592 1. {main}() /Users/simon/Sites-src/xhprof/xhprof_html/index.php:0Notice: Undefined variable: controlIPs in /Users/simon/Sites-src/xhprof/xhprof_html/index.php on line 9
Call Stack: 0.0002 641592 1. {main}() /Users/simon/Sites-src/xhprof/xhprof_html/index.php:0 Warning: in_array() expects parameter 2 to be array, null given in /Users/simon/Sites-src/xhprof/xhprof_html/index.php on line 9
Call Stack: 0.0002 641592 1. {main}() /Users/simon/Sites-src/xhprof/xhprof_html/index.php:0 0.0006 724160 2. in_array() /Users/simon/Sites-src/xhprof/xhprof_html/index.php:9 You do not have permission to view this page.

I use nginx with php-fpm. If I refresh the page the error go away but come back the next refresh (toggle). I have to restart php-fpm and nothing go wrong until I profile the website again... Profile will be recorded normally.

Zend Framework

Hi anyone has experience using xhprof with zend framework 1?

WooCommerce require LONGBLOB

More than an issue is something to update.

MySQL require LONGBLOB to save data for WooCommerce sites (WordPress plugin that transform a simple blog into a webstore, for those who doesn't know).

Also the server_id is server_id char(3) NOT NULL default 't11', when it need to be longer also.

Strange numbers on extremely long requests

I have a script that runs for an extended period of time it is causing some strange numbers to appear in my reports. Here's a screenshot: http://imgur.com/t3egK

A lot of the times are reported as -2147483648.0000 microsecond which makes me believe that this is a problem with the datatype on the database column (int has a minimum value of -2147483648 and a maximum value of 2147483647). I suggest that the pmu, wt, and cpu columns be changed from int to bigint unsigned, or at minimum from int to int unsigned (these values should never be negative, right?)

extension cannot install in php5.6,has error when i make in centos6.9

[root@hgTest extension]# make
/bin/sh /var/www/xhprof/extension/libtool --mode=compile cc -I. -I/var/www/xhprof/extension -DPHP_ATOM_INC -I/var/www/xhprof/extension/include -I/var/www/xhprof/extension/main -I/var/www/xhprof/extension -I/usr/local/php5.6/include/php -I/usr/local/php5.6/include/php/main -I/usr/local/php5.6/include/php/TSRM -I/usr/local/php5.6/include/php/Zend -I/usr/local/php5.6/include/php/ext -I/usr/local/php5.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/xhprof/extension/xhprof.c -o xhprof.lo
cc -I. -I/var/www/xhprof/extension -DPHP_ATOM_INC -I/var/www/xhprof/extension/include -I/var/www/xhprof/extension/main -I/var/www/xhprof/extension -I/usr/local/php5.6/include/php -I/usr/local/php5.6/include/php/main -I/usr/local/php5.6/include/php/TSRM -I/usr/local/php5.6/include/php/Zend -I/usr/local/php5.6/include/php/ext -I/usr/local/php5.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/xhprof/extension/xhprof.c -fPIC -DPIC -o .libs/xhprof.o
/var/www/xhprof/extension/xhprof.c: In function ‘hp_get_function_name’:
/var/www/xhprof/extension/xhprof.c:972: warning: assignment discards qualifiers from pointer target type
/var/www/xhprof/extension/xhprof.c:1042: warning: passing argument 1 of ‘hp_get_base_filename’ discards qualifiers from pointer target type
/var/www/xhprof/extension/xhprof.c:926: note: expected ‘char *’ but argument is of type ‘const char *’
/var/www/xhprof/extension/xhprof.c: In function ‘hp_execute_internal’:
/var/www/xhprof/extension/xhprof.c:1741: error: ‘zend_execute_data’ has no member named ‘Ts’
/var/www/xhprof/extension/xhprof.c: In function ‘hp_compile_file’:
/var/www/xhprof/extension/xhprof.c:1785: warning: passing argument 1 of ‘hp_get_base_filename’ discards qualifiers from pointer target type
/var/www/xhprof/extension/xhprof.c:926: note: expected ‘char *’ but argument is of type ‘const char *’
/var/www/xhprof/extension/xhprof.c: In function ‘hp_begin’:
/var/www/xhprof/extension/xhprof.c:1853: error: lvalue required as left operand of assignment
/var/www/xhprof/extension/xhprof.c:1856: warning: assignment from incompatible pointer type
/var/www/xhprof/extension/xhprof.c:1861: warning: assignment from incompatible pointer type
/var/www/xhprof/extension/xhprof.c: In function ‘hp_stop’:
/var/www/xhprof/extension/xhprof.c:1926: error: lvalue required as left operand of assignment
/var/www/xhprof/extension/xhprof.c:1927: warning: assignment from incompatible pointer type
make: *** [xhprof.lo] Error 1

Update INSTALL in light of recent changes to DB setup

In 59261f0 it looks like things were changed up a bit regarding how you get your DB connection set up. The INSTALL doc needs updating as it still refers to the old method, and so far I haven't been able to get it to work at all, whereas previously (before 59261f0) I was able to get it working on a different machine.

Error with the compression of perfdata

Hi,

When I try to access the info in the gui it says Given XHProf Run not found.
I was searching and the field perfdata of all the runs I have in the DB appears with the following info: x^

I was investigating and seems to be the gzcompress/gzuncompress process.

Zlib and php info:

ZLib Support => enabled
Stream Wrapper support => compress.zlib://
Stream Filter support => zlib.inflate, zlib.deflate
Compiled Version => 1.2.1.1
Linked Version => 1.2.3.3

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

PHP 5.3.3-0.dotdeb.1 with Suhosin-Patch (cli) (built: Oct 1 2010 08:49:29)

And the system is a debian lenny

Any idea on how to fix that?

Best

Each profiled request causes two records to be inserted in the database

Hello,

I'm getting two different links to the profile stats at the end of the page that I'm profiling and at the same time, I noticed that two records are being inserted into the details mysql table.
However, following only one of the links, gives me any profile data - clicking the other one, I get this:

XH GUI
Given XHProf Run not found.

Examining the grid with all requests in XHGui I noticed, that all the requests' links that when clicked showed the above message, had empty values for Wall time, CPU, etc.

My configuration:

  • Linux Ubuntu Server 11.10 (Oneiric) 32bit
  • Apache 2.2.20 (Ubuntu)
  • PHP 5.3.6-13ubuntu3.6

I've used earlier versions of XHProf and XHGui before and never experienced the double-run problem.
Please bear with me in case I'm totally missing something here.

Greetings,
Nasko

Missing image file in template diff_run_header_block.phtml

The template file ./xhprof_lib/templates/diff_run_header_block.phtml references to missing image file invert-2.png.

print("<a class=\"invert\" href=\"?run1=$run2&run2=$run1\"><img src=\"img/invert-2.png\" alt=\"Invert Report\" /></a>");                                          

Request: Reverse table sorting for numeric columns

I always sort the numeric columns descending because I rarely care to know which function calls took the least time or memory. The function name column should continue to sort normally.

The TableSorter plugin allows you to specify the default sort order per column, and I'd do it myself but it's hard to tell where each table is defined. All views seem to go through index.php. :(

Configuration steps comment in mxprof_runs_* is confusing

In the xhprof_runs_*.php file, there is a comment that describes the configuration steps that need to happen to get this project up and running. In general, it might make more sense to put this in the readme or the config file. But, even if it stays in these files, it says "4 - Configure the urlSimilator method (bottom of this file)" when the function is _urlSimilartor and is not located in that file.

URL Graph stops updating after varying number of hits

If I keep refreshing a page showing the hits to a URL (say, to "/"), I can see that requests are coming in in realtime. However, after a non-specific number of hits, the graph stops updating while showing the same most recent hit. If I go into the database table and delete, say, the last 10 hits, the graph will continue updating, though of course with the deleted rows missing.

My guess is that there is something corrupting a database entry, which, when pulled into Highcharts causes it to break.

I'm continuing to research this error as I'd really like it to work and will post more information as I find it.

Mainly I'd like to know if this is happening to anyone else as well?

Joomla

Have you tried profiling a Joomla page with the GUI. It isnt working I have not debugged it completely yet but for some reason the $_xhprof array doesn't exists by the time the application is invoked. Very odd. It exists in the header.php then when the application starts it disappears.
Anyways I tried this on Joomla 1.5 and it is a no go.

if i try to print_r( the array at the top of the footer code it doesn't exist.

Read .xhprof files from a directory?

Hi,

Is it possible / any hint if I want to feed it with .xhprof files (generated by tideways_xhprof extension) from say /tmp/xhprof directory?

Every profile run duplicated

It seems that every profile run is duplicated, with a second run that has 0 wall time and 0 cpu time. If I click the second run, I get "Given XHProf Run not found."

I'm using the prepend / append php.ini settings to run the profiler, and it's set to run every 200 requests. I'm using lighttpd with a php fast cgi back end.

(I'm not sure if that's enough information: am happy to supply more)

Some observations running on php 7.4.4

Deprecated: Function get_magic_quotes_gpc() is deprecated in xhprof/xhprof_lib/utils/xhprof_lib.php on line 689

callgraph can not be displayed -- browser says it gives an error. no error found in xh_dot.err

I don't advise anyone to use this package in it's current state for php 7.4.4

MYSQL query error

Hello,

I am using php-5.4.14 and mysql-5.6.10.
these error are generated in xhprof_lib/utils/xhprof_runs.php:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'server_id' at row 1
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'pmu' at row 1

Fixed it with:

table query

CREATE TABLE `details` (
  ....
  `server_id` varchar(40) NOT NULL default 't11',
  ....
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

xhprof_lib/utils/xhprof_runs.php: iXHProfRuns->save_run()

$sql['pmu'] = isset($xhprof_data['main()']['pmu']) ? $xhprof_data['main()']['pmu'] : 0;
$sql['wt']  = isset($xhprof_data['main()']['wt'])  ? $xhprof_data['main()']['wt']  : 0;
$sql['cpu'] = isset($xhprof_data['main()']['cpu']) ? $xhprof_data['main()']['cpu'] : 0;

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.