A flame figure dynamic normalization processing method and device and medium
Patent Information
- Application Number
- CN202310981530.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-04
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-08-04
AI Technical Summary
这在分析性能问题时,存在一个弊端,想要查看某个函数在整个调用栈或相对某个调用函数的耗时比例时,无法直接查看,只能通过火焰图的方块长度大致观测或通过计算调用函数占整体的比例来间接计算二者比例,这对需要大量判断函数间的耗时对比/比例时相当麻烦
[0006]本发明提供的火焰图动态归一化处理方法的有益效果在于:在保证交互性不受影响的前提下,对火焰图提供动态归一化处理功能,进一步增强其交互性的同时,利于分析调用栈相对参数物的比例特征,即使在进行不同设备的火焰图参数比较时,也可以具有一定的归一性和通用性。
Smart Images

Figure CN117115484B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and in particular to a method, apparatus and medium for dynamic normalization processing of flame diagrams. Background Technology
[0002] Currently, flame graphs primarily provide users with the following data when analyzing performance issues: the specific function call stack of the tracing process, the overall time taken by each function call stack, and the proportion of call stack time to the total tracing time. In addition, due to the interactivity of flame graphs, users can zoom in to view specific call stack information by clicking on a function call, but the information content remains the same three types. This has a drawback when analyzing performance issues: it's impossible to directly view the proportion of a function's time taken within the entire call stack or relative to another function call. The ratio can only be roughly observed through the length of the flame graph's blocks or indirectly calculated by calculating the proportion of the call stack to the overall time. This is quite cumbersome when comparing the time taken by numerous functions. Furthermore, obtaining proportional data becomes even more tedious when interactive operations such as zooming in / out are present.
[0003] Furthermore, when the sampling periods differ across machines, the call stack time provided by the flame graph can only serve as reference data for the same type of machine. Data from two different machines cannot be directly compared. Therefore, there is an urgent need to provide a data processing method to improve the above-mentioned problems. Summary of the Invention
[0004] The purpose of this invention is to provide a method and apparatus for dynamic normalization of flame diagrams, which can be used to normalize flame diagrams in different scenarios according to a reference object to obtain normalization results.
[0005] To achieve the above objectives, in a first aspect, the present invention provides a flame graph dynamic normalization processing method, comprising: receiving an operation performed by a user on a first block in a flame graph; marking the call stack corresponding to the first block as a reference object of the flame graph; using the function call time corresponding to the reference object as benchmark data, calculating the ratio of the function call time of the call stack corresponding to other blocks in the flame graph to the benchmark data; and determining the normalization processing result of the call stack corresponding to the other blocks based on the ratio; and displaying the function names and normalized processing results in the other blocks on the other blocks.
[0006] The beneficial effects of the flame graph dynamic normalization processing method provided by this invention are as follows: while ensuring that interactivity is not affected, it provides a dynamic normalization processing function for flame graphs, further enhancing their interactivity, and facilitating the analysis of the proportional characteristics of the call stack relative to the parameters. Even when comparing flame graph parameters of different devices, it can still have a certain degree of normalization and universality.
[0007] In one possible implementation, determining the normalization result of the call stack corresponding to the other tiles based on the ratio includes: obtaining the parameters of each call stack corresponding to the other tiles; determining the correlation between each call stack corresponding to the other tiles and the reference object based on the similarity between the parameters of each call stack and the parameters of the reference object; and determining the normalization result of the call stack corresponding to the other tiles based on the ratio and the correlation.
[0008] In another possible implementation, after displaying the function names and normalized post-processing results in the other blocks on the other blocks, the method further includes: stopping the display of the normalization results when a user clears the reference object.
[0009] In other possible implementations, after displaying the function names and normalized processing results in the other blocks on the other blocks, the method further includes: when receiving an operation from the user on the second block in the flame graph, marking the call stack corresponding to the second block as the reference of the flame graph, and repeating the above steps to calculate and display the normalization processing results.
[0010] In more possible implementations, after receiving a user's operation on the second block in the flame graph, the method further includes: when receiving a user's operation on the second block in the flame graph using a combination of keys, switching the call stack corresponding to the second block in the flame graph to a special color, and automatically restoring the call stack corresponding to the first block from the special color to its original color; when the user's operation on the second block in the flame graph using the clear combination of keys, automatically restoring the call stack corresponding to the second block in the flame graph from the special color to its original color.
[0011] Secondly, the present invention provides a flame diagram dynamic normalization processing apparatus, which includes modules / units for performing any of the possible design methods described in the first aspect above. These modules / units can be implemented in hardware or by hardware executing corresponding software.
[0012] Thirdly, embodiments of this application provide an electronic device including a processor and a memory. The memory stores one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device is able to implement any of the possible design methods described in the first aspect above.
[0013] Fourthly, this application also provides a computer-readable storage medium comprising a computer program that, when run on an electronic device, causes the electronic device to perform any of the possible designs described in the first aspect above.
[0014] Fifthly, embodiments of this application also provide a method comprising a computer program product, which, when run on an electronic device, causes the electronic device to perform any of the possible designs described in the first aspect above.
[0015] For the beneficial effects of the second to fifth aspects mentioned above, please refer to the description in the first aspect mentioned above. Attached Figure Description
[0016] Figure 1 A schematic diagram of a flame diagram provided by the present invention;
[0017] Figure 2 This invention provides a schematic diagram of a flame diagram dynamic normalization process.
[0018] Figure 3 This is a schematic diagram of a flame diagram dynamic normalization processing device provided by the present invention. Detailed Implementation
[0019] like Figure 1 As shown, a flame graph is used to visually represent hierarchical or stacked data, outputting an interactive vector graphic. Flame graphs can display stacked data of any meaning; this proposal primarily addresses stacked data from the software analysis field, specifically software function call stacks, as a data source for flame graph stacking. As a two-dimensional image, the flame graph has X-axis and Y-axis views, where:
[0020] X-axis: Displays the distribution of call stack statistics (time / sample points), sorted alphabetically from left to right (regardless of the order of stack execution). The purpose is to maximize the merging of functions at the same level in the stack. Y-axis: Displays the depth of the call stack, using progressively different colors to distinguish and display layered data. The top of the stack represents the function currently being executed by the CPU, and the data below it represents its call order (viewed from bottom to top, indicating the direction of code execution). In summary, the X-axis shows the execution time of called functions and the distribution of the call stack, while the Y-axis shows the depth of the call stack. The flame graph is in SVG format and is interactive; its interactivity is shown in the table below.
[0021]
[0022] This invention can be used in scenarios where flame graphs are used to analyze performance issues. Through dynamic normalization, the flame graph can quickly and visually present the proportion of each called function relative to the reference point and provide specific proportional data, thus accelerating the analysis of performance problems. Of course, this invention is not limited to analyzing performance issues; when the stacked data forming the flame graph contains other meanings, it can also be used to analyze other problems. It is worth noting that this invention provides dynamic normalization processing for the flame graph while ensuring that these interactivity are not affected. This further enhances its interactivity and facilitates the analysis of the proportional characteristics of the call stack relative to the parameters. Even when comparing flame graph parameters across different devices, it maintains a certain degree of normalization and universality.
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] To address the problems mentioned in the background art, this application provides a method for dynamic normalization of flame graphs. Figure 1 This is a flowchart of the flame graph dynamic normalization processing method provided in an embodiment of this application. This method can be implemented in digital circuits, such as... Figure 1 As shown, the method includes the following steps:
[0026] S101, receive the user's operation on the first block of the flame graph, and mark the call stack corresponding to the first block as the reference of the flame graph.
[0027] Optionally, the call stack corresponding to the first tile will automatically switch from its original color to a special color. The flame graph output is an interactive SVG graph, whose interactivity is mainly reflected in interactive operations such as click zoom, search, and mouse hover. To ensure that its original interactive content is not affected, this embodiment of the invention can choose to provide users with a means of selecting reference objects in the form of key combinations, such as using the key combination [Ctrl] + [Shift] + [M] to select and mark reference objects, and using the key combination [Ctrl] + [Shift] + [C] to clear reference objects. For easy viewing, once a reference object is selected, the square corresponding to the reference object will change to a special color, such as white (to distinguish it from the purple of the search mark), and its special color will not change until the next reference object is cleared or selected, and it is not affected by the scaling of the flame graph. It should be understood that users can use this key combination to select any function as a reference object at any time, and this embodiment does not limit this.
[0028] S102, using the function call time corresponding to the reference object as the baseline data, calculate the ratio of the function call time of the call stack corresponding to other blocks in the flame graph to the baseline data, and determine the normalization processing result of the call stack corresponding to the other blocks based on the ratio.
[0029] In other words, after selecting a reference object using the aforementioned key combination, the data corresponding to the reference object (e.g., function call time) is used as the baseline data. The data corresponding to other blocks in the flame graph (other function call times) are divided by this baseline to obtain the ratio value relative to the baseline. Due to the diverse depth and branching patterns of flame graphs, the ratio result can be accurate to five decimal places. It should be understood that when considering the relationship or stickiness between stacks, it may be necessary to combine whether they are the same or similar stacks to obtain different parameters to calculate the final normalization result. Specifically, the parameters of each call stack corresponding to other blocks are obtained. Based on the similarity between the parameters of each call stack and the parameters of the reference object, the correlation between each call stack corresponding to other blocks and the reference object is determined. Based on the ratio and the correlation, the normalization result of the call stack corresponding to the other blocks is determined. At this point, the result not only reflects the ratio of the function relative to the reference object but also reflects the closeness to the reference object. Furthermore, the normalized result is universal across flame graphs obtained from different devices in the same tracking scenario and can be directly compared and verified.
[0030] S103, Display the function names and normalized post-processing results from the other blocks on the other blocks.
[0031] As can be seen, after the user selects and marks a reference object, the normalization process described above is performed. The normalized result is then displayed directly before the function in the box, in the form of "(data)function", where data is the normalized result value and function is the sampling function corresponding to that box. This result value remains unchanged until the user selects the next reference object and does not change with the zooming of the flame graph. Upon receiving a user's action to clear the reference object, the display of the normalization result stops.
[0032] In one possible embodiment, when a user's action on the second tile in the flame graph is received, the call stack corresponding to the second tile is marked as the reference point of the flame graph, and the above steps are repeated to calculate and display the normalization result. That is, when the user uses a key combination to select and mark another reference point, the content of all tiles in the flame graph will be normalized based on the new reference point, and the normalization result value will be refreshed. When the user uses the clear key combination to act on the second tile in the flame graph, the call stack corresponding to the second tile on the flame graph is automatically restored from its original color.
[0033] This embodiment can intuitively and clearly reflect the proportion of a called function in the overall execution process of the calling function, pinpointing the main time-consuming points. It is unaffected by the device's sampling cycle / frequency, using the same process on different devices as a reference. Assuming the reference time is consistent, data from different flame graphs can be directly compared, providing valuable insights. Furthermore, during tracing, flame graphs sometimes present all threads and calls throughout the entire tracing process. The normalized results allow users to choose a familiar call stack as a reference for investigating or verifying the call stack. Due to normalization, flame graphs from different scenarios obtained using the same reference can be directly linked and compared, further expanding the functionality of flame graphs. While this proposal uses function call / performance problem analysis as an example to illustrate the dynamic normalization scheme, it also has practical applications when the data source for the flame graph has other meanings or when using flame graphs to analyze other types of problems.
[0034] In some embodiments of this application, such as Figure 3As shown, the flame graph dynamic normalization processing device for implementing the above method includes: a receiving unit 301, used to receive the user's operation on the first block of the flame graph; a processing unit 302, used to mark the call stack corresponding to the first block as the reference of the flame graph; using the function call time corresponding to the reference as the benchmark data, calculating the ratio of the function call time of the call stack corresponding to other blocks in the flame graph to the benchmark data, and determining the normalization processing result of the call stack corresponding to the other blocks according to the ratio; and a display unit 303, used to display the function names and normalized processing results in the other blocks on the other blocks.
[0035] The above Figure 2 All relevant content of each step involved in the method embodiment shown can be referred to in the functional description of the corresponding unit module, and will not be repeated here.
[0036] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, implements the method described in the above-described method embodiments.
[0037] This application also provides an electronic device, including a processor and a memory. The memory stores one or more computer programs; when the processor executes the one or more computer programs stored in the memory, the electronic device is able to implement the methods described in the above-described method embodiments.
[0038] The present invention also provides a computer program product that, when executed by a computer, implements the method described in the above-described method embodiments.
[0039] While embodiments of the present invention have been described in detail above, it will be apparent to those skilled in the art that various modifications and variations can be made to these embodiments. However, it should be understood that such modifications and variations fall within the scope and spirit of the invention as set forth in the claims. Furthermore, the invention described herein may have other embodiments and can be implemented or carried out in various ways.
Claims
1. A method for dynamic normalization processing of flame diagrams, characterized in that, include: Receive the user's operation on the first block of the flame graph, and mark the call stack corresponding to the first block as the reference of the flame graph; Using the function call time corresponding to the reference object as the baseline data, the ratio of the function call time of the call stack corresponding to other tiles in the flame graph to the baseline data is calculated, and the normalization result of the call stack corresponding to the other tiles is determined based on the ratio. The function names and normalized post-processing results in the other blocks are displayed on the other blocks respectively.
2. The method according to claim 1, characterized in that, Determining the normalization result of the call stack corresponding to the other tiles based on the ratio includes: Obtain the parameters of each call stack corresponding to other tiles, and determine the correlation between each call stack corresponding to other tiles and the reference object based on the similarity between the parameters of each call stack and the parameters of the reference object. Based on the ratio and the correlation, the normalization result of the call stack corresponding to the other tiles is determined.
3. The method according to claim 1 or 2, characterized in that, After displaying the function names and normalized processing results in the other tiles on the other tiles, the process further includes: When the user clears the reference, the normalization result is stopped from being displayed.
4. The method according to claim 1 or 2, characterized in that, After displaying the function names and normalized processing results in the other tiles on the other tiles, the process further includes: When a user's operation on the second block of the flame graph is received, the call stack corresponding to the second block is marked as the reference of the flame graph, and the above steps are repeated to calculate and display the normalization processing result.
5. The method according to claim 4, characterized in that, After receiving the user's action on the second tile in the flame graph, the following is also included: When a user uses a combination of keys to operate on the second block in the flame graph, the call stack corresponding to the second block in the flame graph will be switched to a special color, and the call stack corresponding to the first block will automatically revert to its original color from the special color. When a user uses the clear key combination to operate on the second tile in the flame graph, the call stack corresponding to the second tile in the flame graph will be automatically restored from the special color to the original color.
6. A flame diagram dynamic normalization processing device, characterized in that, include: The receiving unit is used to receive the user's operation on the first block of the flame diagram; The processing unit is configured to mark the call stack corresponding to the first plot as the reference of the flame graph; use the function call time corresponding to the reference as the benchmark data, calculate the ratio of the function call time of the call stack corresponding to other plots in the flame graph to the benchmark data, and determine the normalization processing result of the call stack corresponding to the other plots based on the ratio. The display unit is used to display the function names and normalized post-processing results of the other blocks on the other blocks.
7. The apparatus according to claim 6, characterized in that, The processing unit determines the normalization result of the call stack corresponding to the other tiles based on the ratio, specifically for: Obtain the parameters of each call stack corresponding to other tiles, and determine the correlation between each call stack corresponding to other tiles and the reference object based on the similarity between the parameters of each call stack and the parameters of the reference object. Based on the ratio and the correlation, the normalization result of the call stack corresponding to the other tiles is determined.
8. The apparatus according to claim 6 or 7, characterized in that, After the display unit displays the function names and normalized processing results of the other blocks on the other blocks, it is also used for: When the receiving unit receives an operation from the user to clear the reference object, it stops displaying the normalization result.
9. The apparatus according to claim 6 or 7, characterized in that, After displaying the function names and normalized processing results in the other blocks on the other blocks, the display unit is also specifically used for: When the receiving unit receives an operation performed by the user on the second block in the flame graph, it marks the call stack corresponding to the second block as the reference of the flame graph, and the processing unit repeats the above steps to calculate and the display unit displays the normalization processing result.
10. The apparatus according to claim 9, characterized in that, After the receiving unit receives an operation from the user on the second block in the flame diagram, the processing unit is further configured to: When a user uses a combination of keys to operate on the second block in the flame graph, the call stack corresponding to the second block in the flame graph will be switched to a special color, and the call stack corresponding to the first block will automatically revert to its original color from the special color. When a user uses the clear key combination to operate on the second tile in the flame graph, the call stack corresponding to the second tile in the flame graph will be automatically restored from the special color to the original color.
11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Software code performance testing method and device and electronic equipment
CN115495337A
Methods and systems for automated tagging based on software execution traces
WO2016061820A1