[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Interact with the flame graph\n=============================\n\nCloud Profiler displays profiling data by using flame graphs. For a\nconceptual introduction, see [Flame graphs](/profiler/docs/concepts-flame).\n\nThe flame graph is composed of *frames*. Each frame represents a function\nin the service:\n\n- The width of a frame corresponds to its consumption of the\n metric being analyzed. The top frame, for example, represents the entire\n service and consumes 100% of the metric being analyzed. Therefore, this\n frame is shown as full width.\n\n- By default, the frame color corresponds, where possible,\n to the function's package. If\n package information is unavailable, as with Node.js, the names of the source\n files are used to color the function blocks. In a call stack, a change in\n block color means a transition from one package to another. You can change\n the way the frames are colored. For more\n information, see [Color mode](/profiler/docs/filtering-profiles#color-filter).\n\nThe flame graph shows one or more call stacks with the values\naveraged over a set of profiles:\n\n- Each individual profile represents data collected one time per minute from a single instance of the configured service in a single Compute Engine zone. The collection period for a profile varies with the profile type. See [Profile collection](/profiler/docs/concepts-profiling#collection) for more information.\n- A maximum of 250 profiles are averaged. If there are more than 250 profiles available, 250 of them are selected randomly as a sample set.\n- The top frame, or \"root\", in a flame graph represents the entire service. Under the \"root\" frame, is another frame or set of frames making up the second row in the graph. Each of these color-coded frames is a top-level call made by the service. Under each of those colored function frames is another set of function frames, each of which is responsible for some part of the resource of the frame above it. The hierarchy of function frames in the graph represents the call sequence, and the width of a frame represents that function or method's contribution to the resource consumption.\n\nFor example, the profiler graph of the consumed heap for the docdemo-service\nshows that the service calls different top-level frames, one\nof them is the Go runtime's `main` function. The width of these\ntop-level frames show the majority of the heap is consumed by the call stack\ninvolving Go runtime's `main`,\napplication-specific `main`, `allocOnce`, and `allocImpl`:\n\nThe root frame displays metric consumption information.\n\nHovering over a frame\n---------------------\n\nWhen you hold the pointer over a frame in the flame graph, a frame tooltip opens\nand displays additional information about the frame:\n\n- Function name\n- Function filename\n- Absolute usage and percentage usage\n\nIn the metric consumption information, the prefix **total** indicates that the\nmetric-value and percentage are for a function and its children.\nIn contrast, the prefix **self** indicates the metric-value and percentage\nare for the function with the consumption of its children excluded.\n\nThe dialog also includes buttons:\n\n- [**Focus**](/profiler/docs/focusing-profiles): Focuses the graph on the current frame's function.\n- [**Show stacks**](/profiler/docs/filtering-profiles#stack-filters): Adds a filter to only show the stacks that include this frame's function.\n- [**Show history**](/profiler/docs/history-view): Opens the history view for the frame's function.\n\nIn this example, the tooltip shows that the `runtime.main` function\nis located in the `/usr/local/go/src/runtime/proc.go` file. The\nmetric consumption information shows that `runtime.main` and its children\nconsume 54.73 MiB of\nmemory, or about 98% of the total memory consumed by the program:\n\nSelecting a frame\n-----------------\n\nWhen you select a frame, the flame graph is redrawn with that frame shown full\nwidth and the colors higher in the call stack are muted. Selecting on a\nframe doesn't change any settings, it only changes how the graph is displayed.\nTo revert to the original view, select the root (top) frame.\n\nIn the following example, the pointer\nis on a tiny frame and it is difficult to view the call stack. The tooltip\nidentifies `(*huffmanBitWriter).write` as the frame function:\n\nAfter you select the frame, the graph is redrawn, making the call stack\nmore visible:\n\n| **Note:** To restore a standard flame graph to the original state, select the root (top) frame. To restore a focused flame graph to its original state, select the frame that displays the value of the **Focus** filter. For example, if your filter bar contains `Focus: Sort`, select the frame with the label `Sort`.\n\nWhat's next\n-----------\n\n- [Filter the flame graph](/profiler/docs/filtering-profiles).\n- [Focus the flame graph on a function](/profiler/docs/focusing-profiles).\n- [View historical trends](/profiler/docs/history-view).\n- [Compare profiles](/profiler/docs/comparing-profiles)."]]