What's new? | Help | Directory | Sign in
Google
             
Search
for
Updated Jun 22, 2008 by scottru
Jiffy_js  
Jiffy.js file is the core Javascript library for instrumenting your pages.

Mark & Measure

Mark and Measure are the fundamental concepts around building page measurements.

Each measure is then combined with some metadata and then either posted immediately back to the web server or held for a bulk post at the end of measure processing.

Here's an example timing the loading and execution of a Javascript call:

<script type="text/javascript">
  Jiffy.mark("slowThirdPartyStart");
</script>

<script type="text/javascript" src="http://www.slowsite.com/slow.js"></script>

<script type="text/javascript">
  Jiffy.measure("slowThirdPartyDone", "slowThirdPartyStart");
</script>

All measures are captured into a JSON object that can be accessed through the public method Jiffy.getMeasures() The return is a JSON object with a sample layout which looks like the following:

{
  "PageStart": { et: 2676, m: [
     {et:2676, evt:"load", rt:1213159816044}
   ]},
  "onLoad": { et: 74, m: [
     {et:7,  evt:"carouselcreated", rt:1213159818722},
     {et:67, evt:"finishedonLoad",  rt:1213159818729}
   ]}
}

Jiffy Parameters

JiffyParams is a globally scoped hash. Including these parameters are optional.

example:

<script type="text/javascript">
  var JiffyParams = {
     jsStart: (new Date()).getTime(),
     uid: <xsl:value-of select="/page/settings/random" />,
     pname: '<xsl:value-of select="$pagename" />'
  }
</script>

Jiffy Options

Jiffy.js sets some options, overridable in your own content with a globally scoped hash named JiffyOptions. These are usually set sitewide.

example:

<script type="text/javascript">
  JiffyOptions = {
    USE_JIFFY:true,
    ISBULKLOAD: true,
    BROWSER_EVENTS: {"unload":window,"load":window},
    SOFT_ERRORS: false
  };
</script>

Jiffy Batch & Realtime logging

There are two different methods, batch and realtime, that can be used to send data to the Apache log.

Batch

Batch will take all measures that are captured before page load (including the load event) and post them in one single AJAX call to the server. The URL format for this is

yourURL.com/rx?uid=xxxxxxx,st=xxxxx,pn=somename,ets=slowJS:12,evenslowerJS:190

Realtime

Realtime will take measures as they are happening and send them as the calls to Jiffy.measure happen. This will allow you to get data as it is happening, and in the case where someone may drop off before the page load event is executed, you still get some data from the client. The format is the same except that ets will only contain one element.

yourURL.com/rx?uid=xxxxxxx,st=xxxxx,pn=somename,ets=slowJS:12

In each case,


Comment by tiagogavazza, Jun 25, 2008

werty jgjgkg


Sign in to add a comment