Flame graph generation method and device, storage medium and electronic device
By processing the sampling points and symbol information of multiple nodes on the data center side to generate a flame graph, the problem of excessive resource usage on the node side is solved, and efficient performance analysis and problem location are achieved.
Patent Information
- Application Number
- CN202510593802.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-05-08
AI Technical Summary
In the prior art, generating a flame graph through a single node results in excessive resource usage on the node side.
By sampling the execution process of multiple threads, the sampling point information is obtained and sent to the data center. Combined with the target symbol information, it is processed on the data center side to generate a flame graph, avoiding resource-intensive tasks on the node side.
Migrate resource-intensive tasks to data centers with higher computing power and storage capacity to optimize performance analysis processes, reduce node-side resource usage, and accelerate problem location.
Smart Images

Figure CN120104441B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a flame graph, a storage medium, and an electronic device. Background Art
[0002] Flame graphs are a key tool for software system performance analysis, widely used in servers, distributed systems, web applications, databases, games, Android applications, and other fields. By visualizing collected call chain data, they help quickly locate performance bottlenecks and stack call processes. The flame graph tool analyzes call chain data statistically, counting the execution time, number of calls, and call relationships of the call chain. It uses heat maps to visually display the stack call process, reflecting hot call functions and call relationships, helping developers quickly locate performance bottlenecks and call processes. In existing technologies, flame graph generation is typically implemented on the node side of a distributed system. However, this approach consumes significant storage and computing resources on the node side, severely impacting system performance.
[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0004] The embodiments of the present application provide a flame graph generation method and apparatus, a storage medium, and an electronic device to at least solve the technical problem that generating a flame graph through a single node results in excessive resource usage on the node side.
[0005] According to one aspect of an embodiment of the present application, a flame graph generation method is provided, comprising: sampling execution processes of multiple threads to obtain multiple sampling point information, wherein the sampling point information includes at least target address information corresponding to the multiple threads at sampling moments; sending the multiple sampling point information to a data center; and sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center. The data center processes the multiple sampling point information and the target symbol information to obtain a target flame graph.
[0006] Furthermore, sampling the execution processes of the multiple threads to obtain the multiple sampling point information includes: if the flame graph to be generated is a flame graph of the first type, sampling time information when the multiple threads are executed in the central processing unit to obtain the multiple sampling point information; if the flame graph to be generated is a flame graph of the second type, sampling time information when the multiple threads are called out of the central processing unit and called into the central processing unit to obtain the multiple sampling point information.
[0007] Furthermore, sampling the execution process of the multiple threads to obtain the multiple sampling point information includes: determining, for a target node among the multiple nodes, a target thread on which the multiple threads are running, wherein the target node is any one of the multiple nodes; and sampling the execution process of the target thread to obtain the multiple sampling point information.
[0008] Furthermore, sending target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center includes: matching the target address information based on a preset symbol information table to obtain initial symbol information corresponding to the target address information; performing deduplication processing on the initial symbol information to obtain the target symbol information; and sending the target symbol information to the data center.
[0009] Furthermore, before sending target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center, the method further includes: determining, for a target node in the plurality of nodes, a plurality of functions involved in the target node, wherein the target node is any one of the plurality of nodes; performing a hash transformation on address information corresponding to the plurality of functions to obtain symbol information corresponding to functions in the plurality of functions; and forming a symbol information table based on the symbol information corresponding to the functions in the plurality of functions.
[0010] Furthermore, after deduplicating the initial symbol information to obtain the target symbol information, the method also includes: obtaining historical symbol information received by the data center based on the announcement information released by the data center; deduplicating the target symbol information based on the historical symbol information to obtain processed target symbol information; sending the target symbol information to the data center includes: sending the processed target symbol information to the data center.
[0011] According to another aspect of an embodiment of the present application, a flame graph generation method is provided, comprising: receiving a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by the plurality of nodes sampling the execution process of a plurality of threads, and the sampling point information includes at least target address information corresponding to the plurality of threads at sampling moments; receiving target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes; and processing the plurality of sampling point information and the target symbol information to obtain a target flame graph.
[0012] Furthermore, processing the multiple sampling point information and the target symbol information to obtain a target flame graph includes: determining time proportion information of multiple functions in threads of the multiple threads based on the multiple sampling point information; and matching the time proportion information with the target symbol information to obtain the target flame graph.
[0013] Furthermore, after receiving target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes, the method further includes: composing target announcement information to be published based on the target symbol information; and publishing the target announcement information to inform the multiple nodes of the symbol information currently received by the data center end.
[0014] According to another aspect of an embodiment of the present application, a flame graph generation apparatus is provided, comprising: a first processing unit, configured to sample execution processes of multiple threads to obtain multiple sampling point information, wherein the sampling point information includes at least target address information corresponding to the multiple threads at sampling moments; a first sending unit, configured to send the multiple sampling point information to a data center; and a second sending unit, configured to send target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center. The data center processes the multiple sampling point information and the target symbol information to obtain a target flame graph.
[0015] Furthermore, the first processing unit includes: a first sampling module, configured to sample time information when the multiple threads are executed in the central processing unit to obtain the multiple sampling point information if the flame graph to be generated is a flame graph of the first type; and a second sampling module, configured to sample time information when the multiple threads are called out of and into the central processing unit to obtain the multiple sampling point information if the flame graph to be generated is a flame graph of the second type.
[0016] Furthermore, the processing unit includes: a determination module, used to determine, for a target node among the multiple nodes, a target thread of the multiple threads running on the target node, wherein the target node is any one of the multiple nodes; and a processing module, used to sample the execution process of the target thread to obtain the multiple sampling point information.
[0017] Furthermore, the second sending unit includes: a matching module, used to match the target address information based on a preset symbol information table to obtain the initial symbol information corresponding to the target address information; a processing module, used to deduplicate the initial symbol information to obtain the target symbol information; and a sending module, used to send the target symbol information to the data center end.
[0018] Furthermore, the apparatus further includes: a determination unit configured to determine, for a target node among the multiple nodes, multiple functions involved in the target node before sending target symbol information corresponding to the sampling point information among the multiple sampling point information to the data center, wherein the target node is any one of the multiple nodes; a transformation unit configured to perform a hash transformation on address information corresponding to the multiple functions to obtain symbol information corresponding to functions among the multiple functions; and a first generation unit configured to compose a symbol information table based on the symbol information corresponding to the functions among the multiple functions.
[0019] Furthermore, the device also includes: an acquisition unit, which is used to obtain historical symbol information received by the data center based on the announcement information released by the data center after deduplicating the initial symbol information to obtain the target symbol information; a second processing unit, which is used to deduplicate the target symbol information based on the historical symbol information to obtain processed target symbol information; and a second sending unit, which is also used to send the processed target symbol information to the data center.
[0020] According to another aspect of an embodiment of the present application, a flame graph generation apparatus is provided, comprising: a first receiving unit, configured to receive a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by sampling the execution processes of a plurality of threads, and the sampling point information includes at least target address information corresponding to the plurality of threads at sampling moments; a second receiving unit, configured to receive target symbol information corresponding to the plurality of sampling point information sent by the plurality of nodes; and a processing unit, configured to process the plurality of sampling point information and the target symbol information to obtain a target flame graph.
[0021] Furthermore, the processing unit includes: a determination module for determining time proportion information of multiple functions in the threads of the multiple threads based on the multiple sampling point information; a matching module for matching the time proportion information with the target symbol information to obtain the target flame graph.
[0022] Furthermore, the apparatus further includes: a second generating unit, configured to, after receiving target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes, compose target announcement information to be published based on the target symbol information; and a publishing unit, configured to publish the target announcement information to inform the plurality of nodes of the symbol information currently received by the data center end.
[0023] According to another aspect of an embodiment of the present invention, an electronic device is provided, including: a memory storing an executable program; and a processor for running the program, wherein any one of the above-mentioned flame graph generation methods is executed when the program is running.
[0024] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores a program, wherein when the program is running, the device where the storage medium is located is controlled to execute any of the above-mentioned flame graph generation methods.
[0025] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program or instructions, which implements any of the above flame graph generation methods when executed by a processor.
[0026] In an embodiment of the present application, the following steps are performed: sampling and processing the execution processes of multiple threads to obtain multiple sampling point information, wherein the sampling point information includes at least target address information corresponding to the multiple threads at the sampling time; sending the multiple sampling point information to a data center; and sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center. At the data center, the multiple sampling point information and the target symbol information are processed to obtain a target flame graph, thereby solving the technical problem of excessive resource usage on the node side when generating a flame graph through a single node.
[0027] In this solution, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes then directly transmit the sampled sampling point information to the data center. They also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information. After receiving the sampling point and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed locally on the data center, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0029] Figure 1 This is a hardware structure block diagram of a computer terminal provided according to the first embodiment of the present application;
[0030] Figure 2 This is a flowchart of a method for generating a flame graph according to the first embodiment of the present application;
[0031] Figure 3 This is a flowchart of a method for generating a flame graph according to the second embodiment of the present application;
[0032] Figure 4 This is a schematic diagram of a method for generating a flame graph according to the second embodiment of the present application;
[0033] Figure 5 is a schematic diagram of a flame graph generation device provided in accordance with the third embodiment of the present application;
[0034] Figure 6 Schematic diagram of a flame graph generation device according to the fourth embodiment of the present application;
[0035] Figure 7 This is a structural block diagram of an electronic device provided according to Example 5 of the present application. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0039] Example 1
[0040] According to an embodiment of the present application, a method for generating a flame graph is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a method for generating a flame graph is shown. Figure 1 As shown, the computer terminal (or mobile device) 10 may include a processor set 102 (the processor set 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, and the processor set 102 may include a processor set, Figure 1 102a, 102b, ..., 102n are used to illustrate), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0042] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." This data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be fully or partially integrated into any of the other components of the computer terminal 10 (or mobile device). As discussed in the embodiments of this application, this data processing circuitry functions as a processor control (e.g., selecting a variable resistor terminal path connected to an interface).
[0043] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the flame graph generation method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above-mentioned flame graph generation method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0044] Transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of computer terminal 10. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0045] The display may be a touch screen liquid crystal display that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0046] Under the above operating environment, this application provides Figure 2 The flame graph shown is generated. Figure 2 This is a flow chart of a method for generating a flame graph according to the first embodiment of the present application. The flame graph is applied to multiple nodes, and the method includes:
[0047] Step S201: Sampling is performed on the execution processes of multiple threads to obtain multiple sampling point information, wherein the sampling point information at least includes target address information corresponding to the multiple threads at the sampling time.
[0048] Optionally, in a distributed system, real-time monitoring and data capture of thread activity running on different nodes can be performed to evaluate and optimize system performance. Configure the sampling frequency on each of the multiple nodes. The sampling frequency determines the intensity of the sampling process, meaning that a node captures a sample point after a certain time interval or after a certain number of instructions are executed.
[0049] When sampling is triggered, multiple nodes sample the running thread and obtain the memory address of the instruction currently being executed by the thread, which is the target address information. Furthermore, information such as the thread ID and the thread's call stack can be recorded to provide a more comprehensive execution context. It should be noted that threads execute related tasks by calling multiple functions. When these functions are sampled at runtime, the information obtained is the address information corresponding to these functions.
[0050] Step S202: Send information of multiple sampling points to the data center.
[0051] Optionally, after obtaining the multiple sampling point information, the multiple sampling point information is sent to the data center through multiple nodes. In order to improve data transmission efficiency, the multiple nodes can perform local preprocessing on the captured sampling point information, including but not limited to data compression and encoding, to reduce the data volume during transmission and save network bandwidth resources.
[0052] During transmission, data encryption can be used to protect sensitive performance data and prevent it from being intercepted or tampered with. To ensure data integrity, network transmission strategies must account for potential delays and packet loss. Therefore, error checking codes can be added to the information at multiple sampling points.
[0053] In step S203 , target symbol information corresponding to the sampling point information in the plurality of sampling point information is sent to the data center end. In the data center end, the plurality of sampling point information and the target symbol information are processed to obtain a target flame graph.
[0054] Optionally, after collecting the sampling point information, the multiple nodes perform address symbol derivation, converting the target address information in the sampling point information into target symbol information. It should be noted that the target symbol information includes the function name corresponding to the address, allowing for subsequent flame graph generation based on the function name. After obtaining the target symbol information corresponding to the sampling point information, the multiple nodes transmit the target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center.
[0055] The data center generates a target flame graph based on the received information from multiple sampling points and target symbols. This graph allows users to intuitively understand system resource consumption, identify performance bottlenecks, and provide precise guidance for subsequent performance optimization.
[0056] In summary, by sampling the execution processes of multiple threads on multiple nodes, target address information corresponding to the threads at the sampling moments is obtained. The nodes directly transmit the sampled sampling point information to the data center. The nodes also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information to the data center. After receiving the sampling point information and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed on the data center side, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0057] To improve sampling accuracy, in the flame graph generation method provided in the first embodiment of the present application, sampling the execution processes of multiple threads to obtain multiple sampling point information includes: if the flame graph to be generated is a flame graph of the first type, sampling the time information when the multiple threads are executed in the central processing unit to obtain multiple sampling point information; if the flame graph to be generated is a flame graph of the second type, sampling the time information when the multiple threads are called out of the central processing unit and called into the central processing unit to obtain multiple sampling point information.
[0058] Optionally, sampling the execution processes of multiple threads using multiple nodes includes the following steps: first, determining different sampling strategies based on the type of flame graph to be generated. The flame graph type includes a first type and a second type, the first type being an oncpu flame graph and the second type being an offcpu flame graph.
[0059] If the target flame graph is a flame graph of the first type, time information of multiple threads when they are executed in the central processing unit is sampled through multiple nodes, that is, the threads are sampled when they are executed in the CPU. For example, multiple sampling point information is obtained by sampling cycle events of the central processing unit.
[0060] If the target flame graph is the second type, focus on thread scheduling events, specifically collecting information about when a thread is scheduled out of the CPU and when it is scheduled back into the CPU. For example, sample the process switch event finish_task_switch. The finish_task_switch event records the PID of the thread scheduled out of the CPU, the PID of the thread scheduled back into the CPU, as well as the timestamp and call stack of the event.
[0061] Dynamically adjusting the sampling strategy based on analysis requirements can not only provide a deep understanding of the execution details on the CPU, but also provide insight into the performance impact at the thread scheduling level, improving the flexibility and pertinence of flame graph generation.
[0062] To improve sampling accuracy, in the flame graph generation method provided in the first embodiment of the present application, sampling the execution process of multiple threads to obtain multiple sampling point information includes: for a target node among the multiple nodes, determining a target thread of the multiple threads running on the target node, wherein the target node is any one of the multiple nodes; and sampling the execution process of the target thread through the target node to obtain the multiple sampling point information.
[0063] Optionally, different threads may be run on different nodes according to different user requirements. Therefore, for any one of the multiple nodes (i.e., the target node mentioned above), a target thread running on the target node among the multiple threads is determined, and then, the execution process of the target thread is sampled through the target node to obtain multiple sampling point information.
[0064] Through the above steps, users can define target threads based on their needs, such as focusing on a specific functional module, a high-load task thread, or a thread with a specific performance bottleneck. This makes the sampling point information more relevant, and the generated flame graph can intuitively and accurately display the performance status and call stack information of the target thread, helping users quickly locate the core of the performance problem.
[0065] To improve the accuracy of determining symbol information, in the flame graph generation method provided in the first embodiment of the present application, before sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center, the method further includes: for a target node among the multiple nodes, determining multiple functions involved in the target node, wherein the target node is any one of the multiple nodes; performing a hash transformation on address information corresponding to the multiple functions to obtain symbol information corresponding to the functions among the multiple functions; and forming a symbol information table based on the symbol information corresponding to the functions among the multiple functions.
[0066] Optionally, before sending the target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center via multiple nodes, the following steps are performed to obtain a symbol information table for any one of the multiple nodes: First, all active functions on the target node are identified and determined. These functions are involved in the execution path of the target thread and are the basic units for generating flame graphs. This allows for targeted focus on functions closely related to performance analysis. Then, a hash transform is performed on the address information corresponding to the multiple functions. Finally, a symbol information table is constructed using the symbol information corresponding to the functions obtained from the hash transform, facilitating subsequent global symbol resolution and flame graph generation at the data center.
[0067] The address information is mapped to the symbol information through hash transformation to obtain the symbol information table, which helps to quickly match the target address information in the sampling point information and improve the efficiency of subsequent flame graph generation.
[0068] To improve the transmission efficiency of symbol information, in the flame graph generation method provided in the first embodiment of the present application, sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center includes: matching the target address information based on a preset symbol information table by the target node to obtain initial symbol information corresponding to the target address information; performing deduplication processing on the initial symbol information by the target node to obtain target symbol information; and sending the target symbol information to the data center by the target node.
[0069] Optionally, after collecting information from multiple sampling points, the target address information captured during the sampling process is matched against the previously constructed symbol information table, converting the target address information into initial symbol information. This initial conversion process greatly facilitates subsequent data analysis, translating the previously difficult-to-interpret address information into an intuitive function call stack, improving the readability and analytical value of the data.
[0070] Because multiple sampling points on the same node may frequently call the same function, this results in a large amount of duplicate symbol information being transmitted, occupying network bandwidth and increasing the processing burden on the data center. Therefore, the target node performs deduplication on the initial symbol information. This deduplication process filters out duplicate symbol information, significantly reducing both the amount of data transmitted and the amount of data redundancy required by the data center, thus optimizing the overall performance analysis process. Finally, the target symbol information is sent to the data center via the target node.
[0071] By performing deduplication processing before transmission, the amount of data is reduced, the bandwidth and time required for network transmission are reduced, and the data transmission efficiency is improved.
[0072] In order to further improve the transmission efficiency of symbol information, in the flame graph generation method provided in Example 1 of the present application, after deduplication processing is performed on the initial symbol information through the target node to obtain the target symbol information, the method also includes: obtaining historical symbol information received by the data center end based on the announcement information released by the target node based on the data center end; deduplication processing is performed on the target symbol information based on the historical symbol information through the target node to obtain processed target symbol information; sending the target symbol information to the data center end through the target node includes: sending the processed target symbol information to the data center end through the target node.
[0073] Optionally, to further optimize symbol information transmission efficiency, after the target node deduplicates the initial symbol information, it proactively obtains announcement information from the data center. The announcement information contains all historical symbol information received and processed by the data center. The target node then performs secondary deduplication on the locally generated target symbol information based on the symbol information in the announcement information. Finally, the processed target symbol information is sent to the data center.
[0074] The deduplication strategy based on historical data reduces the amount of data sent by the target node to the center, reduces network transmission delay, and improves the efficiency and performance of data transmission.
[0075] In the flame graph generation method provided in the first embodiment of the present application, the execution processes of multiple threads are sampled and processed to obtain multiple sampling point information, where the sampling point information at least includes: target address information corresponding to the multiple threads at the sampling time; the multiple sampling point information is sent to a data center; and target symbol information corresponding to the sampling point information in the multiple sampling point information is sent to the data center. At the data center, the multiple sampling point information and the target symbol information are processed to obtain a target flame graph, thereby solving the technical problem of excessive resource occupation on the node side when generating a flame graph through a single node.
[0076] In this solution, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes then directly transmit the sampled sampling point information to the data center. They also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information. After receiving the sampling point and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed locally on the data center, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0077] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0078] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0079] Example 2
[0080] According to an embodiment of the present application, a method for generating a flame graph is also provided. Figure 3 This is a flow chart of a method for generating a flame graph according to the second embodiment of the present application. The generation method is applied to a data center end, and the method includes: Figure 3 As shown, the method includes:
[0081] Step S301: receiving a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by sampling the execution process of a plurality of threads by the plurality of nodes, and the sampling point information at least includes target address information corresponding to the plurality of threads at sampling moments.
[0082] Optionally, multiple nodes sample running threads to obtain the memory address of the thread's currently executed instruction, i.e., the target address information. Furthermore, information such as the thread ID and call stack can be recorded to provide a more comprehensive execution context. It should be noted that threads execute related tasks by calling multiple functions. These functions are sampled at runtime, and the information obtained is the address information corresponding to these functions. After obtaining the multiple sampling point information, the multiple sampling point information is sent to the data center via multiple nodes. The multiple sampling point information sent by the multiple nodes is received.
[0083] Step S302: receiving target symbol information corresponding to the sampling point information in a plurality of sampling point information sent by a plurality of nodes.
[0084] Optionally, after collecting and obtaining multiple sampling point information, multiple nodes perform address symbol derivation, converting target address information in the sampling point information into target symbol information. It should be noted that the target symbol information includes the function name corresponding to the address, so that a flame graph can be subsequently generated based on the function name. After obtaining the target symbol information corresponding to the sampling point information, the multiple nodes transmit the target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center. The data center receives the target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes, and subsequently generates a target flame graph based on the received multiple sampling point information and target symbol information. Using the target flame graph, users can intuitively understand system resource consumption, identify performance bottlenecks, and provide precise guidance for subsequent performance optimization.
[0085] Step S303: Process the multiple sampling point information and target symbol information to obtain a target flame graph.
[0086] Optionally, when the data center receives the sampling point information and target symbol information from each node, it re-associates the target symbol information with the corresponding sampling point information to restore the call stack corresponding to the sampling point. Based on the number of sampling points, it calculates the execution time information of the functions in the call stack and generates the target flame graph based on the execution time information.
[0087] In summary, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes directly transmit the sampled sampling point information to the data center. The nodes also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information to the data center. After receiving the sampling point information and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since the symbol information and sampling point data are processed on the data center side, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0088] In order to improve the accuracy of the target flame graph, in the flame graph generation method provided in the second embodiment of the present application, multiple sampling point information and target symbol information are processed to obtain the target flame graph, including: determining time proportion information of multiple functions in multiple threads based on the multiple sampling point information; and matching the time proportion information with the target symbol information to obtain the target flame graph.
[0089] Optionally, after receiving the sampling point information and target symbol information sent by multiple nodes, the data center processes the sampling data and target symbol information to determine the proportion of execution time of each function in the thread, that is, the proportion of their total execution time. By recording the timestamp, execution address, and target symbol information in the sampling point information, the data center can accurately count the execution time of the function and then calculate the proportion of the function relative to the overall execution time of the system. The data center matches the calculated time proportion information with the existing target symbol information to obtain the final target flame graph. In the target flame graph, different function call links are represented as rectangular bars of different colors and widths. The width of the rectangular bar corresponds to the execution time proportion of the corresponding function, and its vertical position reflects the hierarchy and order of the function call. This graphical display method can intuitively reflect the function call path with the most serious resource consumption in the system, providing a clear direction for performance optimization.
[0090] To improve data transmission efficiency, in the flame graph generation method provided in the second embodiment of the present application, after receiving target symbol information corresponding to the sampling point information in multiple sampling point information sent by multiple nodes, the method further includes: composing target announcement information to be published based on the target symbol information; and publishing the target announcement information to inform the multiple nodes of the symbol information that has been received by the current data center end.
[0091] Optionally, after receiving target symbol information corresponding to the sampling point information in multiple sampling point information sent by multiple nodes, the data center will compose target announcement information to be published based on the received target symbol information. Then, the target announcement information will be published to inform the multiple nodes of the symbol information currently received by the data center. Before sending the symbol information to the data center, the multiple nodes will actively obtain announcement information from the data center. Based on the symbol information in the announcement information, the nodes will perform secondary deduplication processing on the locally generated target symbol information. Finally, the processed target symbol information is sent to the data center. This deduplication strategy based on historical data reduces the amount of data sent by the target node to the center, reduces network transmission latency, and improves the efficiency and performance of data transmission.
[0092] In an optional embodiment, the following may be used: Figure 4 The diagram shown here implements flame graph generation. Sampling is performed on the node side, and the sampled address information is directly pushed to the address library at the data center. The node side deduplicates the symbol data corresponding to the address and pushes it to the symbol library at the data center. Finally, the center combines the sampled address and symbol information to generate a flame graph.
[0093] By migrating address matching and flame graph calculation to the data center, the problems of high node-side symbol cache memory usage and high CPU usage of symbol derivation are eliminated.
[0094] In the flame graph generation method provided in the second embodiment of the present application, multiple sampling point information sent by multiple nodes is received, where the multiple sampling point information is obtained by sampling the execution process of multiple threads, and the sampling point information includes at least target address information corresponding to the multiple threads at the sampling time; target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes is received; and the multiple sampling point information and the target symbol information are processed to obtain a target flame graph. This solves the technical problem of excessive resource occupation on the node side when generating a flame graph using a single node.
[0095] In this solution, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes then directly transmit the sampled sampling point information to the data center. They also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information. After receiving the sampling point and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed locally on the data center, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0096] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0097] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0098] Example 3
[0099] According to an embodiment of the present application, a flame graph generation device for implementing the above flame graph generation method is also provided, such as Figure 5 As shown, the device includes: a first processing unit 501, a first sending unit 502 and a second sending unit 503.
[0100] The first processing unit 501 is configured to perform sampling processing on the execution processes of the multiple threads to obtain multiple sampling point information, wherein the sampling point information at least includes: target address information corresponding to the multiple threads at the sampling time;
[0101] A first sending unit 502 is configured to send information of multiple sampling points to a data center;
[0102] The second sending unit 503 is configured to send target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center end, wherein the plurality of sampling point information and the target symbol information are processed at the data center end to obtain a target flame graph.
[0103] In the flame graph generation device provided in the third embodiment of the present application, a first processing unit 501 samples the execution processes of multiple threads to obtain multiple sampling point information, where the sampling point information includes at least target address information corresponding to the multiple threads at the sampling time. A first sending unit 502 sends the multiple sampling point information to a data center end. A second sending unit 503 sends target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center end. At the data center end, the multiple sampling point information and the target symbol information are processed to obtain a target flame graph, thereby solving the technical problem of excessive resource occupation on the node side when generating a flame graph through a single node.
[0104] In this solution, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes then directly transmit the sampled sampling point information to the data center. They also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information. After receiving the sampling point and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed locally on the data center, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0105] Optionally, in the flame graph generation device provided in Example 3 of the present application, the first processing unit includes: a first sampling module, which is used to sample time information when multiple threads are executed in the central processing unit if the flame graph to be generated is a flame graph of the first type, and obtain multiple sampling point information; and a second sampling module, which is used to sample time information when multiple threads are called out of and into the central processing unit if the flame graph to be generated is a flame graph of the second type, and obtain multiple sampling point information.
[0106] Optionally, in the flame graph generation device provided in Example 3 of the present application, the processing unit includes: a determination module, used to determine, for a target node among multiple nodes, a target thread among multiple threads running on the target node, wherein the target node is any one of the multiple nodes; and a processing module, used to sample and process the execution process of the target thread through the target node to obtain multiple sampling point information.
[0107] Optionally, in the flame graph generation device provided in Example 3 of the present application, the second sending unit includes: a matching module, used to match the target address information based on a preset symbol information table through the target node to obtain initial symbol information corresponding to the target address information; a processing module, used to deduplicate the initial symbol information through the target node to obtain target symbol information; and a sending module, used to send the target symbol information to the data center end through the target node.
[0108] Optionally, in the flame graph generation device provided in the third embodiment of the present application, the device further includes: a determination unit, configured to determine, for a target node among the multiple nodes, multiple functions involved in the target node before sending the target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center end, wherein the target node is any one of the multiple nodes; a transformation unit, configured to perform a hash transformation on the address information corresponding to the multiple functions to obtain symbol information corresponding to the functions among the multiple functions; and a first generation unit, configured to compose a symbol information table based on the symbol information corresponding to the functions among the multiple functions.
[0109] Optionally, in the flame graph generation device provided in Example 3 of the present application, the device also includes: an acquisition unit, which is used to deduplicate the initial symbol information through the target node to obtain the target symbol information, and then obtain the historical symbol information received by the data center through the target node based on the announcement information published by the data center; a second processing unit, which is used to deduplicate the target symbol information based on the historical symbol information through the target node to obtain the processed target symbol information; and a second sending unit, which is also used to send the processed target symbol information to the data center through the target node.
[0110] It should be noted that the first processing unit 501, the first sending unit 502, and the second sending unit 503 described above correspond to steps S201 to S203 in Example 1. The examples and application scenarios implemented by the three units and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0111] It should be noted that the preferred implementation scheme involved in the above embodiments of this application is the same as the solution provided in Example 1, as well as the application scenario and implementation process, but is not limited to the solution provided in Example 1.
[0112] Example 4
[0113] According to an embodiment of the present application, a flame graph generation device for implementing the above flame graph generation method is also provided, such as Figure 6 As shown, the device includes: a first receiving unit 601, a second receiving unit 602 and a processing unit 603.
[0114] A first receiving unit 601 is configured to receive a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by sampling the execution process of a plurality of threads by the plurality of nodes, and the sampling point information at least includes target address information corresponding to the plurality of threads at sampling moments;
[0115] The second receiving unit 602 is configured to receive target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes;
[0116] The processing unit 603 is configured to process the plurality of sampling point information and the target symbol information to obtain a target flame graph.
[0117] In the flame graph generation device provided in the third embodiment of the present application, a first receiving unit 601 receives a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by sampling the execution process of a plurality of threads, and the sampling point information includes at least target address information corresponding to the plurality of threads at the sampling time. A second receiving unit 602 receives target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes. A processing unit 603 processes the plurality of sampling point information and the target symbol information to obtain a target flame graph, thereby solving the technical problem of excessive resource occupation on the node side when generating a flame graph through a single node.
[0118] In this solution, multiple nodes sample the execution of multiple threads, obtaining target address information corresponding to the threads at the sampling moment. The nodes then directly transmit the sampled sampling point information to the data center. They also transmit the target symbol information (i.e., the function name corresponding to the address) corresponding to the sampling point information. After receiving the sampling point and target symbol information from each node, the data center generates a target flame graph based on these information. By transmitting these sampling point and target symbol information to the data center, resource-intensive tasks are migrated from performance-sensitive nodes to the data center, which boasts greater computing power and storage capacity. This avoids excessive resource usage on the node side due to data processing. Since symbol information and sampling point data processing are performed locally on the data center, the data center's powerful computing power can be leveraged to improve data processing efficiency and accuracy, thereby optimizing the performance analysis process, reducing node-side resource usage, and accelerating problem location.
[0119] Optionally, in the flame graph generation device provided in Example 4 of the present application, the processing unit includes: a determination module for determining time proportion information of multiple functions in multiple threads based on multiple sampling point information; and a matching module for matching the time proportion information and target symbol information to obtain a target flame graph.
[0120] Optionally, in the flame graph generation device provided in Example 4 of the present application, the device further includes: a second generation unit, configured to, after receiving target symbol information corresponding to the sampling point information in multiple sampling point information sent by multiple nodes, compose target announcement information to be published based on the target symbol information; and a publishing unit, configured to publish the target announcement information to inform the multiple nodes of the symbol information received by the current data center end.
[0121] It should be noted that the first receiving unit 601, the second receiving unit 602, and the processing unit 603 described above correspond to steps S301 to S303 in the second embodiment. The examples and application scenarios implemented by the three units and the corresponding steps are the same, but are not limited to the contents disclosed in the second embodiment. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in the first embodiment.
[0122] It should be noted that the preferred implementation scheme involved in the above embodiments of this application is the same as the scheme provided in Example 2, as well as the application scenario and implementation process, but is not limited to the scheme provided in Example 2.
[0123] Example 5
[0124] The embodiment of the present application may provide an electronic device, which may be any electronic device in a group of electronic device terminals. Optionally, in this embodiment, the electronic device may also be replaced by a terminal device such as a mobile terminal.
[0125] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0126] In this embodiment, the electronic device may execute program code for the following steps in the flame graph generation method: sampling the execution processes of multiple threads to obtain multiple sampling point information, where the sampling point information includes at least target address information corresponding to the multiple threads at the sampling moments; sending the multiple sampling point information to a data center; and sending target symbol information corresponding to the multiple sampling point information to the data center, where the multiple sampling point information and the target symbol information are processed at the data center to obtain a target flame graph.
[0127] The electronic device can execute the program code of the following steps in the flame graph generation method: sampling the execution process of multiple threads to obtain multiple sampling point information includes: if the flame graph to be generated is a first type of flame graph, sampling the time information when the multiple threads are executed in the central processing unit to obtain multiple sampling point information; if the flame graph to be generated is a second type of flame graph, sampling the time information when the multiple threads are called out of the central processing unit and called into the central processing unit to obtain multiple sampling point information.
[0128] The electronic device can execute the program code of the following steps in the flame graph generation method: sampling the execution process of multiple threads to obtain multiple sampling point information, including: for a target node among the multiple nodes, determining a target thread of the multiple threads running on the target node, wherein the target node is any one of the multiple nodes; sampling the execution process of the target thread through the target node to obtain multiple sampling point information.
[0129] The electronic device can execute the program code of the following steps in the flame graph generation method: before sending the target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center, the method further includes: for a target node among the multiple nodes, determining multiple functions involved in the target node, wherein the target node is any one of the multiple nodes; performing a hash transformation on the address information corresponding to the multiple functions to obtain symbol information corresponding to the functions among the multiple functions; and forming a symbol information table based on the symbol information corresponding to the functions among the multiple functions.
[0130] The electronic device can execute the program code of the following steps in the flame graph generation method: sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center end includes: matching the target address information based on a preset symbol information table through the target node to obtain initial symbol information corresponding to the target address information; deduplicating the initial symbol information through the target node to obtain target symbol information; and sending the target symbol information to the data center end through the target node.
[0131] The above-mentioned electronic device can execute the program code of the following steps in the flame graph generation method: after deduplicating the initial symbol information through the target node to obtain the target symbol information, the method also includes: obtaining the historical symbol information received by the data center end based on the announcement information released by the target node based on the data center end; deduplicating the target symbol information based on the historical symbol information through the target node to obtain the processed target symbol information; sending the target symbol information to the data center end through the target node includes: sending the processed target symbol information to the data center end through the target node.
[0132] The electronic device may execute program code for the following steps in the flame graph generation method: receiving multiple sampling point information sent by multiple nodes, wherein the multiple sampling point information is obtained by sampling the execution process of multiple threads by the multiple nodes, and the sampling point information includes at least target address information corresponding to the multiple threads at the sampling time; receiving target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes; and processing the multiple sampling point information and the target symbol information to obtain a target flame graph.
[0133] The electronic device can execute the program code of the following steps in the flame graph generation method: processing multiple sampling point information and target symbol information to obtain a target flame graph includes: determining time proportion information of multiple functions in multiple threads based on the multiple sampling point information; matching the time proportion information with the target symbol information to obtain the target flame graph.
[0134] The electronic device can execute the program code of the following steps in the flame graph generation method: after receiving target symbol information corresponding to the sampling point information in multiple sampling point information sent by multiple nodes, the method further includes: composing target announcement information to be published based on the target symbol information; and publishing the target announcement information to inform the multiple nodes of the symbol information received by the current data center end.
[0135] Optionally, Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device 70 may include: one or more ( Figure 7(only one is shown) processor 702, memory 704. The electronic device 70 may further include a memory controller to control and manage the memory 704; the electronic device 70 may further include a peripheral interface to connect to a radio frequency module, an audio module, a display screen, etc.
[0136] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the flame graph generation method and device in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the flame graph generation method described above. The memory may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories may be connected to the electronic device 70 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0137] The processor may call information and an application stored in the memory through a transmission device to execute the following steps: sampling and processing the execution processes of multiple threads to obtain multiple sampling point information, wherein the sampling point information at least includes: target address information corresponding to the multiple threads at the sampling time; sending the multiple sampling point information to a data center end; and sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center end. At the data center end, the multiple sampling point information and the target symbol information are processed to obtain a target flame graph.
[0138] Optionally, the processor may further execute program code of the following steps: sampling the execution process of multiple threads to obtain multiple sampling point information, including: if the flame graph to be generated is a flame graph of the first type, sampling the time information when the multiple threads are executed in the central processing unit to obtain multiple sampling point information; if the flame graph to be generated is a flame graph of the second type, sampling the time information when the multiple threads are called out of the central processing unit and called into the central processing unit to obtain multiple sampling point information.
[0139] Optionally, the processor may further execute program code of the following steps: sampling the execution process of multiple threads to obtain multiple sampling point information, including: determining, for a target node among the multiple nodes, a target thread of the multiple threads running on the target node, wherein the target node is any one of the multiple nodes; and sampling the execution process of the target thread through the target node to obtain multiple sampling point information.
[0140] Optionally, the processor may further execute program code of the following steps: before sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center, the method further includes: for a target node among the multiple nodes, determining multiple functions involved in the target node, wherein the target node is any one of the multiple nodes; performing a hash transformation on address information corresponding to the multiple functions to obtain symbol information corresponding to functions among the multiple functions; and forming a symbol information table based on the symbol information corresponding to the functions among the multiple functions.
[0141] Optionally, the processor may further execute program code of the following steps: sending target symbol information corresponding to the sampling point information in the multiple sampling point information to the data center includes: matching the target address information based on a preset symbol information table by the target node to obtain initial symbol information corresponding to the target address information; performing deduplication processing on the initial symbol information by the target node to obtain target symbol information; and sending the target symbol information to the data center by the target node.
[0142] Optionally, the above-mentioned processor can also execute the program code of the following steps: after deduplicating the initial symbol information through the target node to obtain the target symbol information, the method also includes: obtaining the historical symbol information received by the data center end based on the announcement information released by the target node based on the data center end; deduplicating the target symbol information based on the historical symbol information through the target node to obtain the processed target symbol information; sending the target symbol information to the data center end through the target node includes: sending the processed target symbol information to the data center end through the target node.
[0143] Optionally, the processor may further execute program code for the following steps: receiving multiple sampling point information sent by multiple nodes, where the multiple sampling point information is obtained by sampling the execution process of multiple threads by the multiple nodes, and the sampling point information includes at least target address information corresponding to the multiple threads at the sampling time; receiving target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes; and processing the multiple sampling point information and the target symbol information to obtain a target flame graph.
[0144] Optionally, the processor may further execute program code of the following steps: processing multiple sampling point information and target symbol information to obtain a target flame graph, including: determining time proportion information of multiple functions in multiple threads based on the multiple sampling point information; and matching the time proportion information with the target symbol information to obtain a target flame graph.
[0145] Optionally, the processor may further execute program code for the following steps: after receiving target symbol information corresponding to the sampling point information in multiple sampling point information sent by multiple nodes, the method further includes: composing target announcement information to be published based on the target symbol information; and publishing the target announcement information to inform the multiple nodes of the symbol information received by the current data center end.
[0146] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only, and the electronic device 70 may also be a terminal device such as a smart phone, a tablet computer, a PDA, a mobile Internet device (MID), or a PAD. Figure 7 It does not limit the structure of the above electronic device. For example, the electronic device 70 may also include Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 7 Different configurations shown.
[0147] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0148] Example 6
[0149] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product can be used to store the program code executed by the flame graph generation method provided in the first embodiment.
[0150] Optionally, in this embodiment, the computer program product may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0151] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0152] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0153] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0154] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0155] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program code.
[0157] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for generating a flame graph, characterized in that: The generation method is applied to multiple nodes, including: Sampling the execution processes of the multiple threads to obtain a plurality of sampling point information, wherein the sampling point information at least includes: target address information corresponding to the multiple threads at the sampling moments; Sending the plurality of sampling point information to a data center end; sending target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center end, wherein, at the data center end, processing the plurality of sampling point information and the target symbol information to obtain a target flame graph; When the data center receives the sampling point information and target symbol information sent by the multiple nodes, the target symbol information is re-associated with the corresponding sampling point information, and the call stack corresponding to the sampling point is restored to obtain the target flame graph; After receiving target symbol information corresponding to sampling point information in multiple sampling point information sent by multiple nodes, the data center publishes target announcement information based on the received target symbol information to inform the multiple nodes of the symbol information currently received by the data center. The multiple nodes obtain historical symbol information received by the data center based on the announcement information published by the data center; deduplicate the target symbol information based on the historical symbol information to obtain processed target symbol information, and send the processed target symbol information to the data center.
2. The method according to claim 1, characterized in that The execution process of multiple threads is sampled and processed to obtain multiple sampling point information including: If the flame graph to be generated is a flame graph of the first type, sampling time information of the multiple threads when they are executed in the central processing unit to obtain the multiple sampling point information; If the flame graph to be generated is a flame graph of the second type, time information when the multiple threads are called out of and into the central processor is sampled to obtain the multiple sampling point information.
3. The method according to claim 1, characterized in that The execution process of multiple threads is sampled and processed to obtain multiple sampling point information including: For a target node among the multiple nodes, determining a target thread of the multiple threads running on the target node, wherein the target node is any one of the multiple nodes; Sampling is performed on the execution process of the target thread to obtain the plurality of sampling point information.
4. The method according to claim 1, wherein The sending of target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center includes: Matching the target address information based on a preset symbol information table to obtain initial symbol information corresponding to the target address information; Performing deduplication processing on the initial symbol information to obtain the target symbol information; The target symbol information is sent to the data center end.
5. The method according to claim 4, characterized in that Before sending target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center, the method further includes: For a target node among the multiple nodes, determining multiple functions involved in the target node, wherein the target node is any one of the multiple nodes; Performing hash transformation on address information corresponding to the multiple functions to obtain symbol information corresponding to functions in the multiple functions; A symbol information table is formed according to the symbol information corresponding to the functions in the plurality of functions.
6. A method for generating a flame graph, characterized in that: The generation method is applied to a data center, and includes: receiving a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by sampling the execution process of a plurality of threads by the plurality of nodes, and the sampling point information at least includes target address information corresponding to the plurality of threads at sampling moments; receiving target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes; Processing the plurality of sampling point information and the target symbol information to obtain a target flame graph; When the data center receives the sampling point information and target symbol information sent by the multiple nodes, the target symbol information is re-associated with the corresponding sampling point information, and the call stack corresponding to the sampling point is restored to obtain the target flame graph; After receiving target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes, the method further includes: forming target announcement information to be published based on the target symbol information; publishing the target announcement information to inform the plurality of nodes of the symbol information currently received by the data center; the plurality of nodes obtaining historical symbol information received by the data center based on the announcement information published by the data center; performing deduplication processing on the target symbol information based on the historical symbol information to obtain processed target symbol information, and sending the processed target symbol information to the data center.
7. The method according to claim 6, characterized in that Processing the plurality of sampling point information and the target symbol information to obtain a target flame graph includes: Determining time proportion information of multiple functions in threads of the multiple threads based on the multiple sampling point information; The time proportion information and the target symbol information are matched to obtain the target flame graph.
8. A flame graph generation device, characterized in that: include: a first processing unit, configured to sample the execution processes of the plurality of threads to obtain a plurality of sampling point information, wherein the sampling point information at least includes target address information corresponding to the plurality of threads at sampling moments; A first sending unit, configured to send the plurality of sampling point information to a data center end; a second sending unit, configured to send target symbol information corresponding to the sampling point information in the plurality of sampling point information to the data center end, wherein the plurality of sampling point information and the target symbol information are processed at the data center end to obtain a target flame graph; When the data center receives sampling point information and target symbol information sent by multiple nodes, the target symbol information is re-associated with the corresponding sampling point information, and the call stack corresponding to the sampling point is restored to obtain the target flame graph. The device is further configured to, after receiving the target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes, publish target announcement information based on the received target symbol information to inform the multiple nodes of the symbol information currently received by the data center. The multiple nodes obtain historical symbol information received by the data center based on the announcement information published by the data center. The target symbol information is deduplicated based on the historical symbol information to obtain processed target symbol information, and the processed target symbol information is sent to the data center.
9. A flame graph generation device, characterized in that: include: a first receiving unit, configured to receive a plurality of sampling point information sent by a plurality of nodes, wherein the plurality of sampling point information is obtained by the plurality of nodes sampling the execution process of a plurality of threads, and the sampling point information at least includes target address information corresponding to the plurality of threads at sampling moments; a second receiving unit, configured to receive target symbol information corresponding to the sampling point information in the plurality of sampling point information sent by the plurality of nodes; a processing unit, configured to process the plurality of sampling point information and the target symbol information to obtain a target flame graph; When the data center receives the sampling point information and target symbol information sent by the multiple nodes, the target symbol information is re-associated with the corresponding sampling point information, and the call stack corresponding to the sampling point is restored to obtain the target flame graph. The device is further configured to, after receiving the target symbol information corresponding to the sampling point information in the multiple sampling point information sent by the multiple nodes, publish target announcement information based on the received target symbol information to inform the multiple nodes of the symbol information currently received by the data center. The multiple nodes obtain historical symbol information received by the data center based on the announcement information published by the data center. The target symbol information is deduplicated based on the historical symbol information to obtain processed target symbol information, and the processed target symbol information is sent to the data center.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the flame graph generation method according to any one of claims 1 to 7.
11. An electronic device, characterized in that: include: a memory storing an executable program; A processor, configured to run the program, wherein the program, when running, executes the flame graph generation method according to any one of claims 1 to 7.
12. A computer program product, characterized in that The method comprises a computer program or an instruction, which, when executed by a processor, implements the method for generating a flame graph according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method, device and equipment
CN110928750A
Jamming log information collection method and device, equipment and storage medium
CN112860469A