May 26, 2021 Chrome A guide to developing tools
2. Overview of the timeline panel
5. About transparent or light gray boxes
13.. DOMContentLoaded and Load event tags
14.. Position the forced sync layout
16.. The coloring of the timeline is nested with the recording event
17.. Filter and search records
18.. Zoom in on the timeline section
20.. The user-generated event schedule
The Timeline panel lets you record and analyze all activities running in your application. It starts in the best place for your application to be aware of investigating performance issues.
The timeline has three main sections: the overview section at the top, the record view, and the toolbar.
During the recording process, the Waterfall demo view is added to each event record in the record. R ecords are divided into four categories: loading, scripting, rendering, and painting. These records are color-coded as follows:
For example, the following record is loaded into the browser's HTML page. T he first record (send request) is the HTTP request used in the web browser, followed by the received response record (for the corresponding HTTP response), some receive data record (for the actual page data), and then one completes the load record. For a complete list of record timelines and their description events, see timeline event references.
When you record a hover in a timeline, a pop-up will appear with more information about the associated event. F or example, the information shown in the screenshot below is associated with the completion load record of the image resource. The reference instructions for timeline events can be used for the details of each record type.
In addition to detailed recording, you can check one of the three modes of recording:
This activity mode provides all events captured during recording by type. A t a glance, you can see what type of task your application spends the most time on. In this view, the length of each horizontal bar corresponds to the time the event occurs to complete.
When you select a time range from the event view (see Closer in the Timeline section), the record view is limited to showing only those records.
Frame mode provides insight into the rendering performance of your application. " Frames" represents the browser must do the work of drawing content displays, running JavaScript individual frames, handling events, updating DOMs and changing style, layout and painting pages. O ur goal is for your application to run at 60 frames per second (FPS), which corresponds to the 60Hz refresh rate of most (but not all) video displays. Therefore, your application has approximately 16.6 milliseconds (1000 milliseconds/60) to prepare for each frame.
The entire frame horizontal represents the target for watching the 60 FPS and 30 FPS frame rates. T he height of a frame corresponds to the time it takes to render the frame. Color fills each frame shows the percentage of time taken for each type of task type.
Rendering a frame time is recorded in the top view. If hovered over the displayed time, additional information is displayed about the frame, including the time spent on each type of task, CPU time, and calculated FPS.
See Timeline Demo: Diagnostics and Repair Sync Forced Layout Using Frame Mode demonstration.
You may notice an area where the frame is light gray or transparent (hollow). These areas represent:
Below, both tool activity and idle time are displayed in the recording frame.
想在酒吧内的空白空格更多的细节?如果你碰到GPU瓶颈,阅读
浏览器工程师纳特杜卡的解释
,它描述了如何评估。
Painting is a two - step process that includes: drawing calls and grating scanning.
Draws the call. T his is the list you want to draw, which comes from CSS applied to the element. T he list of sweepstakes is no different from calling, Canvas elements: MOVETO, LineTo and FillRect. Although they have different names on the back end of Skia,Chrome's paintings, this is a similar concept.
So what is the difference between a stable green bar and an empty green bar in the background?
Green Real Bar Record Chrome Raffle Phone. T his occurs next to the main thread JavaScript, on the calculation style and layout. The synthesizer thread gets the grouping of data structures passed by the drawing call.
Both are paint, and they just represent different sub-tasks for the job. I f you have performance issues, you can see what properties you change. T hen, check to see if there is a synthesizer that will do the same. CSS triggers can help determine a solution to this.
The average frame rate, represented by its standard deviation, is displayed along the bottom of the selected frame range of the timeline panel. If you hover over the average number of frames, it seems to pop up with more information about frame selection:
The memory view shows counters that over time the application uses memory graphics and maintains the number of documents, DO nodes, and event listeners saved in memory (i.e., not garbage collected).
Memory mode doesn't tell you exactly what caused the memory leak, but it can help you determine which events in your application might cause the memory leak. You can then use heap sniffing to determine the specific code that caused the leak.
To record, start recording, interact with the application, and then stop recording. It helps you know in advance what kind of activity you want to record - for example, page loading, the performance of scrolling through image lists, and so on, and then stick to the script.
Recording:
A common task is to log page loads from the initial network request. Keyboard shortcuts are useful in this case because they let you quickly start recording, reload pages, and stop recording.
Record page loading:
Your record should look like this. The firsttrecord (send request) is a record of the HTTP request used in the web browser, followed by a received response to the corresponding HTTP, followed by a record of one or more received data, and an HTML record that completes the load and resolution.
See The Timeline Event reference for more information about each record type.
Here are some tips for recording:
This section provides tips for analyzing timeline recordings.
When you select a record in the timeline, the details pane displays additional information about the event.
All types that exist in some details, such as duration and CPU-time events, while others apply only to certain event types. Information details about those various records include seeing timeline event references.
When you select a drawing record, DevTools emphasizes the area of the screen updated with a blue translucent rectangle, as shown in the following image.
The timeline labels each record with blue and red lines indicated by the DOMContentLoaded and Load Event browsers, respectively. T he DOMContentLoaded event is triggered when the DOM content of all pages is loaded and analyzed. The resources (images and CSS files, etc.) of all documents burned by the load event at once have been fully loaded.
Layout is the process by which Chrome calculates the position and size of all elements on the page. T ypically, Chrome is "lazy" in performing an update layout from your app in response to CSS or DOM. T his makes Chrome bulk style and layout changes, rather than reflecting to each requirement. H owever, the application can force Chrome to perform the layout immediately and synchronously by querying the values of component performance such as element.offsetWidth. These so-called "forced synchronization layouts" can be a big performance bottleneck if repeated frequently or by large DOM trees.
Timeline identification when your application causes forced asynchronous layout and marks these records with yellow warning icons (!). ) 。 When you select the record, the details pane contains a stack trace of the code for the problem.
If the record contains child records for the mandatory layout, the parent record is marked with a slightly darkened yellow icon. Expand the parent record to determine the child record that caused the forced layout.
Forced Synchronization Layout demonstrates that demonstrationof detects and fixes such performance issues.
Events recorded in the timeline are sometimes visually nested below another event. E xpand the Parent event to see its nested Child event. There are two reasons for timeline events:
The following screenshot shows an example of a nested synchronization event. I n this case, the browser is parsing some HTML (in resolving HTML events) when it finds that several external resources need to be loaded. Chrome forward requests those that have completed parsing, so sending request events appears as parsing HTML events for children:
The color code of the timeline bar is as follows:
Selecting a parent record appears in the details pane as follows:
You can filter records that are displayed by their type (showing only load events, for example), or display records that are longer than or equal to 1 millisecond or 15 milliseconds. You can also filter the view to display events for matching strings.
While looking at all the events, you may need to find one, but keep a kind of surroundings. I n this case, you can find no filtering. Press ctrl-F (window/Linux) or Cmd's plus-F key (Mac), and the timeline has focus to display those that contain search terms.
To make it easier to analyze records, you can "zoom in" on an overview of the timeline, reducing part of the record view for the corresponding time scale.
To zoom in on the timeline section, do one of the following:
Here are a few more tips for working with timeline selection:
You can save a timeline record as a JSON file and later open it in the timeline.
To save a timeline record:
To open an existing timeline recorded file, do one of the following:
Applications can add their own events to timeline recordings. Y ou can use the theconsole.timeStamp() method to add an atomic event to the record, theconsole.time() and console.timeEnd() methodsto to mark the time code execution range. F or example, the record console.timeStamp() below has been used to display the Add Results event. View timeline Use the console for more information tags.
You'll see a light gray bar that appears above in the timeline record, indicating that the CPU is busy. H overing around a CPU bar highlights the timeline area during this period, the CPU is active (see figure below). T he length of a CPU rod is usually the sum of all the (highlighted) events below it in the timeline. If the two do not match, this may be due to one of the following:
This section lists and describes the records generated during recording by each type of type, and their properties.
Some details exist in all types of events, while others apply only to certain event types. T his section lists the properties of different event types that are common. Performance specific to certain event types is listed in references that follow the event type.
For nested event events, take the time of each type of event.
For event events with children, take the time of each type of event.
How many CPU-time-recorded events occur.
Additional details about the event.
after how long the case had been completed with all the children; A timestamp is a time event that occurs relative to the time of recording.
How long it took to happen without any children.
The amount of memory that is being used by the application is recorded in the case, and the increment of the size of the heap used in the last sample. Changes.
This section lists events that belong to class loads and their properties
Event | Describe |
---|---|
Resolve HTML | Chrome performs its HTML resolution algorithm |
The load is complete | The network request was completed |
Receive data | Requests for data are accepted and there will be one or more events that receive data |
Receive a response | The initial HTTP response from the request |
Send the request | A network request has been sent. |
The URL of the requested resource.
Preview the requested resource (image only).
HTTP method for requesting (GET or POST, for example).
HTTP response code
The resource requested by the MIME type.
The length of the requested resource in bytes.
This section lists the categories and nature of events that belong to the script.
Event | Description |
---|---|
Animated frame shooting | A is scheduled for the animation frame to be fired, and its callback handler is called |
Cancel the animation frame | The animated frame of Plan A is taken |
GC event | Garbage collection occurs |
DOMContentLoaded | The DomContentLoaded is transmitted by the browser.When this event, all the DOM contents of all pages have been loaded and analyzed. |
Assess script | The script was evaluated |
event | JavaScript event ("Mouse Press" or "Key", for example) |
Function call | Top JavaScript function calls (only when the browser enters the JavaScript engine) |
Installation timer | SetInterval () or created setTimeout () |
Request frame animation | A requestanimationFrame () calls a new framework |
Delete timer | Previously created timer clear |
time | Script call console.time () |
time's up | Scripted CalledConsole.TimeEnd () |
Timer triggered | The timer dismisses the original use setInterval () or settimeout () |
XHR ready state changes | XMLHttpRequest object changes |
XHR loading | An XMLHttpRequest completion load |
Timer ID.
The timeout specified by the timer.
Boolean value, specify that the timer is repeated.
The function called is called.
This section lists events belonging to the rendering category and its properties.
event | illustrate |
---|---|
Layout invalid | Page layout is invalid by DOM |
layout | Page layout is executed |
Recalculation style | Browser recalls element style |
scroll | The contents of the nested view are scrolled. |
The layout of the stack tracking of the invalid code will be tracked.
For layout records, the node is marked as the number of re-layouts that require layout.These are usually invalid by the developer's code, these nodes, plus a path to re-layout roots.
For the record of the layout, the total number of resembled roots under the node (the node chrome starts re-layout).
The possible value is "part" (the boundary of the re-layout is part of the DOM) or "Overall Document".
To recall the style, the number of elements is recalculated by the style.
For recalculation style records, providing stack tracking that causes invalid pattern code.
This section lists events belonging to the painting class and their attributes.
event | illustrate |
---|---|
Composite layer | Rendering Engine Image Layer of Composite Chrome |
Picture decoding | Image resource decoding |
Picture adjustment | The image is from its native size sizes |
paint | The composite layer is applied to a region of the display.Strong in a paint record highlights the area that has been updated |
Paint event, x and paint rectangular Y coordinate.
Paint events, the height and width of the painting area.