📄 readme
字号:
ABOUTThis directory contains a tiny, very complicated frameworkfor micro benchmarks. In this document we mean by microbenchmarks PHP scripts that test certain functions of theext/mysqli API and record the runtimes of them.The tests have not much in common with real-life applications,unless you run the same query like 1.000 times in yourapplications and you fetch over and over the same results oryou call mysqli_connect() 10.000 times at the beginning of yourscripts.Therefore the micro benchmarks say nothing about real-lifeperformance. BUT they can give hints for bottle-neck analysis.THE BASIC IDEAThe basic idea here is to have several PHP binaries compiledwith different options and compare how fast they can executethe micro benchmarks. The micro benchmarks are the PHPscripts contained in the directory micro_benches/.For every PHP binaries, configured in framework/config.phpthe framework basically does:exec('/configured/php -f my_micro_bench.php')With my_micro_bench.php being something like (pseudo-code):$host = <DB host from framework/config.php>;$user = <DB user from framework/config.php>;[...]include('micro_bench_eg_mysqli_connect.php');$tmp = serialize(array('times' => $times));[...]fwrite('data_exchange_file.txt', $tmp)Then the runtimes are read from the data exchange file: - stored in a database for manual post-processing - shown on the command line - written to HTML filesCONFIGURATION / INSTALLATIONEdit framework/config.php . Read the notes in the file.The framework requires a MySQL database to store results. Install it, if needed. The default name for thedatabase is 'runbench', see the config.php.RUNNINGMake sure you have adapted framework/config.phpto your needs and followed the other INSTALLATION steps.With the default settings, runtime is about 15 minutes ona single CPU 2Ghz P4 system. The maximum memory usage isjust a bit above 1GB.Ok, you're warned. Go to the directory framework/:> cd php/ext/mysqli/tests/bench/framework/Check the syntax of the CLI script main.php:> php main.php -vMissing file and/or directory specification!Syntax: program [options] dir_or_file [dir_or_file [dir_or_file ...]]Options: -v - Verbose -h - Help -q - Quiet, suppress outputTry running a micro benchmark, for example mysqli_data_seek_random.php:> php main.php -v ../micro_benches/mysqli_data_seek_random[2007-01-31 15:48:07] Starting run for binary 'mysqli' and runner 'rb_testrunner_normal'...[...]Wait for the results. You can find a HTML representation ofthe results in the HTML output directory that you configured inframework/config.php. By default: framework/web/If the run fails, you usually see something like:...'configured/php -f mysqli_data_seek_random_php_run_normal.php'The file mysqli_data_seek_random_php_run_normal.phpis and example of the temporary file that the frameworkcreates (see THE BASIC IDEA). You can start to debug,profile - whatever you want - based on this temporary file.However, before you rerun main.php make sure you removedall of these temporary files!If you want to run all micro benchmarks, do:> php main.php -v ../micro_benchesREADING AND UNDERSTANDING RESULTSThis is difficult!Make sure you have no load on yourbox for comparable results. Make sure you study thesource of the micro benchmark files carefully.Try to understand what the scripts do.WINDOWS?Never tried it on Windows. Good luck, and don'tforget to contribute and suggest fixes if need be!OPROFILE SUPPORT?Not yet. We had it once in an older version. Basicallyyou need to write a new testrunner.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -