Table of Contents
[Transfer] Install PHP performance testing tool xhprof for Windows Apache 2.2 PHP 5.3, performance test xhprof
Home Backend Development PHP Tutorial [Transfer] Install PHP performance testing tool xhprof for Windows Apache 2.2 PHP 5.3, performance testing xhprof_PHP tutorial

[Transfer] Install PHP performance testing tool xhprof for Windows Apache 2.2 PHP 5.3, performance testing xhprof_PHP tutorial

Jul 12, 2016 am 09:07 AM
php5

[Transfer] Install PHP performance testing tool xhprof for Windows Apache 2.2 PHP 5.3, performance test xhprof

Original link: http://blog.snsgou.com/post-816 .html

1. Download XHProf

Go here http://dev.freshsite.pl/php-extensions/xhprof.html to download the Windows version of XHProf. I choose to download it here

XHProf 0.10.3 for PHP 5.3 vc9 and xhprof_html

2. Install XHProf

Copy the xhprof_0.10.3_php53_vc9.dll in the compressed package to the PHP ext directory, and then add the configuration to the php.ini configuration (don’t forget to create the corresponding folder)

[xhprof]
extension=xhprof_0.10.3_php53_vc9.dll
; directory used by default implementation of the iXHProfRuns
; interface (namely, the XHProfRuns_Default class) for storing
; XHProf runs.
xhprof.output_dir="d:/PHP/xhprof/log"
Copy after login

 

3. Use XHProf

Extract xhprof_html.zip to the root directory of the website you want to test. For example, I placed it under /public/xhprof/windows in the website directory.

Test file:

<?php
function bar($x)
{
	if ($x > 0)
	{
		bar($x - 1);
	}
}

function foo()
{
	for ($idx = 0; $idx < 5; $idx++)
	{
		bar($idx);
		$x = strlen("abc");
	}
}

// 启动xhprof
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

// 调用foo函数,也是我们要分析的函数
foo();

// 停止xhprof

$xhprof_data = xhprof_disable();

// 取得统计数据
//print_r($xhprof_data);

$os = 'windows';

$XHPROF_ROOT = dirname(__FILE__) . '/public/xhprof/' . $os;
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";

// 保存统计数据,生成统计ID和source名称
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_foo"); // source名称是xhprof_foo

// 查看统计信息
echo "<div style='margin: 50px auto; padding :10px; width: 92px; font-size: 16px; background: #ff0000;'><a style='color:#ffff00;' href='/public/xhprof/" . $os . "/xhprof_html/index.php?run=" . $run_id . "&source=xhprof_foo' target='_blank'>XHProf view</a></div>";
Copy after login

 

When clicking the link "[View Full Callgraph]", an error will be reported:

<p>failed to execute cmd: " dot -Tpng"</p>
Copy after login

So you also need to download the graphics tool Graphviz.

4. Download Graphviz

Go here http://www.graphviz.org/Download_windows.php to download the Windows version of Graphviz. I choose to download it here

graphviz-2.38.zip

5. Install Graphviz

After decompression, copy Graphviz to a directory, such as d:/PHP/xhprof/graphviz-2.38/

6. Configure Graphviz

Find the config.php file under the above mentioned website directory /public/xhprof/windows/ and adjust it as follows:

<?php
/**
 * Set the absolute paths on your system
 */
define('ERROR_FILE', 'd:/PHP/xhprof/log/xhprof_dot_errfile.log');
define('TMP_DIRECTORY', 'd:/PHP/xhprof/tmp');
define('DOT_BINARY', 'd:/PHP/xhprof/graphviz-2.38/release/bin/dot.exe');
Copy after login

Click the link again [View Full Callgraph], and a long-awaited rendering comes out:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1061615.htmlTechArticle[Transfer] Install PHP performance testing tool xhprof for Windows Apache 2.2 PHP 5.3, performance test xhprof Original link: http: //blog.snsgou.com/post-816.html 1. Download XHProf herehtt...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the difference between php5 and php8 What is the difference between php5 and php8 Sep 25, 2023 pm 01:34 PM

The differences between php5 and php8 are in terms of performance, language structure, type system, error handling, asynchronous programming, standard library functions and security. Detailed introduction: 1. Performance improvement. Compared with PHP5, PHP8 has a huge improvement in performance. PHP8 introduces a JIT compiler, which can compile and optimize some high-frequency execution codes, thereby improving the running speed; 2. Improved language structure, PHP8 introduces some new language structures and functions. PHP8 supports named parameters, allowing developers to pass parameter names instead of parameter order, etc.

How to change port 80 in php5 How to change port 80 in php5 Jul 24, 2023 pm 04:57 PM

How to change port 80 in php5: 1. Edit the port number in the Apache server configuration file; 2. Edit the PHP configuration file to ensure that PHP works on the new port; 3. Restart the Apache server, and the PHP application will start running on the new port. run on the port.

How to solve the problem that php5 is not listening on port 9000 How to solve the problem that php5 is not listening on port 9000 Jul 10, 2023 pm 04:01 PM

Solution steps for php5 not listening to port 9000: 1. Check the PHP-FPM configuration file; 2. Restart the PHP-FPM service; 3. Turn off the firewall or configure port forwarding; 4. Check whether other processes occupy port 9000.

What is the difference between php7 and php5 syntax What is the difference between php7 and php5 syntax Jul 10, 2023 pm 03:25 PM

The syntax differences between php7 and php5 are: 1. PHP7 introduces strict type declarations, while the type of PHP5 variables is implicit; 2. PHP7 introduces support for scalar type declarations, but PHP5 does not; 3. PHP7 introduces NULL Merge operator, while PHP5 checks whether a variable exists and is not null, you need to use a conditional statement; 4. PHP7 adds a new comparison operator "<=>", but PHP5 does not; 5. PHP7 introduces a new feature anonymous class , while PHP5 does not.

What are the differences between the version of php7 and 5? What are the differences between the version of php7 and 5? Sep 15, 2023 pm 04:11 PM

The differences between the version of php7 and 5 include performance improvements, scalar type declarations, return value type declarations, exception handling improvements, anonymous classes, syntax improvements, new operators, enhanced error handling and the removal of some old features. Detailed introduction: 1. Performance improvement. PHP7 introduces a new Zend engine, named Zend Engine 3.0, which brings significant performance improvement. The performance of PHP7 is approximately twice that of PHP5, mainly through improved memory management. , optimized function calls and exception handling, enhanced garbage collection, etc.

How to solve the problem that php5 is not listening on port 9000 How to solve the problem that php5 is not listening on port 9000 Mar 21, 2023 pm 04:32 PM

When using PHP5, some users may encounter the situation that port 9000 cannot be listened to. At this time, we need to perform some configuration and troubleshooting work to solve this problem.

How to change port 80 in php5 How to change port 80 in php5 Mar 21, 2023 pm 04:32 PM

​If you are a website administrator, you may encounter a situation where you need to change the PHP5 port from the default port 80. This process may be a little hurried, but as long as you follow the steps below, it will be easily completed.

Discuss the syntax differences between PHP7 and PHP5 Discuss the syntax differences between PHP7 and PHP5 Mar 21, 2023 pm 07:10 PM

PHP is a widely used server-side programming language used to develop dynamic websites and applications. In recent years, the release of PHP7 has attracted some attention. PHP7 has many improvements and optimizations over previous versions (such as PHP5). In this article, we will explore the syntax differences between PHP7 and PHP5.

See all articles