Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/191234
Change subject: vbench: Allow 'stage' to be specified from the command line ...................................................................... vbench: Allow 'stage' to be specified from the command line Make it possible to profile a specific stage in the initialization of VisualEditor by binding the profile start and stop actions to trace.*.enter and trace.*.exit events, which VisualEditor will emit. Bug: T89536 Change-Id: Iec8036392e3d8c74c718731692ef7ea22e5cf170 --- M files/ve/vbench 1 file changed, 17 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/34/191234/1 diff --git a/files/ve/vbench b/files/ve/vbench index 5683c2d..fb022f2 100755 --- a/files/ve/vbench +++ b/files/ve/vbench @@ -62,10 +62,16 @@ # FIXME: Make this configurable. JS = ''' window.onload = function () { - // Bind a handler to VE's ready event that stops the profiler. - mw.trackSubscribe( 'event.Edit', function ( _, event ) { - if ( event.action === 'ready' ) - console.profileEnd( 've' ); + var stage = "%s"; + ve.trackSubscribe( 'trace.' + stage + '.', function ( topic ) { + switch ( topic.split( '.' ).pop() ) { + case 'enter': + console.profile( stage ); + break; + case 'exit': + console.profileEnd( stage ); + break; + } } ); // Don't show the welcome dialog. @@ -74,7 +80,6 @@ // Wait 200ms for any load handlers to run, then start VE. setTimeout( function () { - console.profile( 've' ); mw.libs.ve.onEditTabClick( { preventDefault: $.noop } ); }, 200 ); }; @@ -264,7 +269,8 @@ self.__dict__[domain_name] = domain yield domain.enable() - yield self.page.addScriptToEvaluateOnLoad(scriptSource=JS) + scriptSource = JS % self.factory.stage + yield self.page.addScriptToEvaluateOnLoad(scriptSource=scriptSource) yield self.profiler.setSamplingInterval(interval=100) if self.factory.disable_cache: @@ -413,6 +419,11 @@ help='disable network cache', ) ap.add_argument( + '--stage', + default='init', + help='Name of Specific stage to profile (default: "init")', +) +ap.add_argument( 'target_url', metavar='URL', help='URL to load', -- To view, visit https://gerrit.wikimedia.org/r/191234 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iec8036392e3d8c74c718731692ef7ea22e5cf170 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits