My favorites | Sign in
Google
                
Search
for
Updated Jun 03, 2009 by bmcqu...@google.com
ActivityPanelSavedProfiles  
Describes the format of Activity Panel profiles, and some common use cases.

Introduction

The Page Speed Activity Panel supports saving of JavaScript execution profiles to disk, in the protocol buffer format.

Serializing profiles to disk allows developers to perform in-depth offline analysis of their JavaScript execution. For instance, a developer could write a python script to:

  • compute the number of times each function was called, the amount of time spent in each function, etc.
  • identify all JavaScript that ran for longer than a certain time threshold (to identify code that should be broken up in order to improve application responsiveness)
  • transform the call tree into some other format (e.g. dot) in order to visualize the call graph

When working with JavaScript call graph protocol buffers, there's no limit (well, almost no limit) to the information you can extract about your JavaScript execution.

How To Save Protocol Buffers

In order to build an Activity Panel profile that can be saved to disk, you first need to enable collection of full call graphs in the Activity Panel. Do this by enabling Show JavaScript Events and Full Call Graphs (slow) in the Activity Panel options menu.

Once you've enabled these options, record a profile in the Activity Panel as you normally would. Once you've collected the profile with the JavaScript you'd like to save, click the Save button in the Activity Panel. Note that the Save feature is not available on Windows, but is available in Linux and OSX. Choose a location and filename for your profile, and click Save in the Save JavaScript Activity dialog.

That's it! You've saved your profile to disk. Now it's time to write an analysis script for your protocol buffer. See the information below for details on the structure of the Activity Panel protocol buffer.

Protocol Buffer Format

Activity Panel profiles can be serialized to a Profile protocol buffer. This protocol buffer contains a list of FunctionMetadata records, followed by a list of CallTree records. A CallTree is a recursive data structure that records a function trace, starting with the function at the root of the call stack. Each CallTree is associated with a FunctionMetadata by way of the function_tag attribute, a unique 32-bit identifier.

Each CallTree record contains the invoked function's start and end times, a function_tag, and an ordered list of child CallTrees which were invoked by that function. Each FunctionMetadata record contains the function name, file name, and function source for a function, as well as a function_tag that uniquely identifies the function.

The function_tag can be used to correlate CallTree records with FunctionMetadata records. For instance, to determine the name of the function in a CallTree record, one should extract the CallTree.function_tag field, and extract the FunctionMetadata.function_name entry for the FunctionMetadata record with the matching function_tag.


Comment by krush19, Jun 04, 2009

Is there a way to record a sequence of page accesses and replay it later to run an automated performance test?


Sign in to add a comment