|
ActivityPanelSavedProfiles
Describes the format of Activity Panel profiles, and some common use cases.
IntroductionThe 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:
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 BuffersIn 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 FormatActivity 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. |
Sign in to add a comment
Is there a way to record a sequence of page accesses and replay it later to run an automated performance test?