-
Notifications
You must be signed in to change notification settings - Fork 167
feat(prof): improve time sample accuracy by gathering during allocation samples #3559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
f14deb8
perf(profiling): piggyback time samples onto allocation samples
morrisonlevi 5d9030b
refactor orderings of collect_* and extract helpers
morrisonlevi 989876d
refactor(test): allocation + CPU combined tests
morrisonlevi c0119e9
refactor: make jq for combined samples less brittle
morrisonlevi f43a597
refactor: revert Ordering optimizations
morrisonlevi 243d028
style: use SAFETY instead of Safety
morrisonlevi a9c822e
test: hammer piggybacking
morrisonlevi 5ee032d
refactor: simplify test and hook it up properly
morrisonlevi 5d79ecd
test: fix prof-correctness
morrisonlevi aa62d66
ci(profiling): run allocation_time_combined on PHP 8.4+
morrisonlevi b1765c0
test(profiling): fix allocation_time_combined float->int
morrisonlevi 8b15661
Merge branch 'master' into levi/perf-time-alloc-piggyback
morrisonlevi 23c9bc1
ci(profiling): update expected data
morrisonlevi 7e93679
Merge branch 'master' into levi/perf-time-alloc-piggyback
morrisonlevi f52cf55
ci(profiling): run allocation_time_combined with ALLOCATION_SAMPLING_…
morrisonlevi 3a7430e
ci(profiling): ignore main for wall-time for allocation_time_combined
morrisonlevi ee910ea
EXPERIMENTAL: check ZEND_OP_DATA too
morrisonlevi e16e1b1
DEBUG: do we hit frameless icalls?
morrisonlevi a3e3e4e
DEBUG: more info in panic
morrisonlevi 1d40054
Merge branch 'master' into levi/perf-time-alloc-piggyback
morrisonlevi eb10ef8
refactor: simplify Profiler::get_timeline_timestamp
morrisonlevi 73c86a0
Revert "DEBUG: more info in panic"
morrisonlevi 520c158
Revert "DEBUG: do we hit frameless icalls?"
morrisonlevi 35ac0b6
undo experimental debugging
morrisonlevi 87a52f4
test: fix expected log message
morrisonlevi 093ce66
test: use more replaces to exaggerate effect
morrisonlevi d2d11b1
EXPERIMENT: show leaf frame
morrisonlevi 78d9cbc
Merge branch 'master' into levi/perf-time-alloc-piggyback
realFlowControl b64dd9a
do not fail fast, finish prof correctness
realFlowControl 44e2734
upload artifacts
realFlowControl d063129
Disable Xdebug for prof-correctness
realFlowControl ea6bc22
Revert "upload artifacts"
realFlowControl ddb1dfc
Merge branch 'master' into levi/perf-time-alloc-piggyback
morrisonlevi 5114acd
test: allow any non-zero wall-time for piggy-backed samples
morrisonlevi 9cb6ba1
remove first_frame for performance
morrisonlevi 1e42042
Remove misleading strlen and comment
morrisonlevi 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
realFlowControl marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
morrisonlevi marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "scale_by_duration": true, | ||
| "test_name": "php_allocation_time_combined", | ||
| "stacks": [ | ||
| { | ||
| "profile-type": "alloc-size", | ||
| "stack-content": [ | ||
| { | ||
| "regular_expression": "<?php;main;standard\\|str_replace$", | ||
| "percent": 66, | ||
| "error_margin": 1 | ||
| }, | ||
| { | ||
| "regular_expression": "<?php;main;standard\\|str_repeat$", | ||
| "percent": 33, | ||
| "error_margin": 1 | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "profile-type": "alloc-samples", | ||
| "stack-content": [ | ||
| { | ||
| "regular_expression": "<?php;main;standard\\|str_replace$", | ||
| "percent": 66, | ||
| "error_margin": 1 | ||
| }, | ||
| { | ||
| "regular_expression": "<?php;main;standard\\|str_repeat$", | ||
| "percent": 33, | ||
| "error_margin": 1 | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "profile-type": "wall-time", | ||
| "stack-content": [ | ||
| { | ||
| "regular_expression": "<?php;main;standard\\|str_replace$", | ||
| "percent": 51, | ||
| "error_margin": 50 | ||
morrisonlevi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| // Test to verify that allocation and time profiling can coexist and that | ||
| // the piggybacking optimization works (where time samples are taken during | ||
| // allocation samples when interrupt_count > 0). | ||
| // | ||
| // This test uses str_replace, a frameless function (PHP 8.4+) which allocates | ||
| // large amounts of memory, increasing the likelihood of capturing piggybacked | ||
| // samples. Frameless functions don't handle VM interrupts, making them ideal | ||
| // for demonstrating the piggybacking optimization. | ||
|
|
||
| function main() { | ||
| $duration = $_ENV["EXECUTION_TIME"] ?? 10; | ||
| $end = microtime(true) + $duration; | ||
|
|
||
| while (microtime(true) < $end) { | ||
| // str_replace is frameless in PHP 8.4+ and allocates a new string | ||
| $xs = str_repeat("x", 10_000_000); // 10MB source | ||
| $ys = str_replace("x", "y", $xs); // 10MB allocation in frameless function | ||
| $zs = str_replace("y", "z", $ys); // 10MB allocation in frameless function | ||
| } | ||
| } | ||
|
|
||
| main(); |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.