CN107045478A - A kind of lightweight Thread Analysis and operation method for visualizing - Google Patents
A kind of lightweight Thread Analysis and operation method for visualizing Download PDFInfo
- Publication number
- CN107045478A CN107045478A CN201710293494.0A CN201710293494A CN107045478A CN 107045478 A CN107045478 A CN 107045478A CN 201710293494 A CN201710293494 A CN 201710293494A CN 107045478 A CN107045478 A CN 107045478A
- Authority
- CN
- China
- Prior art keywords
- storehouse
- call
- function
- thread
- lightweight
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3604—Software analysis for verifying properties of programs
- G06F11/3612—Software analysis for verifying properties of programs by runtime analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present invention provides a kind of lightweight Thread Analysis and operation method for visualizing, including:Source program is run, storehouse when gathering lightweight Thread Id and the operation of source program, lightweight Thread Id is obtained by inverse injection;According to the lightweight Thread Id to collect operation when storehouse separate, obtain storehouse during the operation of plural height;Each function calls data in storehouse when counting each sub- operation, calls data to include ownership module, call number, call depth and call span;Respectively according to it is default ownership module, call number, call depth and call span to each sub- operation when storehouse filter;Storehouse carries out visual presentation during to each sub- operation after filtering, obtains the corresponding function call relationship graph of each thread, analyzes and consults for engineer.The analysis and self-defined screening of storehouse when present invention realization is run to lightweight multi-threaded program, and visual presentation is realized, effective analysis of source program foundation is provided for engineer, software development efficiency is improved.
Description
Technical field
The present invention relates to data analysis technique field, more particularly to a kind of lightweight Thread Analysis and operation visualization side
Method.
Background technology
Lightweight thread also known as fine journey, are a kind of user threads supported by kernel, it is based on the senior of kernel thread
It is abstract.
Because fine journey is compared with common thread, resource occupation is smaller, without extra kernel spacing resource, page table etc., wound
Build, destroy, switching faster, being absorbed in without kernel, the advantages of can customize scheduling strategy, increasing mega project is adopted at present
Programmed with lightweight thread mode.Stack record instrument can not meet requirement when traditional analysis source program is run, existing
Be used for analyze source program operation when stack record analysis method be mainly:First pass through a compiler instrument chain (such as GNU compilers
Tools chain, can be by a parameter finstrument-function to one proxy entry of all function calls of source code formation)
Stack record when obtaining source program operation, recycles the intermediate code (such as pvtrace instruments) of a customization to tracking function data
Handled, and generator matrix form, by an address of cache instrument (such as Addr2line instruments) by the function address got
Function name is mapped to so that user reads, function calling relationship of the graphviz instruments increased income to whole source program is finally utilized
Carry out graphic plotting.Although and the analysis method of stack record improves project analysis effect to a certain extent during this operation
Rate, but storehouse is only used for realizing the analysis to the small project of single thread when currently running, is not applied beyond 200,000 rows
The program of multithreading above or lightweight thread, therefore its contribution for analyzing source program to engineer is fairly limited.And due to
Lightweight thread is User space thread, rather than system thread, therefore can not be applicable traditional direct acquisition operating system thread
To gather lightweight Thread Id, and if directly source program is modified so as to obtaining thread information, source may be destroyed
Program.In view of this, a kind of lightweight Thread Analysis available for large project is developed with operation method for visualizing just to seem particularly
It is important.
The content of the invention
The technical problem to be solved in the present invention, is to provide a kind of lightweight Thread Analysis and operation method for visualizing, real
The analysis of storehouse and self-defined screening when now being run to lightweight multi-threaded program, and visual presentation is realized, provided for engineer
Effective analysis of source program foundation, improves software development efficiency.
What the present invention was realized in:A kind of lightweight Thread Analysis and operation method for visualizing, comprise the following steps:
Step 1, operation source program, storehouse, the lightweight when gathering lightweight Thread Id and the operation of the source program
Thread Id collection mode be:One external program is called by dl storehouses, the letter of the source program is obtained by the external program
Number address, and the lightweight Thread Id is obtained according to function address;
Step 2, according to the lightweight Thread Id to collect operation when storehouse separate so that it is each described light
Storehouse during the one son operation of magnitude Thread Id correspondence;
Step 3, each function calls data in storehouse when counting each sub- operation, described to call data to include ownership
Module, call number, call depth and call span;
Step 4, according to it is described ownership module to each sub- operation when storehouse in basic class function be identified simultaneously
Filtering;
Step 5, according to call number value set in advance, call depth value and call span value to per the sub- operation when
Storehouse does further filtering;
Step 6, to each sub- operation when storehouse carry out visual presentation, draw the corresponding function call of each thread
Graph of a relation, analyzes for engineer and consults.
Further, storehouse is indicated by being added in compiler during the operation, is obtained afterwards by proxy function.
Further, the ownership module includes memory allocating module, file operation module and lock module.
Further, the step 6 is specially:By extract during each sub- operation the corresponding filename of function in storehouse,
Method name, catalogue, call number and function call order, are analyzed using the function call for graphviz Software on Drawing needs of increasing income
Figure.
Further, important function node is identified by color in the function call analysis chart, it is described important
Function node is the function node that span is more than a threshold value.
The invention has the advantages that:By gather lightweight Thread Id to operation when storehouse separate, further according to
Family needs to set filtration parameter (belong to module, call number value, call depth value and call span value) to carry out screening and filtering, obtains
Storehouse during each height operation after to filtering, then carry out visualization in the way of being easy to user to read and show that there is provided clear to user
Clear succinct analysis chart, is easy to quick positioning of the user to program operating path and focus, effectively lifts Large-Scale Projects
Efficiency of research and development, shortens the soft project duration.
Brief description of the drawings
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is a kind of lightweight Thread Analysis of the invention and operation method for visualizing execution flow chart.
Fig. 2 is the function call analysis chart in one embodiment of the invention.
Embodiment
As shown in figure 1, a kind of lightweight Thread Analysis of the invention and operation method for visualizing, comprise the following steps:
Step 1, operation source program, storehouse, the lightweight when gathering lightweight Thread Id and the operation of the source program
Thread Id collection mode be:One external program is called by dl storehouses, the letter of the source program is obtained by the external program
Number address, and the lightweight Thread Id is obtained according to function address, storehouse is marked by being added in compiler during the operation
Will, is obtained by proxy function afterwards;
Step 2, according to the lightweight Thread Id to collect operation when storehouse separate so that it is each described light
Storehouse during the one son operation of magnitude Thread Id correspondence;
Step 3, each function calls data in storehouse when counting each sub- operation, described to call data to include ownership
Module, call number, call depth and call span, the ownership module is by User Defined, and the ownership module includes interior
Distribute module, file operation module and lock module etc. are deposited, frequently called system-based module;
Step 4, according to it is described ownership module to each sub- operation when storehouse in basic class function be identified simultaneously
Filtering;
Step 5, according to call number value set in advance, call depth value and call span value to per the sub- operation when
Storehouse does further filtering;
Step 6, to each sub- operation when storehouse carry out visual presentation, that is, draw the corresponding function call of each thread and close
System's figure, analyzes for engineer and consults;The step 6 is specially:By extracting during each sub- operation the corresponding text of function in storehouse
Part name, method name, catalogue, call number and function call order, are adjusted using the function for graphviz Software on Drawing needs of increasing income
With analysis chart, important function node is identified by color in the function call analysis chart, the important function node
It is more than the function node of a threshold value for span.
With reference to a specific embodiment, the present invention will be further described:
Include what three threads mutually switched to one using the lightweight Thread Analysis and operation method for visualizing of the present invention
Source program is analyzed, specific as follows:
Source program is run, is indicated by being added in compiler (such as GNU compilers), heap when obtaining operation by acting on behalf of afterwards
Stack, and an external program is called by dl storehouses (libdl.so api), the letter of the source program is obtained by the external program
Number address, and obtained according to function address in lightweight Thread Id, such as the present embodiment, source program has 4 threads, then runs
After source program, the external program can get 4 lightweight Thread Ids, respectively 1 main thread ID (000) and 3 sub-lines
Journey ID (001,002 and 003);
According to the lightweight Thread Id to collect operation when storehouse separate so that each lightweight line
When storehouse is separable into 4 son operations during the operation of source program during the one son operation of journey ID correspondences in storehouse, i.e. the present embodiment
Storehouse;
Each function calls data in storehouse when counting each sub- operation, it is described call data include ownership module,
Call number, call depth and call span, the ownership module mainly includes memory allocating module, file operation module and lock
Module etc., the system-based module being frequently called;
Basic class function during according to ownership module to each sub- operation in storehouse is identified and filtered, that is, recognizes
And memory allocating module, file operation module and lock module etc. are filtered out, the system-based module being frequently called;
According to call number value set in advance, call depth value and call span value to per the sub- operation when storehouse do
Further filtering;
By extract through it is above-mentioned twice filter after each sub- operation when storehouse in the corresponding filename of function, method name,
Catalogue and function call order, using the function call analysis chart for graphviz Software on Drawing needs of increasing income, for example, filtering is used
Call number value take 100, call depth value to take 4, call span value to take 0, then the present embodiment source program function call analysis
The effect of figure is shown as shown in Fig. 2 including the function call situation of four parts (i.e. four threads).In the function call analysis chart
In, function node is represented with filename, method name and catalogue, line segment form of the call relation between two function nodes with arrow
Show, and by digital come identifying call directly perceived order in line segment subscript, so as to the quick Search and Orientation of user, wherein, the function
Analysis chart is called also to be identified to important function node, the important function node is by span (the sub- letter of one-level included
Several numbers) it is more than the function node (typically taking 6) of a threshold value.
Above-mentioned ownership module, call number, call depth and call span and define the threshold value of important function can be with
Needed voluntarily to adjust according to user, thus selectivity hide some need not show or redundancy function, to be supplied to use
The function call analysis chart that family is clear, give prominence to the key points, greatly improves the locating query and analysis efficiency of engineer's later stage function.
Source program interface is exposed to external program by the present invention by inverse injection technology, then is called and adopted by external program
Collect lightweight Thread Id, so as to farthest protect source program, reduce intrusion and modification to source program, then by operation
When storehouse separated, and according to user need set filtration parameter (ownership module, call number value, call depth value and tune
With span value) screening and filtering is carried out, then to showing after filtering to the progress visualization of each thread, there is provided clearly simple to user respectively
Clean analysis chart, facilitates user to read, so that the quick positioning to program operating path and focus, effectively lifting large software
Purpose efficiency of research and development, shortens the soft project duration.
Although the foregoing describing the embodiment of the present invention, those familiar with the art should manage
Solution, the specific embodiment described by us is merely exemplary, rather than for the restriction to the scope of the present invention, is familiar with this
The equivalent modification and change that the technical staff in field is made in the spirit according to the present invention, should all cover the present invention's
In scope of the claimed protection.
Claims (5)
1. a kind of lightweight Thread Analysis and operation method for visualizing, it is characterised in that:Comprise the following steps:
Step 1, operation source program, storehouse, the lightweight thread when gathering lightweight Thread Id and the operation of the source program
ID collection mode be:One external program is called by dl storehouses, the function of the source program is obtained by the external program
Location, and the lightweight Thread Id is obtained according to function address;
Step 2, according to the lightweight Thread Id to collect operation when storehouse separate so that each lightweight
Storehouse during the one son operation of Thread Id correspondence;
Step 3, each function calls data in storehouse when counting each sub- operation, described to call data to include ownership mould
Block, call number, call depth and call span;
Step 4, according to the ownership module to each sub- operation when storehouse in basic class function be identified and filter;
Step 5, according to call number value set in advance, call depth value and call span value to per the sub- operation when storehouse
Do further filtering;
Step 6, to each sub- operation when storehouse carry out visual presentation, draw the corresponding function calling relationship of each thread
Figure, analyzes for engineer and consults.
2. a kind of lightweight Thread Analysis according to claim 1 and operation method for visualizing, it is characterised in that:The fortune
Storehouse is indicated by being added in compiler during row, is obtained afterwards by proxy function.
3. a kind of lightweight Thread Analysis according to claim 1 and operation method for visualizing, it is characterised in that:It is described to return
Belonging to module includes memory allocating module, file operation module and lock module.
4. a kind of lightweight Thread Analysis according to claim 1 and operation method for visualizing, it is characterised in that:The step
Rapid 6 are specially:By extracting during each sub- operation the corresponding filename of function, method name, catalogue, call number and letter in storehouse
Number calls order, utilizes the function call analysis chart for graphviz Software on Drawing needs of increasing income.
5. a kind of lightweight Thread Analysis according to claim 4 and operation method for visualizing, it is characterised in that:The letter
Number calls in analysis chart and important function node to be identified by color, and the important function node is that span is more than a threshold value
Function node.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710293494.0A CN107045478B (en) | 2017-04-28 | 2017-04-28 | lightweight thread analysis and operation visualization method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710293494.0A CN107045478B (en) | 2017-04-28 | 2017-04-28 | lightweight thread analysis and operation visualization method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107045478A true CN107045478A (en) | 2017-08-15 |
CN107045478B CN107045478B (en) | 2019-12-13 |
Family
ID=59546899
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710293494.0A Active CN107045478B (en) | 2017-04-28 | 2017-04-28 | lightweight thread analysis and operation visualization method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107045478B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108287762A (en) * | 2018-01-09 | 2018-07-17 | 福建星瑞格软件有限公司 | Distributed Calculation interactive mode uses method for optimizing resources and computer equipment |
CN109542719A (en) * | 2018-10-26 | 2019-03-29 | 金蝶软件(中国)有限公司 | Thread state monitoring method and device, computer equipment and storage medium |
CN114201353A (en) * | 2020-09-02 | 2022-03-18 | 北京字节跳动网络技术有限公司 | Processing method, device and storage medium for program time-consuming data |
CN115836257A (en) * | 2020-07-28 | 2023-03-21 | 倍福自动化有限公司 | Method for controlling an automation system having a visualization function for program objects of a control program of the automation system, and automation system |
US12032962B2 (en) | 2020-07-28 | 2024-07-09 | Beckhoff Automation Gmbh | Method for controlling an automation system having visualization of program objects of a control program of the automation system, and automation system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070124732A1 (en) * | 2005-11-29 | 2007-05-31 | Lia Shih-Wei | Compiler-based scheduling optimization hints for user-level threads |
CN101876923A (en) * | 2009-11-27 | 2010-11-03 | 中国科学院声学研究所 | Method for accurately estimating stack demand in embedded system |
CN103136047A (en) * | 2011-11-30 | 2013-06-05 | 大唐联诚信息系统技术有限公司 | Multithreading management method and framework |
-
2017
- 2017-04-28 CN CN201710293494.0A patent/CN107045478B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070124732A1 (en) * | 2005-11-29 | 2007-05-31 | Lia Shih-Wei | Compiler-based scheduling optimization hints for user-level threads |
CN101876923A (en) * | 2009-11-27 | 2010-11-03 | 中国科学院声学研究所 | Method for accurately estimating stack demand in embedded system |
CN103136047A (en) * | 2011-11-30 | 2013-06-05 | 大唐联诚信息系统技术有限公司 | Multithreading management method and framework |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108287762A (en) * | 2018-01-09 | 2018-07-17 | 福建星瑞格软件有限公司 | Distributed Calculation interactive mode uses method for optimizing resources and computer equipment |
CN109542719A (en) * | 2018-10-26 | 2019-03-29 | 金蝶软件(中国)有限公司 | Thread state monitoring method and device, computer equipment and storage medium |
CN109542719B (en) * | 2018-10-26 | 2022-05-13 | 金蝶软件(中国)有限公司 | Thread state monitoring method and device, computer equipment and storage medium |
CN115836257A (en) * | 2020-07-28 | 2023-03-21 | 倍福自动化有限公司 | Method for controlling an automation system having a visualization function for program objects of a control program of the automation system, and automation system |
CN115836257B (en) * | 2020-07-28 | 2024-06-07 | 倍福自动化有限公司 | Method for controlling an automation system having a visualization function for a program object of a control program of the automation system, and automation system |
US12032962B2 (en) | 2020-07-28 | 2024-07-09 | Beckhoff Automation Gmbh | Method for controlling an automation system having visualization of program objects of a control program of the automation system, and automation system |
CN114201353A (en) * | 2020-09-02 | 2022-03-18 | 北京字节跳动网络技术有限公司 | Processing method, device and storage medium for program time-consuming data |
Also Published As
Publication number | Publication date |
---|---|
CN107045478B (en) | 2019-12-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107045478A (en) | A kind of lightweight Thread Analysis and operation method for visualizing | |
US10191889B2 (en) | Systems, apparatuses and methods for generating a user interface by performing computer vision and optical character recognition on a graphical representation | |
US8429620B2 (en) | Memory leak diagnosis | |
US6219833B1 (en) | Method of using primary and secondary processors | |
CN105930159B (en) | A kind of method and system that the GUI code based on image generates | |
US7730460B1 (en) | Code execution visualization using software fingerprinting | |
US6698013B1 (en) | Real time monitoring system for tracking and documenting changes made by programmer's during maintenance or development of computer readable code on a line by line basis and/or by point of focus | |
CN106649100A (en) | Automatic test method and system | |
CN103020176B (en) | Data block dividing method in XML parsing and XML parsing method | |
CN108875091A (en) | A kind of distributed network crawler system of unified management | |
CN103701633B (en) | Setup and maintenance system of visual cluster application for distributed search SolrCloud | |
CN103279471A (en) | Logical grouping of profile data | |
CN108628918B (en) | System deployment and dependency relationship automatic drawing system and method | |
CN104462943B (en) | Non-intrusion type performance monitoring apparatus and method in operation system | |
CN106503496A (en) | Replaced and the Python shell script anti-reversal methods for merging based on operation code | |
CN109918907A (en) | Linux platform proceeding internal memory malicious code evidence collecting method, controller and medium | |
CN105868626B (en) | The method of monitoring software business conduct based on control stream coarseness integrality | |
CN1282085C (en) | Method of parallel regulating multi-task of imbedding system | |
CN109871686A (en) | Rogue program recognition methods and device based on icon representation and software action consistency analysis | |
CN107168848A (en) | A kind of multithread analyzing and operation method for visualizing | |
WO2006136055A1 (en) | A text data mining method | |
CN107368336A (en) | A kind of cloud data center deployed with devices and the method and apparatus of management | |
CN107943482A (en) | Rule-based stream data processing method unification monitor supervision platform | |
CN103559574B (en) | Method and system for operating workflow | |
CN102446167A (en) | Method and device for carrying out logic processing on complex character strings on basis of logic templates |
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 | ||
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. |