多用途的Trace利器Chrome Trace Viewer,性能分析神器

 

 

about:tracing

chrome://tracing

 

 

In-depth: Using Chrome://tracing to view your inline profiling data

The tracing data format is a non-optimized JSON file containing a sequence of event blocks. Each block includes the following name/value pairs:

  • 'cat' – the category for this event. Useful when doing larger grouping (eg "UnitUpdates")

  • 'name' – the name of this event (eg 'PathingUpdate')

  • 'pid' – the processor ID that spawned this event

  • 'tid' – the thread ID that spawned this event

  • 'ts' – the processor time stamp at the time this event was created

  • 'ph' – the phase or type of this event

  • 'args' – any programmatic metadata that's attached to this event

For an example, a JSON file with a single begin/end sample is listed below. Note that an event include descriptions of its category as well as its name. Some events occur in pairs, which are marked by complementary phases (B/E or S/F – read more about that below).

[
{
     "cat": "MY_SUBSYSTEM",  //catagory
     "pid": 4260,  //process ID
     "tid": 4776, //thread ID
     "ts": 2168627922668, //time-stamp of this event
     "ph": "B", // Begin sample
     "name": "doSomethingCostly", //name of this event
     "args": { //arguments associated with this event.
       }
},
]

Some sample data from the profiler's format. You can see there's a named category, as well as a name of the scoped event we're tracking. Some events come in pairs of phases (see below).

Understanding the phase ('ph') tag

Sample Begin/End events ( ph = B / E )

The most common event types are sample begin and sample end, denoted by setting the phase tag to "B" and "E" respectively. These events define the start and end points of a sampling time interval.

Instant events ( ph = I )

Instant events, denoted with an "I" phase tag, are great for tossing extra information into the stream to mark actions or events in your game, such as LevelLoadComplete, or SuperHugeMonsterStartedAttack.Instant markers in the timeline appear as small triangles. The visual difference is crucial when scrubbing over large portions of data.

Async Start/Finish events ( ph = S/F )

Async events can occur across multiple threads/processes. They are useful for tracing operations like texture loads that can start activity on other threads. The start of an async event is denoted by setting the phase tag to "S" (for start) and the end by setting the tag to "F" (for finish).

Event metadata (args)

Along with instances, chrome://tracing supports per-sample metadata (called args in the format), which can be filled in with name/value pairs of arbitrary data. This appends information to a specific event. Anyone who's scrubbed through inline profiling data will tell you that these types of markers are invaluable when you get barraged by a flood of samples with the same call stack and need a way to determine the data associated with each instance.Every Event and Instance can have annotated data associated with it, which is very helpful in tracking down unique data relating to a sample.

 

 

 

 

GitHub - walidbr/perfetto_c: C wrapper to use C++ perfetto API

 

DarkKowalski/tiny-event-trace: Profile your C code with chrome://tracing (github.com)

 

hrydgard/minitrace: Simple C/C++ library for producing JSON traces suitable for Chrome's built-in trace viewer (about:tracing). (github.com)

 

DarkKowalski/mri-trace-event-profiling-tool: chrome://tracing profiling tool for Matz's Ruby Interpreter (github.com)

 

mmolch/ctef-profile: A simple one-file (github.com)

Leandros/tinyprofiler: Json generator for about:tracing / chrome://tracing profiler (github.com)

vertexodessa/chrome_tracing: Simple c/c++ API to generate .trace files for chrome://tracing (github.com)

 uucidl/uu.spdr: Instrument your C/C++ programs with traces, see them in chrome://tracing (github.com)

 

运行性能监控工具Minitrace使用方法_Guosheng-zZ的博客-CSDN博客

 

 

KDAB/ctf2ctf: Common Trace Format to Chrome Trace Format converter (github.com)

 

 

Babeltrace · A trace manipulation toolkit

Common Trace Format

The Common Trace Format (CTF) is a binary trace format designed to be very fast to write without compromising great flexibility. It allows traces to be natively generated by any C/C++ application or system, as well as by bare-metal (hardware) components.

With CTF, all headers, contexts, and event fields written in binary files are described using a custom C-like, declarative language called the Trace Stream Description Language (TSDL). Numerous binary trace stream layouts may be described in TSDL thanks to CTF's extensive range of available field types.

Babeltrace is the reference implementation of the Common Trace Format. It is a trace conversion application/C library which is able to read and write CTF, supporting almost all its specified features. Babeltrace also ships with Python 3 bindings to make it easier to open a CTF trace and iterate on its events in seconds.

 

 

Tracing — Zephyr Project Documentation

 

 

 

ADVANCED trouble-shooting of critical real-time systems (eclipse.org)

Trace Compass (eclipse.dev)

 Trace Compass (eclipse.dev)

 

 

其他工具

SystemView (segger.com)

 

Tracealyzer

 

posted @   sinferwu  阅读(715)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示