Commit: 3a5c74c723a2cc927f989f1c305bab29868803cf Author: Matt Ficken <v-maf...@microsoft.com> Fri, 2 Aug 2013 13:09:08 -0700 Parents: eda35d3902c6264f82e1c7ae94e1544e09043637 Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=3a5c74c723a2cc927f989f1c305bab29868803cf Log: upgrading wincache Former-commit-id: 535244fe2ee2ea476a09c203a9b6b626c2e15397 Changed paths: D cache/dep/wincache/php_wincache-1.3-5.5-nts-vc11-x86/php_wincache.dll A cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.dll A cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.pdb D conf/wincacheu.groovy A conf/wincacheu_file_and_user.groovy A conf/wincacheu_only_file.groovy A conf/wincacheu_only_user.groovy M src/com/mostc/pftt/scenario/WinCacheUScenario.java A src/com/mostc/pftt/scenario/WinCacheU_FileAndUserCacheScenario.java A src/com/mostc/pftt/scenario/WinCacheU_OnlyFileCacheScenario.java A src/com/mostc/pftt/scenario/WinCacheU_OnlyUserCacheScenario.java
diff --git a/cache/dep/wincache/php_wincache-1.3-5.5-nts-vc11-x86/php_wincache.dll b/cache/dep/wincache/php_wincache-1.3-5.5-nts-vc11-x86/php_wincache.dll deleted file mode 100644 index fca436b..0000000 Binary files a/cache/dep/wincache/php_wincache-1.3-5.5-nts-vc11-x86/php_wincache.dll and /dev/null differ diff --git a/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.dll b/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.dll new file mode 100644 index 0000000..93c6788 Binary files /dev/null and b/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.dll differ diff --git a/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.pdb b/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.pdb new file mode 100644 index 0000000..32fbed1 Binary files /dev/null and b/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.pdb differ diff --git a/conf/wincacheu.groovy b/conf/wincacheu.groovy deleted file mode 100644 index 733f427..0000000 --- a/conf/wincacheu.groovy +++ /dev/null @@ -1,8 +0,0 @@ - -def describe() { - "Enables Wincache User Cache (can use this with Opcache) to cache files and objects to accelerate PHP applications" -} - -def scenarios() { - new WinCacheUScenario() -} diff --git a/conf/wincacheu_file_and_user.groovy b/conf/wincacheu_file_and_user.groovy new file mode 100644 index 0000000..e9336c7 --- /dev/null +++ b/conf/wincacheu_file_and_user.groovy @@ -0,0 +1,8 @@ + +def describe() { + "Enables Wincache User Cache (can use this with Opcache) to cache files and user objects to accelerate PHP applications" +} + +def scenarios() { + new WinCacheU_FileAndUserCacheScenario() +} diff --git a/conf/wincacheu_only_file.groovy b/conf/wincacheu_only_file.groovy new file mode 100644 index 0000000..efe9ad3 --- /dev/null +++ b/conf/wincacheu_only_file.groovy @@ -0,0 +1,8 @@ + +def describe() { + "Enables Wincache User Cache (can use this with Opcache) to cache only files (not user objects)" +} + +def scenarios() { + new WinCacheU_OnlyFileCacheScenario() +} diff --git a/conf/wincacheu_only_user.groovy b/conf/wincacheu_only_user.groovy new file mode 100644 index 0000000..ee3a7a9 --- /dev/null +++ b/conf/wincacheu_only_user.groovy @@ -0,0 +1,8 @@ + +def describe() { + "Enables Wincache User Cache (can use this with Opcache) to cache User Objects only (not files)" +} + +def scenarios() { + new WinCacheU_OnlyUserCacheScenario() +} diff --git a/src/com/mostc/pftt/scenario/WinCacheUScenario.java b/src/com/mostc/pftt/scenario/WinCacheUScenario.java index 86338e0..d84ef48 100644 --- a/src/com/mostc/pftt/scenario/WinCacheUScenario.java +++ b/src/com/mostc/pftt/scenario/WinCacheUScenario.java @@ -1,6 +1,8 @@ package com.mostc.pftt.scenario; +import com.github.mattficken.Overridable; import com.mostc.pftt.host.Host; +import com.mostc.pftt.model.core.EBuildBranch; import com.mostc.pftt.model.core.PhpBuild; import com.mostc.pftt.model.core.PhpIni; import com.mostc.pftt.results.ConsoleManager; @@ -14,27 +16,66 @@ import com.mostc.pftt.results.ConsoleManager; // TODO http://us.php.net/manual/en/wincache.stats.php // TODO mediawiki support -public class WinCacheUScenario extends UserCacheScenario { +// TODO windebug integration - wincache includes the .PDB symbol file +public abstract class WinCacheUScenario extends UserCacheScenario { + @Overridable + protected String getDllPath55Plus(Host host) { + return host.getPfttDir()+"/cache/dep/wincache/wincache-1.3.4.1-dev-5.5-nts-vc11-x86/php_wincache.dll"; + } + @Overridable + protected String getDllPath54(Host host) { + return host.getPfttDir()+"/cache/dep/wincache/wincache-1.3.4-5.4-nts-vc9-x86/php_wincache.dll"; + } + @Overridable + protected String getDllPath53(Host host) { + return host.getPfttDir()+"/cache/dep/wincache/wincache-1.3.4-5.3-nts-vc9-x86/php_wincache.dll"; + } + // @see http://us.php.net/manual/en/wincache.configuration.php + boolean first = true; @Override public IScenarioSetup setup(ConsoleManager cm, Host host, PhpBuild build, PhpIni ini) { - // TODO temp - try { - host.copy("C:/php-sdk/PFTT/current/cache/dep/wincache/php_wincache-1.3-5.5-nts-vc11-x86/php_wincache.dll", build.getDefaultExtensionDir()+"/php_wincache.dll"); - } catch ( Exception ex ) { - ex.printStackTrace(); + if (!host.isWindows() || !build.isNTS(host)) return SETUP_FAILED; + + // TODO temp + if (first) { + String dll_path; + EBuildBranch branch; + try { + branch = build.getVersionBranch(cm, host); + } catch ( Exception ex ) { + ex.printStackTrace(); + return SETUP_FAILED; + } + switch(branch) { + case PHP_5_3: + dll_path = getDllPath53(host); + break; + case PHP_5_4: + dll_path = getDllPath54(host); + break; + default: + dll_path = getDllPath55Plus(host); + break; + } + // install wincache + try { + host.copy(dll_path, build.getDefaultExtensionDir()+"/php_wincache.dll"); + } catch ( Exception ex ) { + ex.printStackTrace(); + return SETUP_FAILED; + } + first = false; } + // enable wincache ini.putMulti(PhpIni.EXTENSION, "php_wincache.dll"); - // ini.putSingle("wincache.enablecli", "1"); - // enable file caching - ini.putSingle("wincache.fcenabled", "1"); - // enable user caching - ini.putSingle("wincache.ucenabled", "1"); + + configure(ini); // DISABLE opcode caching (required to use wincacheu with opcache scenarios) ini.putSingle("wincache.ocenabled", "0"); @@ -42,17 +83,14 @@ public class WinCacheUScenario extends UserCacheScenario { return SETUP_SUCCESS; } + protected abstract void configure(PhpIni ini); + @Override public boolean isSupported(ConsoleManager cm, Host host, PhpBuild build, ScenarioSet scenario_set) { // don't run WinCache on Apache-ModPHP (Apache CGI probably ok) // - // not sure if its supported on scenarios other than CLI or IIS (so allow it) - return !scenario_set.contains(ApacheModPHPScenario.class); - } - - @Override - public String getName() { - return "WinCacheU"; + // not sure if its supported on scenarios other than CLI or IIS (or builtin-web?) + return host.isWindows() && build.isNTS(host) && !scenario_set.contains(ApacheModPHPScenario.class); } @Override diff --git a/src/com/mostc/pftt/scenario/WinCacheU_FileAndUserCacheScenario.java b/src/com/mostc/pftt/scenario/WinCacheU_FileAndUserCacheScenario.java new file mode 100644 index 0000000..72718a8 --- /dev/null +++ b/src/com/mostc/pftt/scenario/WinCacheU_FileAndUserCacheScenario.java @@ -0,0 +1,20 @@ +package com.mostc.pftt.scenario; + +import com.mostc.pftt.model.core.PhpIni; + +public class WinCacheU_FileAndUserCacheScenario extends WinCacheUScenario { + + @Override + protected void configure(PhpIni ini) { + // enable file caching + ini.putSingle("wincache.fcenabled", "1"); + // enable user caching + ini.putSingle("wincache.ucenabled", "1"); + } + + @Override + public String getName() { + return "WinCacheU-File-And-User"; + } + +} diff --git a/src/com/mostc/pftt/scenario/WinCacheU_OnlyFileCacheScenario.java b/src/com/mostc/pftt/scenario/WinCacheU_OnlyFileCacheScenario.java new file mode 100644 index 0000000..09439bf --- /dev/null +++ b/src/com/mostc/pftt/scenario/WinCacheU_OnlyFileCacheScenario.java @@ -0,0 +1,20 @@ +package com.mostc.pftt.scenario; + +import com.mostc.pftt.model.core.PhpIni; + +public class WinCacheU_OnlyFileCacheScenario extends WinCacheUScenario { + + @Override + protected void configure(PhpIni ini) { + // enable file caching + ini.putSingle("wincache.fcenabled", "1"); + // disable user caching + ini.putSingle("wincache.ucenabled", "0"); + } + + @Override + public String getName() { + return "WinCacheU-Only-File"; + } + +} diff --git a/src/com/mostc/pftt/scenario/WinCacheU_OnlyUserCacheScenario.java b/src/com/mostc/pftt/scenario/WinCacheU_OnlyUserCacheScenario.java new file mode 100644 index 0000000..11e0caa --- /dev/null +++ b/src/com/mostc/pftt/scenario/WinCacheU_OnlyUserCacheScenario.java @@ -0,0 +1,20 @@ +package com.mostc.pftt.scenario; + +import com.mostc.pftt.model.core.PhpIni; + +public class WinCacheU_OnlyUserCacheScenario extends WinCacheUScenario { + + @Override + protected void configure(PhpIni ini) { + // disable file caching + ini.putSingle("wincache.fcenabled", "0"); + // enable user caching + ini.putSingle("wincache.ucenabled", "1"); + } + + @Override + public String getName() { + return "WinCacheU-Only-User"; + } + +}