com web/rmtools: basic pgo support with the pgo_integration branch yet: data/config/branch/x64/phpmaster.ini data/config/branch/x86/phpmaster.ini
include/BuildVC .php script/snap.php
| From: | Anatol Belski | Date: | Thu, 10 Aug 2017 01:48:28 +0000 |
| Subject: | com web/rmtools: basic pgo support with the pgo_integration branch yet: data/config/branch/x64/phpmaster.ini data/config/branch/x86/phpmaster.ini include/BuildVC .php script/snap.php |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26288@lists.php.net to get a copy of this message | ||
Commit: f2140033fc1f8428a48cb000bc2154250aa9ba1a
Author: Anatol Belski <ab@php.net> Thu, 10 Aug 2017 03:48:28 +0200
Parents: 3f5bf6b1b005483aa1712a24d1404d1a6c0e00f3
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=f2140033fc1f8428a48cb000bc2154250aa9ba1a
Log:
basic pgo support with the pgo_integration branch yet
Changed paths:
M data/config/branch/x64/phpmaster.ini
M data/config/branch/x86/phpmaster.ini
M include/BuildVC.php
M script/snap.php
Diff:
diff --git a/data/config/branch/x64/phpmaster.ini b/data/config/branch/x64/phpmaster.ini
index a2df559..748b4f7 100644
--- a/data/config/branch/x64/phpmaster.ini
+++ b/data/config/branch/x64/phpmaster.ini
@@ -7,7 +7,7 @@ build_dir=C:/php-snap-build/obj-x64
build_location=C:/php-snap-build/snap_master/vc15/x64
appver=
debug=0
-pgo=0
+pgo=1
compiler=vc15
arch=x64
diff --git a/data/config/branch/x86/phpmaster.ini b/data/config/branch/x86/phpmaster.ini
index 9c9b497..24176d7 100644
--- a/data/config/branch/x86/phpmaster.ini
+++ b/data/config/branch/x86/phpmaster.ini
@@ -7,7 +7,7 @@ build_dir=C:/php-snap-build/obj
build_location=C:/php-snap-build/snap_master/vc15/x86
appver=
debug=0
-pgo=0
+pgo=1
compiler=vc15
arch=x86
diff --git a/include/BuildVC.php b/include/BuildVC.php
index 47ee5f6..c32de9c 100644
--- a/include/BuildVC.php
+++ b/include/BuildVC.php
@@ -120,6 +120,41 @@ class BuildVC {
$this->log_buildconf = $ret['log'];
}
+ function isPgoSetup()
+ {
+ $cmd = 'phpsdk_pgo --ready';
+ $ret = exec_single_log($cmd, $this->build_dir, $this->env);
+ if (!$ret) {
+ throw new \Exception('phpsdk_pgo --ready failed');
+ }
+
+ return 0 == $ret["return_value"];
+ }
+
+ function pgoInit()
+ {
+ $this->log_pgo = isset($this->log_pgo) ? $this->log_pgo . "\n" : "";
+
+ $cmd = 'phpsdk_pgo --init';
+ $ret = exec_single_log($cmd, $this->build_dir, $this->env);
+ if (!$ret || 0 != $ret["return_value"]) {
+ throw new \Exception('phpsdk_pgo --init failed');
+ }
+ $this->log_pgo .= $ret["log"];
+ }
+
+ function pgoTrain()
+ {
+ $this->log_pgo = isset($this->log_pgo) ? $this->log_pgo . "\n" : "";
+
+ $cmd = 'phpsdk_pgo --train';
+ $ret = exec_single_log($cmd, $this->build_dir, $this->env);
+ if (!$ret || 0 != $ret["return_value"]) {
+ throw new \Exception('phpsdk_pgo --train failed');
+ }
+ $this->log_pgo .= $ret["log"];
+ }
+
function configure($extra = false, $rm_obj = true)
{
$args = $this->branch->config->getConfigureOptions($this->build_name) . ($extra ?:
$extra);
diff --git a/script/snap.php b/script/snap.php
index d960535..6b4c37b 100644
--- a/script/snap.php
+++ b/script/snap.php
@@ -65,27 +65,6 @@ for ($i = 0; $i < count($builds_top) && ($force ||
$branch->hasNewRevision()); $
$have_build_run = true;
echo "processing revision $last_rev\n";
- if ($branch->config->getPGO() == 1) { // Check revision to maintain concurrent builds
- $fh = fopen(getenv("PHP_RMTOOLS_LOCK_PATH") .
"/snaps_".$build_type.".lock", "a");
- fwrite($fh, "$last_rev");
- fclose($fh);
- if (strcmp($build_type, 'nts') == 0) {
- if (!file_exists(getenv("PHP_RMTOOLS_LOCK_PATH") . "/snaps_ts.lock")) {
- echo "Waiting for thread-safe build, exiting.\n";
- exit(0);
- }
- else {
- $fh = fopen(getenv("PHP_RMTOOLS_LOCK_PATH") . "/snaps_ts.lock",
"r");
- $data = fread($fh, filesize(getenv("PHP_RMTOOLS_LOCK_PATH") .
"/snaps_ts.lock"));
- fclose($fh);
- if (!preg_match("/$last_rev/", $data)) {
- echo "Revision mismatch on concurrent builds, waiting for ts build to complete\n";
- exit(0);
- }
- }
- }
- }
-
$build_dir_parent = $branch->config->getBuildLocation();
if (!is_dir($build_dir_parent)) {
@@ -143,6 +122,18 @@ for ($i = 0; $i < count($builds_top) && ($force ||
$branch->hasNewRevision()); $
echo "running build in <$build_src_path>\n";
$build->buildconf();
if ($branch->config->getPGO() == 1) {
+ /* For now it is enough to just get a very same
+ build of PHP to setup the environment. This
+ only needs to be done once for setup. In further
+ also, if there are any difference with TS/NTS,
+ there might be some separate setup needed. */
+ if (!$build->isPgoSetup()) {
+ echo "Preparing PGO training environment\n";
+ $build->configure();
+ $build->make();
+ $build->pgoInit();
+ $build->make(' clean-all');
+ }
echo "Creating PGI build\n";
$build->configure(' "--enable-pgi" ');
}
@@ -150,39 +141,32 @@ for ($i = 0; $i < count($builds_top) && ($force ||
$branch->hasNewRevision()); $
$build->configure();
}
$build->make();
- $html_make_log = $build->getMakeLogParsed();
- $build->makeArchive();
+ /* $html_make_log = $build->getMakeLogParsed(); */
} catch (Exception $e) {
echo $e->getMessage() . "\n";
echo $build->log_buildconf;
}
if ($branch->config->getPGO() == 1) {
- if ($build->archive_path) {
- echo "Running pgo_controller.ps1 with PGI build at $build->archive_path,
ver=$branch_name, opcache=0\n";
- $cmd = 'c:\windows\system32\WindowsPowerShell\v1.0\powershell..exe -NonInteractive
-Command C:\php-sdk\pgo-build\pgo_controller.ps1 -PHPBUILD '. $build->archive_path . '
-PHPVER ' . $branch_name;
- $pgolog = rm\exec_single_log($cmd);
- print_r($pgolog);
- if ( preg_match('/5\.5/', $branch_name) ) {
- echo "Running pgo_controller.ps1 with PGI build at $build->archive_path,
ver=$branch_name, opcache=1\n";
- $cmd = 'c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive
-Command C:\php-sdk\pgo-build\pgo_controller.ps1 -PHPBUILD '. $build->archive_path . '
-PHPVER ' . $branch_name . ' -OPCACHE 1';
- $pgolog = rm\exec_single_log($cmd);
- print_r($pgolog);
- }
-
- echo "Creating PGO build\n";
- try {
- $build->make(' clean-pgo');
- $build->configure(' "--with-pgo" ', false);
- $build->make();
- $html_make_log = $build->getMakeLogParsed();
- $build->makeArchive();
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- echo $build->log_buildconf;
- }
+ echo "Creating PGO build\n";
+ try {
+ $build->pgoTrain();
+ $build->make(' clean-pgo');
+ $build->configure(' "--with-pgo" ', false);
+ $build->make();
+ $html_make_log = $build->getMakeLogParsed();
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ echo $build->log_buildconf;
}
}
+ try {
+ $build->makeArchive();
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ echo $build->log_buildconf;
+ }
+
if ($build->archive_path) {
copy($build->archive_path, $toupload_dir . '/php-' . $branch_name_short .
'-' . $build_name . '-r'. $last_rev . '.zip');
}
@@ -201,6 +185,9 @@ for ($i = 0; $i < count($builds_top) && ($force ||
$branch->hasNewRevision()); $
file_put_contents($toupload_dir . '/logs/configure-' . $build_name . '-r'.
$last_rev . '.txt', $build->log_configure);
file_put_contents($toupload_dir . '/logs/make-' . $build_name . '-r'.
$last_rev . '.txt', $build->log_make);
file_put_contents($toupload_dir . '/logs/archive-' . $build_name . '-r'.
$last_rev . '.txt', $build->log_archive);
+ if ($branch->config->getPGO() == 1) {
+ file_put_contents($toupload_dir . '/logs/pgo-' . $build_name . '-r'.
$last_rev . '.txt', $build->log_pgo);
+ }
$html_make_log = $build->getMakeLogParsed();
file_put_contents($toupload_dir . '/logs/make-' . $build_name . '-r'.
$last_rev .. '.html', $html_make_log);