YUI Library Home

YUI Library Examples: ProfilerViewer Control: Simple Profiling

ProfilerViewer Control: Simple Profiling

In this simple example, the ProfilerViewer Control is used to profile an instance of the YUI Calendar Control. Interact with the calendar interface, then activate the ProfilerViewer to see the profile data. You can then continue to interact with the calendar, refreshing the data in the ProfilerViewer to update the profiling display.

A Simple Use Case: Profiling Calendar

One of the nice things about the YUI Profiler is that it makes it simple to profile any JavaScript function or object structure. ProfilerViewer's job is to make it just as easy to explore that data.

In this example, we create an instance of YUI's Calendar Control, tell Profiler to profile our Calendar instance, and then use ProfilerViewer to experience that data.

This example has the following dependencies:

We begin with empty div elements for Calendar and Profiler to use:

In JavaScript, we instantiate our Calendar and then pass the instance to Profiler for profiling:

Finally, we set up ProfilerViewer to consume the profiling information and make it visible in the interface:

The full JavaScript block for this example is as follows:

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings