CN107168848B - Multithreading analysis and operation visualization method - Google Patents
Multithreading analysis and operation visualization method Download PDFInfo
- Publication number
- CN107168848B CN107168848B CN201710295198.4A CN201710295198A CN107168848B CN 107168848 B CN107168848 B CN 107168848B CN 201710295198 A CN201710295198 A CN 201710295198A CN 107168848 B CN107168848 B CN 107168848B
- Authority
- CN
- China
- Prior art keywords
- calling
- analysis
- sub
- function
- thread
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/3017—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is implementing multitasking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3051—Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/32—Monitoring with visual or acoustical indication of the functioning of the machine
- G06F11/324—Display of status information
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a multithreading analysis and operation visualization method, which comprises the following steps: running a source program, and collecting a thread ID and a running stack of the source program; separating the collected runtime stacks according to the thread IDs, so that each thread ID corresponds to one sub runtime stack; counting calling data of each function in each sub-runtime stack, wherein the calling data comprises an attribution module, calling times, calling depth and calling span; identifying and filtering the basic class function in each sub runtime stack according to an attribution module; further filtering each sub-runtime stack according to a preset calling number value, a preset calling depth value and a preset calling span value; and visually displaying each sub-runtime stack to obtain a function call relation diagram corresponding to each thread. The invention realizes the screening analysis and visual display of the multithread operation data, provides an effective source program analysis basis for engineers, and improves the software development efficiency.
Description
Technical Field
The invention relates to the technical field of data analysis, in particular to a multithread analysis and operation visualization method.
Background
At present, many projects have more source code lines, and are executed in parallel by multiple threads, and if the source code needs to be changed on the basis, a required function needs to be searched for and modified in a targeted manner, but searching for a certain function or analyzing a code framework thereof under the condition of more source code lines is not an easy matter, and is mainly realized by artificial look-up and analysis.
The existing tool for analyzing stack records in runtime mainly relates to single-thread program analysis, cannot realize analysis of multi-thread programs, and is only suitable for analysis of a small number of code lines. The existing analysis method for the single-thread program commonly utilizes open-source software grapeviz to realize function call visualization, and provides an engineer with an intuitive function call relation diagram, which specifically comprises the following steps: the method comprises the steps of firstly obtaining a source program running log through a compiler tool chain (such as a GNU compiler tool chain, and forming a proxy entry for all function calls of a source code through a parameter definition-function), wherein the running log comprises function tracking data (function addresses and running stacks) of the source program, then processing the function tracking data by using a customized intermediate code (such as a pvtrace tool), generating a matrix format, mapping the obtained function addresses into function names by using an address mapping tool (such as an Addr2line tool) so as to facilitate reading of a user, and finally performing graph drawing on the function call relation of the whole source program by using an open-source grapeviz tool. However, in practical applications, this method has limited contribution to log analysis, and when a multi-threaded program or a large project with more than twenty-ten thousand lines is involved, the data size is too large and complex, and effective data cannot be extracted for highlighting, so that engineers are very arduous to analyze. In view of this, it is very important to develop a method for multi-thread analysis and visualization.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a multithreading analysis and operation visualization method, which is used for realizing the screening analysis and visualization display of multithreading operation data, providing an effective source program analysis basis for engineers and improving the software development efficiency.
The invention is realized by the following steps: a multithread analysis and operation visualization method comprises the following steps:
and 6, visually displaying each sub-runtime stack to obtain a function call relation diagram corresponding to each thread for analysis and review by an engineer.
Further, the thread ID is obtained by directly calling the operating system thread api by an external program.
Further, the runtime stack is obtained by adding a flag at the compiler, followed by a proxy function.
Furthermore, the attribution module comprises a memory allocation module, a file operation module and a lock module.
Further, the step 6 specifically includes: and drawing a required function call analysis graph by using open source grapeviz software by extracting a file name, a method name, a directory, call times and a function call sequence corresponding to the function in each sub-runtime stack.
Further, important function nodes are identified through colors in the function call analysis graph, and the important function nodes are function nodes with span larger than a threshold value.
The invention has the following advantages: the method comprises the steps of separating multithreading runtime stacks, screening and filtering functions which do not need to be displayed according to user requirements by setting filtering parameters (an attribution module, a calling number value, a calling depth value and a calling span value), obtaining filtered sub runtime stacks, and visually displaying the simplified runtime stacks, so that clear and concise analysis graphs are provided for users, the users can conveniently look up the analysis graphs.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
Fig. 1 is an execution flow chart of a multithread analysis and operation visualization method according to the present invention.
FIG. 2 is a diagram illustrating analysis of function calls according to an embodiment of the present invention.
Detailed Description
As shown in fig. 1, a method for visualizing multithread analysis and operation includes the following steps:
and 6, visually displaying each sub-runtime stack to obtain a function call relation diagram corresponding to each thread for an engineer to analyze and look up, wherein the step 6 specifically comprises the following steps: the file name, the method name, the directory, the calling times and the function calling sequence corresponding to the function in each sub-runtime stack are extracted, the required function calling analysis graph is drawn by utilizing open source grapeviz software, important function nodes are identified in the function calling analysis graph through colors, and the important function nodes are function nodes with span (namely the number of the included primary sub-functions) larger than a threshold value.
The invention is further illustrated below with reference to a specific embodiment:
the invention discloses a multithreading analysis and operation visualization method, which is used for analyzing a source program comprising three mutually switched threads, and comprises the following specific steps:
and 6, extracting a file name, a method name, a directory, calling times and a function calling sequence corresponding to the function in each sub-runtime stack after the two times of filtering, and drawing a required function calling analysis graph by using open source grapeviz software, for example, taking a calling time value for filtering as 100, a calling depth value as 4, and a calling span value as 0, so as to obtain the function calling analysis graphs of the four threads as shown in fig. 2. In the function call analysis graph, function nodes are represented by file names, method names and directories, the call relation between the two function nodes is represented by line segments with arrows, and the call sequence is visually identified by marking numbers on the line segments so that a user can quickly search and locate, wherein the function call analysis graph also identifies important function nodes, and the important function nodes are function nodes (generally 6) with span (namely the number of the included primary sub-functions) larger than a threshold value.
The attribution module, the calling times, the calling depth, the calling span and the threshold value in the step 6 can be adjusted according to the needs of the user, so that functions which do not need to be displayed or are redundant are selectively hidden, a clear and key function calling analysis graph is provided for the user, and the positioning query and analysis efficiency of functions in the later stage of an engineer is improved.
The method comprises the steps of collecting multithreading runtime stacks, separating the runtime stacks according to thread IDs to obtain a plurality of sub runtime stacks, setting filtering parameters (an attribution module, a calling number value, a calling depth value and a calling span value) according to user requirements to screen and filter functions which do not need to be displayed to obtain the filtered sub runtime stacks, and respectively displaying the threads in a visualized mode after filtering to provide clear and concise analysis graphs for users so as to facilitate the users to read.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.
Claims (5)
1. A multithread analysis and operation visualization method is characterized in that: the method comprises the following steps:
step 1, running a source program, and collecting a thread ID and a running stack of the source program;
step 2, separating the collected runtime stacks according to the thread IDs, so that each thread ID corresponds to one sub runtime stack;
step 3, counting the calling data of each function in each sub-runtime stack, wherein the calling data comprises an attribution module, calling times, calling depth and calling span;
step 4, identifying and filtering the basic class function in each sub-runtime stack according to the attribution module, wherein the attribution module comprises a memory allocation module, a file operation module and a lock module;
step 5, further filtering each sub-runtime stack according to a preset calling number value, a preset calling depth value and a preset calling span value;
and 6, visually displaying each sub-runtime stack to obtain a function call relation diagram corresponding to each thread for analysis and review by an engineer.
2. A multithread analysis and execution visualization method as recited in claim 1, wherein: the thread ID is obtained by an external program directly calling the operating system thread api.
3. A multithread analysis and execution visualization method as recited in claim 1, wherein: the runtime stack is obtained by adding a flag at the compiler, followed by a proxy function.
4. A multithread analysis and execution visualization method as recited in claim 1, wherein: the step 6 specifically comprises the following steps: and drawing a required function call analysis graph by using open source grapeviz software by extracting a file name, a method name, a directory, call times and a function call sequence corresponding to the function in each sub-runtime stack.
5. A multithread analysis and execution visualization method as recited in claim 4, wherein: and identifying important function nodes through colors in the function call analysis graph, wherein the important function nodes are function nodes with span larger than a threshold value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710295198.4A CN107168848B (en) | 2017-04-28 | 2017-04-28 | Multithreading analysis and operation visualization method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710295198.4A CN107168848B (en) | 2017-04-28 | 2017-04-28 | Multithreading analysis and operation visualization method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107168848A CN107168848A (en) | 2017-09-15 |
CN107168848B true CN107168848B (en) | 2020-06-09 |
Family
ID=59812573
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710295198.4A Active CN107168848B (en) | 2017-04-28 | 2017-04-28 | Multithreading analysis and operation visualization method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107168848B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109710396B (en) * | 2017-10-26 | 2023-08-22 | 华为技术有限公司 | Method and device for information acquisition and memory release |
CN109831351B (en) * | 2018-12-29 | 2021-03-05 | 深圳云天励飞技术有限公司 | Link tracking method, device, terminal and storage medium |
CN116661987A (en) * | 2022-12-29 | 2023-08-29 | 荣耀终端有限公司 | Memory application method and electronic equipment |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105630471A (en) * | 2014-11-03 | 2016-06-01 | 广州市动景计算机科技有限公司 | Code tracking method and system based on GCC and Chromium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120180053A1 (en) * | 2011-01-10 | 2012-07-12 | International Business Machines Corporation | Call stack aggregation and display |
US20150199262A1 (en) * | 2014-01-16 | 2015-07-16 | Vivek Bhavsar | Runtime code visualization |
-
2017
- 2017-04-28 CN CN201710295198.4A patent/CN107168848B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105630471A (en) * | 2014-11-03 | 2016-06-01 | 广州市动景计算机科技有限公司 | Code tracking method and system based on GCC and Chromium |
Non-Patent Citations (1)
Title |
---|
《基于推测多线程技术的程序可视化方法与实现》;赵永刚,李美蓉,李保红,韩博;《西安邮电学院学报》;20100930;第15卷(第5期);69-74页 * |
Also Published As
Publication number | Publication date |
---|---|
CN107168848A (en) | 2017-09-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8627290B2 (en) | Test case pattern matching | |
US8359292B2 (en) | Semantic grouping for program performance data analysis | |
US9747190B2 (en) | Analysis system, analysis method, and computer program product | |
US9003240B2 (en) | Blackbox memory monitoring with a calling context memory map and semantic extraction | |
CN107045478B (en) | lightweight thread analysis and operation visualization method | |
US9176840B2 (en) | Tool for analyzing and resolving errors in a process server | |
CN107168848B (en) | Multithreading analysis and operation visualization method | |
US8601442B2 (en) | Marker correlation of application constructs with visualizations | |
Adamoli et al. | Trevis: A context tree visualization & analysis framework and its use for classifying performance failure reports | |
CN109284102B (en) | Information acquisition method and device | |
US10365995B2 (en) | Composing future application tests including test action data | |
CN113688288A (en) | Data association analysis method and device, computer equipment and storage medium | |
CN108399321B (en) | Software local plagiarism detection method based on dynamic instruction dependence graph birthmark | |
EP2951680B1 (en) | Acquiring identification of an application lifecycle management entity associated with similar code | |
JP4928848B2 (en) | Message converter in computer system integrated management environment. | |
Revelle et al. | Understanding concerns in software: insights gained from two case studies | |
US8701086B2 (en) | Simplifying analysis of software code used in software systems | |
US11119899B2 (en) | Determining potential test actions | |
JP2007241426A (en) | Specification operation support system for failure factor of application | |
US20130307854A1 (en) | Method and System for Visualising a System Model | |
US10042638B2 (en) | Evaluating documentation coverage | |
CN107330031B (en) | Data storage method and device and electronic equipment | |
US8819626B2 (en) | Sharable development environment bookmarks for functional/data flow | |
Gobert et al. | Understanding schema evolution as a basis for database reengineering | |
CN115510361A (en) | Data chart page generation method based on visual configuration and related equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP02 | Change in the address of a patent holder |
Address after: 350000 21 / F, building 5, f District, Fuzhou Software Park, 89 software Avenue, Gulou District, Fuzhou City, Fujian Province Patentee after: FUJIAN SINOREGAL SOFTWARE Co.,Ltd. Address before: 350000, No. 5, building F, zone 20-21, Fuzhou Software Park, 89 software Avenue, Gulou District, Fujian, Fuzhou Patentee before: FUJIAN SINOREGAL SOFTWARE Co.,Ltd. |
|
CP02 | Change in the address of a patent holder |