Performance monitoring method and device of application program, computer equipment, readable storage medium and program product
By using perf in applications developed by hybrid languages to obtain performance data and generating SVG flame maps based on symbol table mapping, the problem that the existing technology cannot fully monitor hybrid language applications is solved, achieving convenient and intuitive performance monitoring effects.
Patent Information
- Application Number
- CN202411626392.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-18
AI Technical Summary
The existing technology cannot fully and effectively monitor the performance of applications developed in mixed languages. Traditional closed source tools are costly, while open source tools only support single language development.
通过确定应用程序的环境配置,调用perf获取性能数据,生成程序堆栈信息,并基于目标编程语言的符号表对堆栈信息进行映射,生成SVG火焰图,以展示不同编程语言的函数性能。
It realizes performance monitoring of applications developed in mixed languages, reduces the number of work times, improves the efficiency of performance data crawling, avoids data origin alignment problems, and realizes visualization of performance analysis.
Smart Images

Figure CN119473820A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, readable storage medium and program product for monitoring the performance of an application program. Background Art
[0002] With the development of computer technology, various applications are widely used, and most complex applications are developed using mixed languages. Whether it is Android (Android is a free and open source mobile operating system based on the Linux kernel (excluding GNU components)) or server side. The learning difficulty, performance and related dependency libraries of development languages are different, which makes mixed language development programs the choice of most people.
[0003] In traditional technology, in order to avoid bottlenecks in program performance, it is usually necessary to perform performance monitoring tests on the program. Generally, the main performance monitoring can be achieved through open source monitoring tools or closed source monitoring tools. However, current closed source monitoring tools need to be purchased before they can be used, which leads to high usage costs; and open source monitoring tools only support applications developed in a single language, which makes it impossible to perform comprehensive and effective performance monitoring on applications developed in mixed languages. Summary of the invention
[0004] Based on this, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium and computer program product that can comprehensively and effectively monitor the performance of applications developed in mixed languages in order to address the above technical problems.
[0005] In a first aspect, the present application provides a performance monitoring method for an application program, wherein the application program is implemented based on at least two programming languages, and the method comprises:
[0006] Determining a corresponding environment configuration based on at least two target programming languages of the application;
[0007] Under the environment configuration, calling perf according to the process identifier of the application to obtain performance data of the application;
[0008] Generate corresponding program stack information according to the performance data;
[0009] The program stack information is mapped based on a symbol table corresponding to each target programming language of the application to obtain a corresponding SVG flame graph, wherein the symbol table includes function information of the application based on the corresponding target programming language.
[0010] In one of the embodiments, calling perf according to the process ID of the application to obtain the performance data of the application includes: when the application is executed, obtaining the process ID assigned to the application by the operating system; and performing performance monitoring on the application based on the process ID to obtain the performance data of the application.
[0011] In one of the embodiments, before mapping the program stack information based on the symbol table of each target programming language corresponding to the application, the method further includes: when the application is running in DEBUG mode, obtaining and storing the symbol table of each target programming language corresponding to the application.
[0012] In one of the embodiments, the program stack information is mapped based on the symbol table of each target programming language corresponding to the application to obtain the corresponding SVG flame graph, including: according to the symbol table of each target programming language corresponding to the application, the function address in the program stack information is mapped to the corresponding function information to generate the corresponding SVG flame graph.
[0013] In one of the embodiments, after calling perf according to the process identifier of the application to obtain the performance data of the application, the method further includes: creating a timechart instance, and based on the timechart instance, mapping the performance data according to the symbol table of each target programming language corresponding to the application to generate a timechart diagram of the application.
[0014] In one of the embodiments, determining the corresponding environment configuration based on at least two target programming languages of the application includes: installing perf software through the yum command under sudo authority to determine the perf environment configuration; based on at least two target programming languages of the application, adding the installation package corresponding to the target programming language to the system's environment variables to determine the environment configuration of the target programming language.
[0015] In a second aspect, the present application provides a performance monitoring device for an application program, wherein the application program is implemented based on at least two programming languages, and the device comprises:
[0016] An environment configuration module, configured to determine a corresponding environment configuration based on at least two target programming languages of the application;
[0017] A data acquisition module, used to call perf according to the process identifier of the application program under the environment configuration to acquire the performance data of the application program;
[0018] A generating module, used for generating corresponding program stack information according to the performance data;
[0019] A mapping module is used to map the program stack information based on a symbol table of each target programming language corresponding to the application to obtain a corresponding SVG flame graph, wherein the symbol table includes function information of the application based on the corresponding target programming language.
[0020] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0021] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0022] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0023] The above-mentioned application performance monitoring method, device, computer equipment, computer-readable storage medium and computer program product determine the corresponding environment configuration based on at least two target programming languages of the application, call perf according to the process identifier of the application to obtain the performance data of the application under the environment configuration, generate corresponding program stack information according to the performance data, map the program stack information based on the symbol table of each target programming language corresponding to the application, and obtain the corresponding SVG flame graph. It realizes performance monitoring of applications developed in mixed languages based on the basic functions of perf, captures the performance data of each function at one time, and finally displays the function performance of different programming languages in the flame graph through symbol table mapping, so as to solve the problem that traditional technology cannot comprehensively and effectively monitor the performance of applications developed in mixed languages, making the performance monitoring of applications developed in mixed languages more convenient and intuitive. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 This is a performance capture effect diagram in an embodiment;
[0026] Figure 2A schematic diagram of a flow chart of a method for monitoring performance of an application program in one embodiment;
[0027] Figure 3 A schematic diagram of a flow chart of a method for monitoring application performance in another embodiment;
[0028] Figure 4 This is a performance capture effect diagram in another embodiment;
[0029] Figure 5 is a structural block diagram of a performance monitoring device for an application program in one embodiment;
[0030] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0032] Traditional closed-source monitoring tools require payment before use, resulting in high usage costs; and open-source monitoring tools only support applications developed in a single language, making it impossible to conduct comprehensive and effective performance monitoring of applications developed in mixed languages.
[0033] For example, traditional closed-source performance monitoring tools mainly use vtune (Intel developed performance monitoring software based on its own x86 architecture, which can be adapted to Linux servers, Linux desktops, and Windows environments). It can intuitively view the hot functions of the program, can be graphical and interactive, can customize different monitoring rules for CPUs, and supports multiple languages. However, since it is closed-source, you need to purchase a license to use it. Jprofiler is also an excellent closed-source commercial software. Its advantage is that it is powerful, but it needs to be purchased for a fee and only supports a single Java language.
[0034] Among the open source tools, Arthas (an open source Java diagnostic tool) is a good tool for performance monitoring of Java programs. It has the advantages of being open source, compact, and flexible; however, it only supports a single language, usually only Java. The gprof tool is a performance analysis tool that comes with the gcc compiler. It is simple and convenient, and you can enable performance monitoring through parameters when compiling the program. However, it only supports programs developed in the c / c++ language.
[0035] In addition, when the above performance monitoring tools are used in a Java / C++ mixed language program, if you want to monitor the performance of the Java part, you need to use Java-related monitoring tools; if you want to monitor the performance of the C++ part, you can either use C++ to implement the entry call of the library function (that is, construct a main function to call the relevant library); or run the entire program and then obtain the process ID to capture the performance. However, the data captured by this method cannot show the function performance of the Java-side program, such as Figure 1 As shown in the performance capture effect diagram, there is a hotspot function of unknown symbol "pref-xxx.map". As a result, it is impossible to conduct comprehensive and effective performance monitoring of applications developed in mixed languages.
[0036] Based on this, an embodiment of the present application provides a performance monitoring method for an application program, which is used for performance monitoring of a mixed language application program implemented in at least two programming languages. Figure 2 As shown, in this embodiment, the method includes the following steps:
[0037] Step 202: Determine a corresponding environment configuration based on at least two target programming languages of the application program.
[0038] The programming language can be simply understood as a language that can be recognized by both computers and humans. The at least two target programming languages of the application refer to the specific programming languages used to develop the application, such as at least two of C, C++, Java, Python, etc.
[0039] Environment configuration refers to the need to set up and install the operating system, development tools, dependent libraries, etc. when developing software or running a specific application to ensure that the program can run normally in a specific environment. In this embodiment, environment configuration is the environment required for performance monitoring of mixed-language applications.
[0040] Specifically, in this embodiment, when it is necessary to perform performance monitoring on a mixed-language application, the environment configuration of the computer device can first be determined based on at least two target programming languages of the application, and subsequent processing can be performed under the environment configuration to achieve performance monitoring of the mixed-language application.
[0041] Step 204: under the environment configuration, call perf according to the process identifier of the application to obtain the performance data of the application.
[0042] Among them, perf is a performance analysis tool set provided by the Linux system, which can perform hot spot searches at the function level and instruction level. It contains a variety of sub-tools that can monitor a variety of hardware and software performance indicators, including CPU, memory, IO, etc. Through perf, applications can use PMU (Power Management Unit), tracepoint (a mechanism provided by the Linux kernel to observe kernel events) and special counters in the kernel to perform performance statistics. It can not only analyze the performance problems of specified applications (per thread), but also be used to analyze kernel performance problems. Of course, it can also analyze application code and kernel at the same time, so as to fully understand the performance bottlenecks in the application. Perf is based on the principle of event sampling and performance events. It supports performance analysis of processor-related performance indicators and operating system-related performance indicators. It is often used to find performance bottlenecks and locate hot code.
[0043] The process ID of an application is a unique process ID uniformly assigned by the operating system when the application is executed. That is, different applications have different process IDs assigned by the operating system. Therefore, an application can be uniquely identified based on the process ID. Performance data refers to the hardware and software performance indicators monitored by perf during the running of the application, including data such as CPU, memory, IO, and function-level execution speed.
[0044] In this embodiment, through the environment configuration determined by the above steps, when the application is run under the environment configuration, the computer device can call perf according to the process identifier of the application to obtain the performance data of the application.
[0045] Step 206: Generate corresponding program stack information according to the performance data.
[0046] Program stack information refers to the memory area information maintained by the system for each thread when the program is running, including function call relationships, local variables, parameters and other information. Stack information is very important for debugging and performance analysis, and can help developers understand the execution flow and memory usage of the program. Among them, the stack is a first-in-last-out (LIFO) data structure, mainly used to store local variables, function parameters, etc. When the program is running, each time a function is called, the system will create a new stack frame on the stack, which contains the function's parameters, local variables, return address and other information. This information is usually expressed in machine language (that is, the program language or instruction code directly recognized by the machine), resulting in poor readability.
[0047] Step 208 : Map the program stack information based on the symbol table of each target programming language corresponding to the application program to obtain a corresponding SVG flame graph.
[0048] Among them, the symbol table is a data structure used in a language translator (such as a compiler and an interpreter) in computer science. In the symbol table, each identifier in the program source code is bound to its declaration or usage information, such as its data type, scope, and memory address. The symbol table is used to define variables and process identifiers belonging to the application's own process, also known as local quantities. Specifically, the symbol table in this embodiment corresponds to the target programming language of the application, and includes function information (i.e., local quantities) of the target programming language corresponding to the application. It can be understood that since the application is implemented based on at least two target programming languages, each target programming language for the application has a symbol table corresponding to the target programming language. For example, if the target programming language of the application includes Java and C++, the symbol table includes a symbol table corresponding to Java and a symbol table corresponding to C++.
[0049] The flame graph is a visual program performance analysis tool that helps developers track the function calls of the program and the time taken by the calls, and displays this information with its unique visual effects and global perspective. SVG (Scalable Vector Graphics) is a two-dimensional vector graphics standard based on the XML format. The flame graph is displayed in SVG format, and users can open it through a browser and interactively analyze the content of each block to quickly locate performance problems.
[0050] In addition, since each identifier in the program source code is bound to its declaration or usage information in the symbol table, such as its data type, scope, and memory address, the program stack information can be mapped based on the symbol table of each target programming language corresponding to the application, that is, the function address in the program stack information is mapped to the function information of the corresponding target programming language to obtain the corresponding SVG flame graph.
[0051] In the above-mentioned performance monitoring method of the application, the corresponding environment configuration is determined based on at least two target programming languages of the application. Under the environment configuration, perf is called according to the process ID of the application to obtain the performance data of the application, and the corresponding program stack information is generated according to the performance data. The program stack information is mapped based on the symbol table of each target programming language corresponding to the application to obtain the corresponding SVG flame graph. It realizes performance monitoring of applications developed in mixed languages based on the basic functions of perf, captures the performance data of each function at one time, and finally displays the function performance of different programming languages in the flame graph through symbol table mapping, so as to solve the problem that traditional technology cannot comprehensively and effectively monitor the performance of applications developed in mixed languages, making the performance monitoring of applications developed in mixed languages more convenient and intuitive.
[0052] In an exemplary embodiment, Figure 3 As shown, the performance monitoring method of the above application is further described below, which is completed by writing a shell script (a scripting language used to automatically execute a series of commands and tasks). Specifically, the following steps may be included:
[0053] Step 302, determine the environment configuration.
[0054] In this embodiment, the corresponding environment configuration can be determined based on at least two target programming languages of the application. Specifically, the perf software can be installed through the yum command under the sudo (linux system management instruction, a tool that allows system administrators to allow ordinary users to execute some or all root commands) permission to determine the perf environment configuration, and based on at least two target programming languages of the application, the installation package of the corresponding target programming language is added to the system environment variable to determine the environment configuration of the target programming language.
[0055] In this embodiment, taking the example of an application program implemented by mixed programming of Java and C++, the application program is a program written in two languages, Java and C++. Generally, Java calls a library or code implemented in C++ through JNI (Java Native Interface, which allows Java code to interact with code written in other languages), or C++ calls a library implemented in Java through JNI. Then the target programming languages of the application program include Java and C++.
[0056] The environment configuration includes perf environment configuration and Java environment configuration. Specifically, the perf software can be installed through the yum command under sudo authority, and the perf tool installation method under the typical Linux system can be adopted to implement the perf environment configuration. The installation of the Java environment can adopt the typical Java environment configuration and add the Java package to the system environment variables.
[0057] Step 304: Get the process ID of the application.
[0058] When an application is executed, the operating system will assign a process ID to the application. In this embodiment, the process ID of the application is obtained through a Linux system command, and the ID is used as an input of perf to monitor and obtain performance data of the application.
[0059] Step 306: Performance data recording.
[0060] Specifically, perf is called based on the process identifier to perform performance monitoring on the application to obtain performance data of the application.
[0061] Step 308: Obtain a symbol table corresponding to each target programming language of the application.
[0062] Usually, during the compilation process, the program can be in DEBUG mode (a program debugging mode for programmers, which allows developers to set breakpoints, single-step code execution, view variable values, etc. when the program is running, so as to find and solve errors in the program) or RELEASE mode (i.e., release mode, which is mainly used to generate the final executable file, suitable for product release and end-user use. Compared with the DEBUG mode, the RELEASE mode performs a series of optimizations during the compilation process to improve the execution efficiency of the program and reduce resource usage). The difference between the two modes is that the DEBUG mode has a symbol table and a monitoring injection point, and the execution speed will be slightly slower; the RELEASE mode will delete the monitoring injection point and the symbol table through optimization to increase the speed. When performing program performance monitoring, the symbol table is necessary. Therefore, in this embodiment, when the application is running in the DEBUG mode, the symbol table of each target programming language corresponding to the application can be obtained and stored, so that the symbol table can be used in the RELEASE mode.
[0063] Then, the Java symbol table is collected at the end of the perf execution. It is understandable that if the target programming language of the application is another language, the script for collecting the symbol table can be replaced with the corresponding language.
[0064] Step 310: Generate corresponding program stack information according to the performance data.
[0065] Generate program stack information based on the performance data recorded in the above steps. Usually the purpose of performance monitoring is to monitor the execution speed at the function level, and the program stack information only displays the function address (similar to 0x89457800), which is not very readable.
[0066] Step 312, mapping the program stack information based on the symbol table.
[0067] Specifically, according to the symbol table of each target programming language corresponding to the application, the function address in the program stack information is mapped to the corresponding function information. In this embodiment, the storage path of the symbol file can be specified when running the perf command, or the symbol table location can be set directly. For example, the directory where the symbol file is located can be specified by setting the PERF_BUILDID_DIR (perf command for setting the symbol table path) environment variable or using the -symfs (command for specifying the system symbol table path) option. This ensures that perf can correctly reference the symbol table generated during compilation when analyzing performance data to convert the stack trace address in the program stack information into specific function call information.
[0068] Step 314: Generate a corresponding SVG flame graph.
[0069] Specifically, based on the information mapped in the above steps, a corresponding SVG flame graph can be generated, such as Figure 4 As shown in the figure, all hot functions in the figure correspond to the symbol table, and also include the calling relationship between functions, so that the performance data of all functions of the application can be clearly seen in the flame chart.
[0070] The performance monitoring method of the application in this embodiment can effectively monitor the performance of the application implemented in the mixed language, thereby reducing the number of work, and can achieve the work that needs to be completed twice or more times in the traditional technology with only one operation. It achieves the effect of closed-source software by writing a scripting tool, can trigger the crawling behavior through keywords, realizes automatic performance data acquisition and flame graph generation, can effectively improve the efficiency of performance data crawling, avoids the origin alignment problem of crawled data, and realizes the visualization of application performance analysis, making the performance analysis of the application more intuitive.
[0071] In one scenario, you can also create a timechart instance by modifying the script, and based on the timechart instance, map the performance data according to the symbol table of each target programming language corresponding to the application, thereby generating a timechart diagram of the application (a chart library specifically used for large-scale time series data) to more intuitively display the overall process from the startup of the application to the end of performance data capture.
[0072] In one scenario, you can also update the script tool to perform more comprehensive statistics on CPU, IO and other indicators, so as to effectively analyze the shortcomings of the software and provide a visual tool for improving the performance of independent software. At the same time, it has more flexible usage scenarios, supporting Ubuntu (a Linux distribution operating system mainly based on desktop applications), CentOS (community enterprise operating system), CYyunOS (a server operating system independently developed by Tianyi Cloud), and other operating systems. By modifying the script, you can capture keywords for automatic processing, so as to adapt to different scenarios.
[0073] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0074] Based on the same inventive concept, the embodiment of the present application also provides an application performance monitoring device for implementing the application performance monitoring method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the embodiment of the performance monitoring device for one or more applications provided below can refer to the limitations of the application performance monitoring method above, and will not be repeated here.
[0075] In an exemplary embodiment, Figure 5 As shown, a performance monitoring device for an application is provided, wherein the application is implemented based on at least two programming languages, and the device includes: an environment configuration module 502, a data acquisition module 504, a generation module 506, and a mapping module 508, wherein:
[0076] An environment configuration module 502, configured to determine a corresponding environment configuration based on at least two target programming languages of the application program;
[0077] A data acquisition module 504 is used to call perf according to the process identifier of the application program under the environment configuration to acquire the performance data of the application program;
[0078] A generating module 506, configured to generate corresponding program stack information according to the performance data;
[0079] The mapping module 508 is used to map the program stack information based on the symbol table of each target programming language corresponding to the application to obtain a corresponding SVG flame graph, wherein the symbol table includes function information of the application based on the corresponding target programming language.
[0080] In an exemplary embodiment, the data acquisition module is specifically used to: when the application is executed, obtain the process identifier assigned to the application by the operating system; based on the process identifier, call perf to perform performance monitoring on the application to obtain performance data of the application.
[0081] In an exemplary embodiment, the data acquisition module is also used to: before mapping the program stack information based on the symbol table of each target programming language corresponding to the application, when the application runs in DEBUG mode, acquire and store the symbol table of each target programming language corresponding to the application.
[0082] In an exemplary embodiment, the mapping module is specifically used to: map the function address in the program stack information to the corresponding function information according to the symbol table of each target programming language corresponding to the application program, and generate the corresponding SVG flame graph.
[0083] In an exemplary embodiment, the mapping module is also used to: after calling perf according to the process identifier of the application to obtain the performance data of the application, create a timechart instance, and based on the timechart instance, map the performance data according to the symbol table of each target programming language corresponding to the application to generate a timechart diagram of the application.
[0084] In an exemplary embodiment, the environment configuration module is specifically used to: install the perf software through the yum command under sudo authority to determine the perf environment configuration; based on at least two target programming languages of the application, add the installation package corresponding to the target programming language to the system's environment variables to determine the environment configuration of the target programming language.
[0085] Each module in the performance monitoring device of the above application can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0086] In an exemplary embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a performance monitoring method of an application program is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0087] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0088] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0089] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0090] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0091] 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 relevant regulations.
[0092] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0093] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0094] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A performance monitoring method for an application, characterized in that: The application is implemented based on at least two programming languages, and the method includes: Determining a corresponding environment configuration based on at least two target programming languages of the application; Under the environment configuration, calling perf according to the process identifier of the application to obtain performance data of the application; Generate corresponding program stack information according to the performance data; The program stack information is mapped based on a symbol table corresponding to each target programming language of the application to obtain a corresponding SVG flame graph, wherein the symbol table includes function information of the application based on the corresponding target programming language.
2. The method according to claim 1, characterized in that The step of calling perf according to the process identifier of the application to obtain the performance data of the application includes: When the application is executed, obtaining a process identifier assigned to the application by the operating system; Based on the process identifier, perf is called to perform performance monitoring on the application to obtain performance data of the application.
3. The method according to claim 1, characterized in that Before mapping the program stack information based on the symbol table corresponding to each target programming language of the application program, the method further includes: When the application is running in DEBUG mode, a symbol table of each target programming language corresponding to the application is obtained and stored.
4. The method according to claim 1, characterized in that: The program stack information is mapped based on the symbol table of each target programming language corresponding to the application program to obtain a corresponding SVG flame graph, including: According to the symbol table of each target programming language corresponding to the application program, the function address in the program stack information is mapped to the corresponding function information, and the corresponding SVG flame graph is generated.
5. The method according to claim 1, characterized in that After calling perf according to the process identifier of the application to obtain the performance data of the application, the method further includes: A timechart instance is created, and based on the timechart instance, the performance data is mapped according to the symbol table of each target programming language corresponding to the application program to generate a timechart diagram of the application program.
6. The method according to any one of claims 1 to 5, characterized in that: The determining of the corresponding environment configuration based on at least two target programming languages of the application program includes: Install the perf software through the yum command under sudo privileges to determine the perf environment configuration; Based on at least two target programming languages of the application, installation packages corresponding to the target programming languages are added to the environment variables of the system to determine the environment configuration of the target programming languages.
7. A performance monitoring device for an application, characterized in that: The application is implemented based on at least two programming languages, and the device includes: An environment configuration module, configured to determine a corresponding environment configuration based on at least two target programming languages of the application; A data acquisition module, used to call perf according to the process identifier of the application program under the environment configuration to acquire the performance data of the application program; A generating module, used for generating corresponding program stack information according to the performance data; A mapping module is used to map the program stack information based on a symbol table of each target programming language corresponding to the application to obtain a corresponding SVG flame graph, wherein the symbol table includes function information of the application based on the corresponding target programming language.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Flame pattern generation method and device, storage medium and electronic equipment
CN120104441A
Flame pattern generation method, performance analysis method, related device and storage medium
CN120707683A