jenkins-bot has submitted this change and it was merged. Change subject: xenon log: collate stack samples and fold into single lines ......................................................................
xenon log: collate stack samples and fold into single lines So that the log data can be used as input for FlameGraph. See <https://github.com/brendangregg/FlameGraph/blob/master/README#L35-60> Change-Id: I63864cc79387deee4b640466a0d63bd3738ecc82 --- M wmf-config/StartProfiler.php 1 file changed, 24 insertions(+), 3 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/wmf-config/StartProfiler.php b/wmf-config/StartProfiler.php index 1fa6c76..117de4c 100644 --- a/wmf-config/StartProfiler.php +++ b/wmf-config/StartProfiler.php @@ -87,9 +87,30 @@ if ( extension_loaded( 'xenon' ) && ini_get( 'hhvm.xenon.period' ) ) { register_shutdown_function( function () { - $xenonData = HH\xenon_get_data(); - if ( !empty( $xenonData ) ) { - wfDebugLog( 'xenon', json_encode( $xenonData, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); + // Function names that should be excluded from the trace. + $omit = array( 'include', '{closure}' ); + + $data = HH\xenon_get_data(); + + // Collate stack samples and fold into single lines. + // This is the format expected by FlameGraph. + if ( !empty( $data ) ) { + foreach( $data as $sample ) { + $stack = array(); + foreach( $sample['phpStack'] as $frame ) { + if ( !in_array( $frame['function'], $omit ) ) { + $stack[] = $frame['function']; + } + } + $stack = implode( ';', array_reverse( $stack ) ); + $stacks[$stack] += 1; + } + + foreach( $stacks as $stack => $count ) { + $message .= "$stack $count\n"; + } + + wfDebugLog( 'xenon', $message ); } } ); } -- To view, visit https://gerrit.wikimedia.org/r/179418 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I63864cc79387deee4b640466a0d63bd3738ecc82 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits