Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Page timer plugin (help needed)

Quote Reply
Page timer plugin (help needed)
I'm trying to create a Page timer plugin, which displays the time of a page build.
1) The starting time should be stored at the very beginning of the code. But this is not possible, because there is no hook at these positions.
Another solution is to store the starting time by hacking the LinksSQL code e.g. in Page.pm, and :
  • a)
  • storing into a global variable e.g.: $CFG->{start_time}
    or
  • b)
  • to make accessible this starting time value to all other subroutines, by passing to e.g.: build_category.
    2) The last possible position where we can put timer value into the template, is to call a subroutine from the template itself to calculate the elapsed time: <%Plugins::Timer_Page::TimeElapsed%>
    which has the following:
    sub EndTime { return sprintf ("%.3f", time - $CFG->{start_time}); }

    I'm waiting ideas, solutions how to solve this page timer plugin problem.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    Quote Reply
    Re: [webmaster33] Page timer plugin (help needed) In reply to
    Do you mean you want to time page load times?

    You could use JS but I don't have any code off hand.

    If using page.cgi you could use the handle_page hook which is called right at the beginning of the execution to start the timer.

    Last edited by:

    RedRum: Feb 21, 2002, 3:19 PM
    Quote Reply
    Re: [RedRum] Page timer plugin (help needed) In reply to
    No JS is not really a solution for me, but thanks to you the Page timer plugin works fine now.

    Your idea to use the handle_page hook was great! Wink
    It worked as I wanted!

    Thanks very much!

    I will release this plugin as freeware soon ( or donated-ware which is basically the same Cool ).

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    Quote Reply
    Re: [webmaster33] Page timer plugin (help needed) In reply to
    Out of interest, are you using Time::HiRes in the plugin?
    Quote Reply
    Re: [RedRum] Page timer plugin (help needed) In reply to
    Yes, of couse, otherwise it would be not count correctly under a second.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    Quote Reply
    Re: [webmaster33] Page timer plugin (help needed) In reply to
    Just be aware that not everyone has it installed on their server - that was the biggest problem with my search timer plugin.
    Quote Reply
    Re: [RedRum] Page timer plugin (help needed) In reply to
    Yes, I know.
    I will place a warning in the install info.

    However, who really wants a correct timer feature should install Time::HiRes perl module.

    Otherwise I can make usage of Time::HiRes optional, but then the user will be not able to measure timings under the second.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    Quote Reply
    Re: [webmaster33] Page timer plugin (help needed) In reply to
    HiRes.pm is a fairly small file so you may be able to bundle it with the plugin.
    Quote Reply
    Re: [RedRum] Page timer plugin (help needed) In reply to
    Nope.
    Time::HiRes module has compiled C++ part, so including in the plugin package is not possible.
    Also, you need admin rights to install Time::HiRes module.

    So the only solution is to make usage of Time::HiRes optional.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    Quote Reply
    Re: [webmaster33] Page timer plugin (help needed) In reply to
    >>
    Also, you need admin rights to install Time::HiRes module.
    <<

    Not if you install it locally.

    I'm not sure it can be done though....some modules can be moved about but some can't
    Quote Reply
    Re: [RedRum] Page timer plugin (help needed) In reply to
    I'm sure about this.

    I had this problem with the Time::HiRes module. It was not installed in my host, and I had only an ftp access.
    There was no possible (I tried) to make usable by copy to the correct place and adding to the path.
    I had to ask the system admin to install it.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...