26 |
WPPerformanceTester
27 |
WPPerformanceTester performs a series of tests to see how well your server performs. The first set test the raw server performance. The second is WordPress specific. Your results will be displayed and you can see how your results stack up against others.
28 |
29 |
34 |
35 | hyper_servers ) ) {
43 | // Grab a `write` server for the `global` dataset and fallback to `read`.
44 | // We're not really paying attention to priority or have much in the way of error checking. Use at your own risk :)
45 | $db_server = false;
46 | if ( ! empty( $wpdb->hyper_servers['global']['write'] ) ) {
47 | foreach ( $wpdb->hyper_servers['global']['write'] as $group => $dbs ) {
48 | $db_server = current( $dbs );
49 | break;
50 | }
51 | } elseif ( ! empty( $wpdb->hyper_servers['global']['read'] ) ) {
52 | foreach ( $wpdb->hyper_servers['global']['read'] as $group => $dbs ) {
53 | $db_server = current( $dbs );
54 | break;
55 | }
56 | }
57 |
58 | if ( $db_server ) {
59 | $arr_cfg['db.host'] = $db_server['host'];
60 | $arr_cfg['db.user'] = $db_server['user'];
61 | $arr_cfg['db.pw'] = $db_server['password'];
62 | $arr_cfg['db.name'] = $db_server['name'];
63 | }
64 | } else {
65 | // Vanilla WordPress install with standard `wpdb`
66 | $arr_cfg['db.host'] = DB_HOST;
67 | $arr_cfg['db.user'] = DB_USER;
68 | $arr_cfg['db.pw'] = DB_PASSWORD;
69 | $arr_cfg['db.name'] = DB_NAME;
70 | }
71 |
72 | $arr_benchmark = test_benchmark($arr_cfg);
73 | $arr_wordpress = test_wordpress();
74 |
75 |
76 | //charting from results goes here
77 | ?>
78 |
Performance Test Results (in seconds)
79 |
80 |
81 |
82 |
Test Type
83 |
84 |
* Lower (faster) time is better. Please submit your results to improve our industry average data :)
85 |
146 |
147 |
148 |
149 |
150 | Server Performance Benchmarks
151 |
152 |
153 | Test |
154 | Execution Time (seconds) |
155 |
156 |
157 |
158 |
159 | Math |
160 | |
161 |
162 |
163 | String Manipulation |
164 | |
165 |
166 |
167 | Loops |
168 | |
169 |
170 |
171 | Conditionals |
172 | |
173 |
174 |
175 | Mysql Connect |
176 | |
177 |
178 |
179 | Mysql Query Version |
180 | |
181 |
182 |
183 | Mysql Query Benchmark |
184 | |
185 |
186 |
187 |
188 |
189 | Total Time (seconds) |
190 | |
191 |
192 |
193 |
194 |
195 |
196 | WordPress Performance Benchmark
197 |
198 |
199 | Execution Time (seconds) |
200 | Queries Per Second |
201 |
202 |
203 |
204 |
205 | |
206 | |
207 |
208 |
209 |
210 |
211 |
212 | Your Server Information
213 |
214 |
215 | Test |
216 | Result |
217 |
218 |
219 |
220 |
221 | WPPerformanceTester Version |
222 | getVersion(); ?> |
223 |
224 |
225 | System Time |
226 | |
227 |
228 |
229 | Platform |
230 | |
231 |
232 |
233 | Server Name |
234 | |
235 |
236 |
237 | Server Address |
238 | |
239 |
240 |
241 | MySql Server |
242 | |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
283 |
286 |
287 |
288 |
289 |
290 | ' .
42 | esc_html__('Error: plugin "WP Performance Tester" requires a newer version of PHP to be running.', 'wp-performance-tester').
43 | '
' . esc_html__('Minimal version of PHP required: ', 'wp-performance-tester') . '' . esc_html( $WPPerformanceTester_minimalRequiredPhpVersion ) . '' .
44 | '
' . esc_html__('Your server\'s PHP version: ', 'wp-performance-tester') . '' . esc_html( phpversion() ) . '' .
45 | '
';
46 | }
47 |
48 |
49 | function WPPerformanceTester_PhpVersionCheck() {
50 | global $WPPerformanceTester_minimalRequiredPhpVersion;
51 | if (version_compare(phpversion(), $WPPerformanceTester_minimalRequiredPhpVersion) < 0) {
52 | add_action('admin_notices', 'WPPerformanceTester_noticePhpVersionWrong');
53 | return false;
54 | }
55 | return true;
56 | }
57 |
58 |
59 | /**
60 | * Initialize internationalization (i18n) for this plugin.
61 | * References:
62 | * http://codex.wordpress.org/I18n_for_WordPress_Developers
63 | * http://www.wdmac.com/how-to-create-a-po-language-translation#more-631
64 | * @return void
65 | */
66 | function WPPerformanceTester_i18n_init() {
67 | $pluginDir = dirname(plugin_basename(__FILE__));
68 | load_plugin_textdomain('wp-performance-tester', false, $pluginDir . '/languages/');
69 | }
70 |
71 |
72 | //////////////////////////////////
73 | // Run initialization
74 | /////////////////////////////////
75 |
76 | // First initialize i18n
77 | WPPerformanceTester_i18n_init();
78 |
79 |
80 | // Next, run the version check.
81 | // If it is successful, continue with initialization for this plugin
82 | if ( WPPerformanceTester_PhpVersionCheck() ) {
83 | // Only load and run the init function if we know PHP version can parse it
84 | require_once( 'wp-performance-tester_init.php' );
85 | WPPerformanceTester_init( __FILE__ );
86 | }
87 |
--------------------------------------------------------------------------------
/wp-performance-tester_init.php:
--------------------------------------------------------------------------------
1 | isInstalled()) {
34 | $aPlugin->install();
35 | }
36 | else {
37 | // Perform any version-upgrade activities prior to activation (e.g. database changes)
38 | $aPlugin->upgrade();
39 | }
40 |
41 | // Add callbacks to hooks
42 | $aPlugin->addActionsAndFilters();
43 |
44 | if (!$file) {
45 | $file = __FILE__;
46 | }
47 | // Register the Plugin Activation Hook
48 | register_activation_hook($file, array( $aPlugin, 'activate'));
49 |
50 |
51 | // Register the Plugin Deactivation Hook
52 | register_deactivation_hook($file, array( $aPlugin, 'deactivate'));
53 | }
54 |
--------------------------------------------------------------------------------