This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Add new profling options for Facebook/hhvm #28
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,34 @@ final class PerfOptions { | |
public bool $dumpIsCompressed = true; | ||
public bool $traceSubProcess = false; | ||
public bool $noTimeLimit = false; | ||
|
||
|
||
// Pause once benchmarking is complete to allow for manual inspection of the | ||
// HHVM or PHP process. | ||
public bool $waitAtEnd = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you for adding this! |
||
|
||
// | ||
// HHVM specific options to enable RepoAuthoritative mode and the static | ||
// content cache, as well as selecting the PCRE caching mode. | ||
// | ||
public bool $precompile = false; | ||
public bool $filecache = false; | ||
public string $pcreCache = "static"; | ||
public int $pcreSize = 98304; | ||
public int $pcreExpire = 7200; | ||
public bool $allVolatile = false; | ||
public bool $interpPseudomains = false; | ||
|
||
// | ||
// HHVM specific options for generating performance data and profiling | ||
// information. | ||
// | ||
public ?string $tcprint = null; | ||
public bool $tcAlltrans = false; | ||
public bool $tcToptrans = false; | ||
public bool $tcTopfuncs = false; | ||
public bool $pcredump = false; | ||
public bool $profBC = false; | ||
|
||
// | ||
// All times are given in seconds, stored in a float. | ||
// For PHP code, the usleep timer is used, so fractional seconds work fine. | ||
|
@@ -78,6 +105,25 @@ public function __construct(Vector<string> $argv) { | |
'siege:', | ||
'nginx:', | ||
|
||
'wait-at-end', | ||
|
||
'repo-auth', | ||
'file-cache', | ||
'pcre-cache:', | ||
'pcre-cache-expire:', | ||
'pcre-cache-size:', | ||
'all-volatile', | ||
'interp-pseudomains', | ||
|
||
'fbcode::', | ||
|
||
'tcprint::', | ||
'dump-top-trans', | ||
'dump-top-funcs', | ||
'dump-all-trans', | ||
'dump-pcre-cache', | ||
'profBC', | ||
|
||
'i-am-not-benchmarking', | ||
|
||
'hhvm-extra-arguments:', | ||
|
@@ -134,6 +180,50 @@ public function __construct(Vector<string> $argv) { | |
$this->siege = hphp_array_idx($o, 'siege', 'siege'); | ||
$this->nginx = hphp_array_idx($o, 'nginx', 'nginx'); | ||
|
||
$isFacebook = array_key_exists('fbcode', $o); | ||
$fbcode = ""; | ||
if ($isFacebook) { | ||
$val = hphp_array_idx($o, 'fbcode', false); | ||
if (is_string($val) && $val !== '') { | ||
$fbcode = $val; | ||
} else { | ||
$fbcode = getenv('HOME') . '/fbcode'; | ||
} | ||
} | ||
$this->waitAtEnd = array_key_exists('wait-at-end', $o); | ||
|
||
$this->precompile = array_key_exists('repo-auth', $o); | ||
$this->filecache = array_key_exists('file-cache', $o); | ||
$this->pcreCache = (string)hphp_array_idx($o, 'pcre-cache', 'static'); | ||
$this->pcreSize = (int)hphp_array_idx($o, 'pcre-cache-size', 98304); | ||
$this->pcreExpire = (int)hphp_array_idx($o, 'pcre-cache-expire', 7200); | ||
$this->allVolatile = array_key_exists('all-volatile', $o); | ||
$this->interpPseudomains = array_key_exists('interp-pseudomains', $o); | ||
|
||
if (array_key_exists('tcprint', $o)) { | ||
$tcprint = hphp_array_idx($o, 'tcprint', null); | ||
if (is_string($tcprint) && $tcprint !== '') { | ||
$this->tcprint = $tcprint; | ||
} else if ($isFacebook) { | ||
$this->tcprint = | ||
$fbcode . '/_bin/hphp/facebook/tools/tc-print/tc-print'; | ||
} | ||
} | ||
$this->tcAlltrans = array_key_exists('dump-all-trans', $o); | ||
$this->tcToptrans = array_key_exists('dump-top-trans', $o); | ||
$this->tcTopfuncs = array_key_exists('dump-top-funcs', $o); | ||
$this->pcredump = array_key_exists('dump-pcre-cache', $o); | ||
$this->profBC = array_key_exists('profBC', $o); | ||
|
||
if ($this->tcprint !== null && | ||
!$this->tcTopfuncs && !$this->tcToptrans) { | ||
$this->tcAlltrans = true; | ||
} | ||
|
||
if ($isFacebook && $this->php5 === null && $this->hhvm === null) { | ||
$this->hhvm = $fbcode . '/_bin/hphp/hhvm/hhvm'; | ||
} | ||
|
||
$this->traceSubProcess = array_key_exists('trace', $o); | ||
|
||
$this->notBenchmarking = array_key_exists('i-am-not-benchmarking', $o); | ||
|
@@ -208,6 +298,47 @@ public function validate() { | |
'Invalid engine: %s', | ||
$engine | ||
); | ||
|
||
$tcprint = $this->tcprint; | ||
if ($tcprint !== null) { | ||
invariant( | ||
$tcprint !== '' && | ||
(shell_exec('which '.escapeshellarg($tcprint)) !== null | ||
|| is_executable($tcprint)), | ||
'Invalid tcprint: %s', | ||
$tcprint | ||
); | ||
} | ||
|
||
if ($this->tcAlltrans || $this->tcToptrans || $this->tcTopfuncs) { | ||
invariant( | ||
$tcprint !== null, | ||
'--tcprint=/path/to/tc-print must be specified if --tc-all-trans, ' . | ||
'--tc-top-trans, or --tc-top-funcs are specified' | ||
); | ||
} | ||
|
||
if ($this->filecache) { | ||
invariant( | ||
$this->precompile, | ||
'The file cache must be used with --repo-auth' | ||
); | ||
} | ||
|
||
if ($this->pcreCache !== null || $this->pcreSize || $this->pcreExpire) { | ||
invariant( | ||
$this->hhvm !== null, | ||
'The PCRE caching scheme can only be tuned for hhvm' | ||
); | ||
} | ||
|
||
if ($this->precompile) { | ||
invariant( | ||
$this->hhvm !== null, | ||
'Only hhvm can be used with --repo-auth' | ||
); | ||
} | ||
|
||
SystemChecks::CheckAll($this); | ||
|
||
// Validates that one was defined | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check /tmp/pcre_cache does not exist first?