CN101916226A - Thread information based multi-thread parallelly-executing tracking method - Google Patents
Thread information based multi-thread parallelly-executing tracking method Download PDFInfo
- Publication number
- CN101916226A CN101916226A CN 201010270635 CN201010270635A CN101916226A CN 101916226 A CN101916226 A CN 101916226A CN 201010270635 CN201010270635 CN 201010270635 CN 201010270635 A CN201010270635 A CN 201010270635A CN 101916226 A CN101916226 A CN 101916226A
- Authority
- CN
- China
- Prior art keywords
- thread
- current
- business
- trace log
- tracking
- 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.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a thread information based multi-thread parallelly-executing tracking method comprising the following steps of: binding current service data and current thread ID at the start code position of a service process, and distributing special service log objects for current services; and outputting tracking logs through the special service log objects by utilizing the bound service data and current thread ID in the executing process of the current services, wherein the service data and the current thread ID are bound by utilizing a thread ID unchangeable principle when the service process is started so as to acquire the service data through the unchangeable thread ID on any calling position executed by the current services, therefore the purpose of associated output of the tracking logs and the services is easily and conveniently realized; different service log objects are distributed for different services when the services start to be processed, and the tracking log output by a certain service log object is only related to the current service, therefore the purpose of concentration of the output tracking logs is achieved.
Description
Technical field
The present invention relates to the software administration technical field, more particularly, relate to a kind of multi-thread concurrent and carry out tracking and system based on thread information.
Background technology
In the research and development of software process, it is the effective means of problem analysis, location reason that the code implementation is followed the tracks of.At present, the code tracking method is exactly single-step debug the most intuitively, but the method can't effectively be carried out the implementation of multi-thread concurrent.For the implementation of this multi-thread concurrent, general by method in the output tracking daily record of the code appropriate location of each module, the implementation of each module during the record multi-thread concurrent is carried out.But, which for calling of public module, call if can not effectively identify, because the randomness of concurrent process by business module, to cause voice and packet data concurrent service that the trace log that public module calls generation is mixed together, and can't analyze the complete implementation of certain business.
Therefore, to the analysis of this type of trace log, 2 requirements are arranged: first requires every trace log that the sign of related business process all will be arranged, so that distinguish the trace log that the different business flow process produces; Second is independent so that analyze the trace log of same operation flow.
At present, the tracking of existing a kind of software execute process is: when business module calls public module, import business datum into by call parameters, in public module, judge the business datum of importing into then, adjust the information of input trace log according to this, make the public module trace log related with professional generation, like this, satisfy first requirement that trace log is analyzed: trace log comprises service identification.
But, because above-mentioned method can not satisfy second requirement, therefore another kind of method has been proposed again, be that the business datum of importing in the time of will calling public module makes the trace log output stream object corresponding with this business into, thereby make the trace log of same business all write the trace log file by this daily record object output, when realizing trace log and business association, be collectively written into same trace log with the trace log of same business is independent.
Yet all there is following shortcoming in the tracking of above-mentioned two kinds of software execute process: one, and at the function of public module, all need to increase and be used for describing the extra parameter of service related data, increase operation steps; Its two, in case need to adjust the business datum of importing into, then may need to revise all function parameters statements, operate more complicated.
Summary of the invention
In view of this, the invention provides a kind of multi-thread concurrent based on thread information and carry out tracking and system, related with the daily record of simple and convenient realization public module output tracking and related service, and the trace log of same business is concentrated and is exported purpose.
For achieving the above object, the technical scheme of proposition is as follows:
A kind of multi-thread concurrent based on thread information is carried out tracking, comprising:
In the code position that operation flow begins, binding current business data and current thread ID, and distribute the business diary object of a special use for current business;
In the implementation of current business, utilize the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
Preferably, the method for described output tracking daily record comprises:
Obtain current thread ID;
Search prestore at line service and execution thread mapping table, obtain the current business data according to described current thread ID;
Form trace log information in conjunction with described current business data and code tracking information;
Business diary object by described special use writes trace log and output with described trace log information.
Preferably, describedly comprise: online traffic ID, online Business Name, online business diary object and Thread Id at line service and execution thread mapping table.
Preferably, described binding current business data and current thread ID are specially current business data and current thread ID are write in the same data structure body.
A kind of multi-thread concurrent based on thread information is carried out tracker, comprising:
Business datum and Thread Id binding unit is used for the code position that begins in operation flow, binding current business data and current thread ID;
Business diary object allocation units are used to the current business of having bound Thread Id to distribute the business diary object of a special use;
The trace log output unit is used for the implementation in current business, utilizes the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
Preferably, described trace log output unit comprises:
Obtain the Thread Id module, be used to obtain current thread ID;
Obtain business data module, have, be used to search described, obtain the current business data according to described current thread ID at line service and execution thread mapping table at line service and execution thread mapping table;
The trace log information generating module is used for described current business data and code tracking information are constituted trace log information;
The trace log output module is used for by the business diary object of described special use described trace log information being write trace log and output.
From above-mentioned technical scheme as can be seen, multi-thread concurrent based on thread information disclosed by the invention is carried out in the tracking, utilize Thread Id invariance principle in the process of service execution, when operation flow starts, with this business datum and current thread ID binding, thereby any calling station in the current business execution, can pass through constant Thread Id, obtain business datum, need in the calling of record public module trace log, not import extraneous information into, realize the purpose that public module trace log and business association are exported simply and easily.And, because different business distributed different business diary objects when it begins to handle, thus by the trace log of certain business diary object output, only relevant with current business, reach the concentrated purpose of trace log of output.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the disclosed a kind of process flow diagram of carrying out tracking based on the multi-thread concurrent of thread information of the embodiment of the invention;
Fig. 2 is the process flow diagram of the method for the disclosed output tracking daily record of the embodiment of the invention;
Fig. 3 is the disclosed a kind of structural representation of carrying out tracker based on the multi-thread concurrent of thread information of the embodiment of the invention;
Fig. 4 is the structural representation of the disclosed trace log output unit of the embodiment of the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The embodiment of the invention discloses a kind of multi-thread concurrent based on thread information and carry out tracking and system, realizing simple and conveniently having realized the related of public module output journal and related service, and the trace log of same business is concentrated the purpose of exporting.
Below carry out tracking and system by concrete introduction of embodiment respectively based on the multi-thread concurrent of thread information.
As shown in Figure 1, described multi-thread concurrent execution tracking based on thread information comprises:
Step S11, the code position that begins in operation flow, binding current business data and current thread ID, and be the business diary object of a special use of current business distribution;
Concrete, described binding current business data and current thread ID are: current business data and current thread ID are write in the same data structure body.
A thread is actually a performance element, and when operating system produced a process, it produced a main thread for this process automatically, and this thread begins to carry out from article one instruction of business module usually.And Thread Id is exactly to be used for the thread number of mark thread, and the Thread Id of each thread is constant.
Step S12, in the implementation of current business, utilize the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
There is the phenomenon that business module calls public module in the implementation of current business, at this moment, because business datum and Thread Id binding, public module can obtain business datum by Thread Id, by the business diary object output tracking daily record of described special use, this trace log is associated with business.
Concrete, what the business datum of utilizing described binding and the daily record of Thread Id output tracking were adopted is to encapsulate daily record class mode.
The disclosed multi-thread concurrent based on thread information of the embodiment of the invention is carried out tracking, has simple, easy-to-use and general advantage.Concrete, utilize Thread Id invariance principle in the online process of service execution, with current business data and current thread ID binding, simplified the output procedure of trace log, realize that principle and process are simple; By encapsulation trace log class, simplified the invoked procedure of trace log output, be easy to use; Because the Thread Id invariance principle is applicable to all mainstream operation systems, described this method is with a wide range of applications.
And, in the same thread, be divided into a plurality of at line service, choosing a business is current business, and itself and Thread Id corresponding with it are bound, and carries out the disclosed content of the foregoing description and is finished until this business, it is professional for current business to choose another one again, repeats said process.
Concrete, as shown in Figure 2, the method for the disclosed output tracking daily record of the foregoing description comprises:
Step S21, obtain current thread ID;
Step S22, search prestore at line service and execution thread mapping table, obtain the current business data according to described current thread ID;
Concrete, described is a data structure in line service and execution thread mapping table, is included in line service ID, online Business Name, online business diary object and Thread Id in this data structure at least.
Based on this mapping table, any position in the implementation of current business can obtain the data of current business.
Step S23, form trace log information in conjunction with described current business data and code tracking information;
Concrete, code tracking information is used for current business and describes the performed code position that arrives.Different code tracking information representation current business is carried out the code of diverse location, can represent the different progresses that current business is carried out in conjunction with the trace log information that described current business data and code tracking information form.
Step S24, the business diary object by described special use write trace log and output with described trace log information.
Equally, because the effect of code tracking information, any code position that can be implemented in professional executive routine generates and the output tracking daily record.
The disclosed multi-thread concurrent based on thread information of the embodiment of the invention is carried out tracker, as shown in Figure 3, comprising: business datum and Thread Id binding unit 101, business diary object allocation units 102 and trace log output unit 103, wherein:
Business datum and Thread Id binding unit 101 is used for the code position that begins in operation flow, binding current business data and current thread ID;
Business diary object allocation units 102 are used to the current business of having bound Thread Id to distribute the business diary object of a special use;
Trace log output unit 103 is used for the implementation in current business, utilizes the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
Concrete, as shown in Figure 4, trace log output unit 103 comprises: obtain Thread Id module 201, obtain business data module 202, trace log information generating module 203 and trace log output module 204, wherein:
Obtain Thread Id module 201 and be used to obtain current thread ID;
Obtain business data module 202 and have, be used to search described, obtain the current business data according to described current thread ID at line service and execution thread mapping table at line service and execution thread mapping table;
Trace log information generating module 203 is used for forming trace log information in conjunction with described current business data and code tracking information;
Trace log output module 204 is used for by the business diary object of described special use described trace log information being write trace log and output.
It is corresponding with the disclosed multi-thread concurrent execution tracking based on thread information of the foregoing description that the disclosed multi-thread concurrent based on thread information of present embodiment is carried out tracker, the concrete course of work of this system sees also the disclosed content of the foregoing description, repeats no more herein.
To the above-mentioned explanation of the disclosed embodiments, make this area professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be conspicuous concerning those skilled in the art, and defined herein General Principle can realize under the situation that does not break away from the spirit or scope of the present invention in other embodiments.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet and principle disclosed herein and features of novelty the wideest corresponding to scope.
Claims (6)
1. the multi-thread concurrent based on thread information is carried out tracking, it is characterized in that, comprising:
In the code position that operation flow begins, binding current business data and current thread ID, and distribute the business diary object of a special use for current business;
In the implementation of current business, utilize the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
2. method according to claim 1 is characterized in that, the method for described output tracking daily record comprises:
Obtain current thread ID;
Search prestore at line service and execution thread mapping table, obtain the current business data according to described current thread ID;
Form trace log information in conjunction with described current business data and code tracking information;
Business diary object by described special use writes trace log and output with described trace log information.
3. method according to claim 2 is characterized in that, describedly comprises at line service and execution thread mapping table: online traffic ID, online Business Name, online business diary object and Thread Id.
4. method according to claim 1 is characterized in that, described binding current business data and current thread ID are specially: current business data and current thread ID are write in the same data structure body.
5. the multi-thread concurrent based on thread information is carried out tracker, it is characterized in that, comprising:
Business datum and Thread Id binding unit is used for the code position that begins in operation flow, binding current business data and current thread ID;
Business diary object allocation units are used to the current business of having bound Thread Id to distribute the business diary object of a special use;
The trace log output unit is used for the implementation in current business, utilizes the business datum and the Thread Id of described binding, by the business diary object output tracking daily record of described special use.
6. system according to claim 5 is characterized in that, described trace log output unit comprises:
Obtain the Thread Id module, be used to obtain current thread ID;
Obtain business data module, have, be used to search described, obtain the current business data according to described current thread ID at line service and execution thread mapping table at line service and execution thread mapping table;
The trace log information generating module is used for described current business data and code tracking information are constituted trace log information;
The trace log output module is used for by the business diary object of described special use described trace log information being write trace log and output.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010270635 CN101916226A (en) | 2010-08-31 | 2010-08-31 | Thread information based multi-thread parallelly-executing tracking method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010270635 CN101916226A (en) | 2010-08-31 | 2010-08-31 | Thread information based multi-thread parallelly-executing tracking method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101916226A true CN101916226A (en) | 2010-12-15 |
Family
ID=43323743
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201010270635 Pending CN101916226A (en) | 2010-08-31 | 2010-08-31 | Thread information based multi-thread parallelly-executing tracking method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101916226A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102999522A (en) * | 2011-09-15 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Data storage method and device |
CN104239133A (en) * | 2014-09-26 | 2014-12-24 | 北京国双科技有限公司 | Log processing method, device and server |
CN104346365A (en) * | 2013-07-30 | 2015-02-11 | 阿里巴巴集团控股有限公司 | Device and method for determining specific service associated logs |
CN106844169A (en) * | 2015-12-04 | 2017-06-13 | 大唐移动通信设备有限公司 | A kind of information processing method and system |
CN110515800A (en) * | 2019-08-16 | 2019-11-29 | 北京浪潮数据技术有限公司 | A kind of processing method and processing device of operation information |
CN111382023A (en) * | 2018-12-27 | 2020-07-07 | 中国移动通信集团贵州有限公司 | Code fault positioning method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030159133A1 (en) * | 2001-10-26 | 2003-08-21 | International Business Machines Corporation | Method and system for tracing and displaying execution of nested functions |
CN101515245A (en) * | 2008-02-21 | 2009-08-26 | 卓望数码技术(深圳)有限公司 | Operation log recording method and system |
CN101562546A (en) * | 2008-04-18 | 2009-10-21 | 北京闻言科技有限公司 | Method for tracking request processing flow using thread status |
CN101639803A (en) * | 2008-07-30 | 2010-02-03 | 株式会社日立制作所 | Exception handling method and exception handling device for multithread application system |
-
2010
- 2010-08-31 CN CN 201010270635 patent/CN101916226A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030159133A1 (en) * | 2001-10-26 | 2003-08-21 | International Business Machines Corporation | Method and system for tracing and displaying execution of nested functions |
CN101515245A (en) * | 2008-02-21 | 2009-08-26 | 卓望数码技术(深圳)有限公司 | Operation log recording method and system |
CN101562546A (en) * | 2008-04-18 | 2009-10-21 | 北京闻言科技有限公司 | Method for tracking request processing flow using thread status |
CN101639803A (en) * | 2008-07-30 | 2010-02-03 | 株式会社日立制作所 | Exception handling method and exception handling device for multithread application system |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102999522A (en) * | 2011-09-15 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Data storage method and device |
CN102999522B (en) * | 2011-09-15 | 2016-09-14 | 阿里巴巴集团控股有限公司 | A kind of date storage method and device |
CN104346365A (en) * | 2013-07-30 | 2015-02-11 | 阿里巴巴集团控股有限公司 | Device and method for determining specific service associated logs |
CN104346365B (en) * | 2013-07-30 | 2017-10-13 | 阿里巴巴集团控股有限公司 | It is determined that the method and apparatus of the association daily record related to specific transactions |
CN104239133A (en) * | 2014-09-26 | 2014-12-24 | 北京国双科技有限公司 | Log processing method, device and server |
CN104239133B (en) * | 2014-09-26 | 2018-03-30 | 北京国双科技有限公司 | A kind of log processing method, device and server |
CN106844169A (en) * | 2015-12-04 | 2017-06-13 | 大唐移动通信设备有限公司 | A kind of information processing method and system |
CN106844169B (en) * | 2015-12-04 | 2019-11-29 | 大唐移动通信设备有限公司 | A kind of information processing method and system |
CN111382023A (en) * | 2018-12-27 | 2020-07-07 | 中国移动通信集团贵州有限公司 | Code fault positioning method, device, equipment and storage medium |
CN111382023B (en) * | 2018-12-27 | 2023-04-28 | 中国移动通信集团贵州有限公司 | Code fault positioning method, device, equipment and storage medium |
CN110515800A (en) * | 2019-08-16 | 2019-11-29 | 北京浪潮数据技术有限公司 | A kind of processing method and processing device of operation information |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101916226A (en) | Thread information based multi-thread parallelly-executing tracking method | |
CN103345484B (en) | Report processing system and method based on dynamic domain | |
CN101339535B (en) | Method and device for monitoring application program performance | |
CN105893593B (en) | A method of data fusion | |
CN110471949A (en) | Data consanguinity analysis method, apparatus, system, server and storage medium | |
CN102456185A (en) | Distributed workflow processing method and distributed workflow engine system | |
CN101604241A (en) | A Code Generation Method for Embedded System | |
CN102467411A (en) | Workflow processing and workflow agent method, device and system | |
CN102508702B (en) | Method for processing common service logic by performing interception based on AOP (aspect-oriented programming) technology | |
CN106303064A (en) | A kind of schedule adding method, device and terminal unit | |
CN106649869A (en) | Statistical method and statistical device for big data in database | |
CN101907993A (en) | Dynamic Model Based on SpringDM and Its Application in RFID Middleware Persistence Layer | |
CN106779582A (en) | A kind of TWS flows collocation method and device | |
CN102508884A (en) | Method and device for acquiring hotpot events and real-time comments | |
CN101751332B (en) | Method, device and system for simulating process of workflow middleware | |
CN102438080A (en) | Call detail record synthesis method and device | |
CN107391272A (en) | The method and terminal of multi-process data interaction | |
CN102591714B (en) | Process calling method, system and application server | |
CN102902574A (en) | Cooperative processing method and device of multiple information flow nodes | |
CN109376137A (en) | A file processing method and device | |
CN109905253A (en) | A kind of log information acquisition method and device | |
CN109286719A (en) | Call-on back by phone method, server and storage medium | |
CN108154306A (en) | Task processing method, device, equipment and the computer readable storage medium of crowdsourcing model | |
CN102737292A (en) | Enterprise information management system | |
CN107193558B (en) | Log file generation method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20101215 |