You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2011/09/02 11:16:10 UTC

[jira] [Commented] (WICKET-4015) Implement a listener which can be used to measure the initialization and render times of a component

    [ https://issues.apache.org/jira/browse/WICKET-4015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095879#comment-13095879 ] 

Martin Grigorov commented on WICKET-4015:
-----------------------------------------

Unfortunately the produced numbers are not very meaningful with the current approaches.

1) Initialization time problem
Let's say we have a Page with constructor:
{
   MyComponent c1 = new MyComponent("c1");
   MyComponent c2 = new MyComponent("c2");
   c1.add(c2)
   MyComponent c3 = new MyComponent("c3");
   c2.add(c3);
...

   add(c1);
}

Here we start the measuring for c1 in its constructor but we will end the measuring at "add(c1)" call because at this point we will have the path to the Page and onInitialize() will be called. So c1's time will include the time of c2, c3, ... as well and wont be very accurate.

2) Render time problem
Wicket does something like:
for (Component child : this) {
  child.onBeforeRender();
}
for (Component child : this) {
  child.render();
}
for (Component child : this) {
  child.onAfterRender();
}
so we measure the whole time for all components, not just the component's onBefore->onAfter time.
If we find this functionality useful then we will need to add yet another callbacks: onPreRender and onPostRender, i.e.:
for (Component child : this) {
 getApplication().getOnPreRenderListeners().onPreRender(child);
 child.render();
 getApplication().getOnPreRenderListeners().onPostRender(child);
}

This way each component will report its time and its parent will have a time which is a sum of all children + its own time.

> Implement a listener which can be used to measure the initialization and render times of a component
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4015
>                 URL: https://issues.apache.org/jira/browse/WICKET-4015
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket-devutils
>    Affects Versions: 1.5-RC7
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>         Attachments: WICKET-4015.patch
>
>
> It would be a nice addition to org.apache.wicket.markup.html.debug.PageView to show how much time it took for a component to be fully initialized and the time to be rendered. This can be accomplished with a listener which implements IComponentInstantiationListener, IComponentInitializationListener, IComponentOnBeforeRenderListener, IComponentOnAfterRenderListener.
> The initialization time measures from the call to Component.<init> (IComponentInstantiationListener), to the call Component.onInitialize() (IComponentInitializationListener) because there is no way to know when the component constructor ends.
> Render time measures the time between IComponentOnBeforeRenderListener.onBeforeRender() and IComponentOnAfterRenderListener.onAfterRender().
> The duration is collected in the meta data of the respective component.
> The listener will be part of wicket-devutils sub-project.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira