9
9
# Company : Code24 BV, The Netherlands #
10
10
# Author : Sergey Dryabzhinsky #
11
11
# Company : Rusoft Ltd, Russia #
12
- # Date : Feb 17 , 2023 #
13
- # Version : 1.0.51 #
12
+ # Date : May 11 , 2023 #
13
+ # Version : 1.0.52 #
14
14
# License : Creative Commons CC-BY license #
15
15
# Website : https://github.com/rusoft/php-simple-benchmark-script #
16
16
# Website : https://git.rusoft.ru/open-source/php-simple-benchmark-script #
17
17
# #
18
18
################################################################################
19
19
*/
20
20
21
- $ scriptVersion = '1.0.51 ' ;
21
+ $ scriptVersion = '1.0.52 ' ;
22
22
23
23
// Special string to flush buffers, nginx for example
24
24
$ flushStr = '<!-- ' .str_repeat (" " , 8192 ).' --> ' ;
@@ -225,6 +225,19 @@ function print_norm($msg) {
225
225
}
226
226
227
227
228
+ if (!function_exists ('gethostname ' )) {
229
+ // 5.3.0+ only
230
+ function gethostname () {
231
+ on_start ();
232
+ $ last_str = system (`hostname -f `, $ errcode );
233
+ if ($ last_str !== false ) {
234
+ return $ last_str ;
235
+ }
236
+ return '' ;
237
+ }
238
+ }
239
+
240
+
228
241
/* global command line options */
229
242
if (php_sapi_name () == 'cli ' ) {
230
243
@@ -1504,7 +1517,8 @@ function print_results_common()
1504
1517
. str_pad ("PHP BENCHMARK SCRIPT " , $ padHeader , " " , STR_PAD_BOTH )
1505
1518
. "| \n$ line \n"
1506
1519
. str_pad ("Start " , $ padInfo ) . " : " . date ("Y-m-d H:i:s " ) . "\n"
1507
- . str_pad ("Server " , $ padInfo ) . " : " . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\n"
1520
+ . str_pad ("Server name " , $ padInfo ) . " : " . gethostname () . "\n"
1521
+ . str_pad ("Server system " , $ padInfo ) . " : " . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\n"
1508
1522
. str_pad ("Platform " , $ padInfo ) . " : " . PHP_OS . "\n"
1509
1523
. str_pad ("System " , $ padInfo ) . " : " . get_current_os () . "\n"
1510
1524
. str_pad ("CPU " , $ padInfo ) . " : \n"
@@ -1577,6 +1591,9 @@ function print_results_common()
1577
1591
1578
1592
} // show only system info?
1579
1593
1594
+ echo "$ line \n" ;
1595
+ echo str_pad ("End " , $ padInfo ) . " : " . date ("Y-m-d H:i:s " ) . "\n" ;
1596
+
1580
1597
if (php_sapi_name () != 'cli ' )
1581
1598
echo "</pre> \n" ;
1582
1599
flush ();
@@ -1592,7 +1609,8 @@ function print_results_machine()
1592
1609
echo ""
1593
1610
. "PHP_BENCHMARK_SCRIPT: $ scriptVersion \n"
1594
1611
. "START: " . date ("Y-m-d H:i:s " ) . "\n"
1595
- . "SERVER: " . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\n"
1612
+ . "SERVER_name: " . gethostname () . "\n"
1613
+ . "SERVER_sys: " . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\n"
1596
1614
. "SYSTEM: " . get_current_os () . "\n"
1597
1615
. "PHP_VERSION: " . PHP_VERSION . "\n"
1598
1616
;
@@ -1627,6 +1645,8 @@ function print_results_machine()
1627
1645
flush ();
1628
1646
1629
1647
}
1648
+
1649
+ echo "END: " . date ("Y-m-d H:i:s " ) . "\n" ;
1630
1650
}
1631
1651
1632
1652
function print_results_json ()
@@ -1639,7 +1659,8 @@ function print_results_json()
1639
1659
echo ""
1640
1660
. "\"php_benchmark_script \": \"$ scriptVersion \", \n"
1641
1661
. "\"start \": \"" . date ("Y-m-d H:i:s " ) . "\", \n"
1642
- . "\"server \": \"" . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\", \n"
1662
+ . "\"server_name \": \"" . gethostname () . "\", \n"
1663
+ . "\"server_sys \": \"" . php_uname ('s ' ) . '/ ' . php_uname ('r ' ) . ' ' . php_uname ('m ' ) . "\", \n"
1643
1664
. "\"system \": \"" . get_current_os () . "\", \n"
1644
1665
. "\"php_version \": \"" . PHP_VERSION . "\", \n"
1645
1666
;
@@ -1679,7 +1700,7 @@ function print_results_json()
1679
1700
echo $ resultSecFmt . ", \"op\/sec \": " . $ resultOps . ", \"op\/sec\/MHz \": " . $ resultOpMhz . " }, \n" ;
1680
1701
}
1681
1702
print ("\"messages_count \": {$ messagesCnt }, \n" );
1682
- print ("\"end \":true \n} " . PHP_EOL );
1703
+ print ("\"end \": \"" . date ( " Y-m-d H:i:s " ). "\" \n} " . PHP_EOL );
1683
1704
flush ();
1684
1705
}
1685
1706
0 commit comments