CN101067798A - Dynamic probe method and application in embedded system thereof - Google Patents
Dynamic probe method and application in embedded system thereof Download PDFInfo
- Publication number
- CN101067798A CN101067798A CN 200710028580 CN200710028580A CN101067798A CN 101067798 A CN101067798 A CN 101067798A CN 200710028580 CN200710028580 CN 200710028580 CN 200710028580 A CN200710028580 A CN 200710028580A CN 101067798 A CN101067798 A CN 101067798A
- Authority
- CN
- China
- Prior art keywords
- probe
- dynamic
- handler
- embedded
- instruction
- 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
This invention provides a dynamic probing method and its application in an inserted system, which applies a breakpoint way to plug a probe into a being measured process when the measured process is going on and first of all determines the inserted position of the probe, then uses the probe-called instruction to replace the original one and then carries out the probe instruction, then again carries out the original one at the inserted position, which collects detailed performance information of the inserted system without any interference by applying a breakpoint method to plug a probe into a being tested process.
Description
Technical field
The invention belongs to the computing power analytical technology.Specifically, the present invention relates to a kind of dynamic probe implementation method based on the dynamic instrumentation technology, and the application of dynamic probe in embedded system, with the performance information of dynamic collection embedded system.
Technical background
Along with evolution of embedded technology, the continuous growth and the embedded system complicacy of Embedded Application improve constantly, cause the scale and the complicacy of embedded software also to improve constantly, the demand that limited hardware resource and function are more and more stronger still is the principal contradiction in embedded software developing field, and embedded software must be accomplished to simplify efficient, reliable and stable.The quality of embedded software and construction cycle final mass and the Time To Market to product plays decisive influence, this makes the exploitation of embedded software, the focus that analysis and test becomes research, and the basis of the problems referred to above is detection and collection to embedded system performance information.How to design and realize that a kind of new performance information surveys and collection method, complete and accurate is efficiently collected the performance information of embedded system and is compeled at the tip of the brow.
Classify from the angle of the collection mode of performance data, the performance data collection mode of present main flow can be divided into two big class, Sampling techniques and Detection Techniques.Wherein Detection Techniques are divided into static instrumentation technology and dynamic instrumentation technology again.
Use the Sampling techniques measure of system performance, at first need the periodic interruptions application program, obtain the value of current program counter, after accumulative total a period of time, just can obtain the precise results of relevant performance by statistical study, thereby know the focus place of program.The method of this performance measurement is very simple, does not need to increase extra instrumentation code, and the performance of system is disturbed seldom.Coverage Testing Tool gcov in the market, instruments such as performance analysis tool gprof, VTune all are the sampling instruments of system-level or user class.Sampling techniques realize simple, but have certain defective.At first, Sampling techniques are based upon on the basis of interrupt mechanism, and the incident that coarse interrupt mechanism will cause correct distribution instruction to cause causes sampling distortion; Secondly, measuring of sampling fixed, and makes sampling be confined to sampled point, only is suitable for the limited performance evaluation at a certain specific purposes; The time standard of sampling is restricted, thereby can only reflect the time that the sampling process is active, and when process switching had taken place, time keeping might be by misdescription.Sampling is regularly to carry out, and needs the timer of extra access system, and frequent use interruption, and expense is bigger.Sampling can only descriptive statistics information, and system's snapshot is provided, and can't portray interactive information between process, can not understand and the recording geometry dynamic situation.
The normally direct ad-hoc location in program source code of static instrumentation technology inserts explicit measurement code, to generate performance information.Make when obtaining performance information in this way, needs compile the source code of program again, then the source program of the new compiling of operation.In the process of performance analysis of program, the static instrumentation mode is at first added into application source code with the patch code that is used for performance evaluation, reconfigure the compiling source code then, the executable program that operation compiling afterwards generates, program run is afterwards with regard to the availability analytical information.Famous kernel prospecting tools LTT (Linux Trace Toolkit) adopts the static instrumentation technology to realize.The performance information file that the static instrumentation technology normally generates permanent preservation to be collecting performance data, and is convenient and utilize other data analysis tool to analyze.But there are some problems in the static instrumentation technology.At first, add incremental code and added code expense and executive overhead, when detection constantly needs precision, always need to recompilate and run application.And excessive for fear of expense, be not suitable for defining too much sensing point.Therefore the scope of recording events has been received restriction, and the comprehensive and detailed property of recorded information all is short of to some extent, can not the complete reaction system action.The method of static instrumentation also lacks in dirigibility to some extent, in the time of changes in demand that he surveys, need redefine exploration operation.
Different with the static instrumentation technology, do not need the source code of program is revised in advance when adopting the dynamic instrumentation mode that system performance information is gathered, do not need when writing application program to look ahead and whether will insert the dynamic instrumentation point when doing performance evaluation, i.e. writing of operation of the definition of sensing point, insertion and deletion or the like and application program source code is irrelevant fully.When carrying out performance evaluation, make by some way record need to insert the address of sensing point and to should the defined processing mode of sensing point, program source code need to do any change.Have only when tested program and call in the Installed System Memory when preparing operation, just utilize relevant technology, on-the-fly modify code, thereby reach the purpose of collection relevant information.The Dprobes technology of IBM adopts the dynamic instrumentation technology exactly, dynamically inserts software probe to collect relevant information in the module of run time version.The dynamic instrumentation technology has overcome the shortcoming of static instrumentation technology, and when still adopting dynamic instrumentation mechanism fully, activating a large amount of sensing points needs very big expense, and dynamic instrumentation mechanism is very high to the requirement of correctness, in case misuse can cause the collapse of system.
And technical for the performance evaluation of embedded system, the method collect performance data of sample mode or static instrumentation are adopted in present embedded performance evaluation mostly.
Summary of the invention
The objective of the invention is to overcome the deficiencies in the prior art, a kind of method of dynamic probe is provided, improve correctness, accuracy and the completeness of data aggregation, make it efficiently, operational objective machine platform stably.
Another object of the present invention is to provide the application of a kind of dynamic probe in embedded system.
Technical matters to be solved by this invention is that a kind of novel embedded dynamic probe of design is also efficiently realized it, and it is applied in the Embedded performance analysis tool.Main target is to realize the dynamic collection of embedded target machine performance data, satisfies embedded performance evaluation demand.
In order to realize goal of the invention one, the technical scheme of employing is as follows:
A kind of dynamic probe method adopts breakpoint mechanism that probe is inserted in the tested program when tested program is moved; The specific implementation process is at first to determine the insertion position of probe, and the place replaces original instruction with the probe call instruction in the insertion position, carries out probe instructions then, and the action of wait probe is carried out the former instruction at place, insertion position after finishing again.
In the technique scheme, described probe comprises embedded dynamic probe manager and embedded dynamic probe storehouse; Described embedded dynamic probe manager is responsible for definition, registration, inquiry, the deletion of probe, the defined probe of described embedded dynamic probe library storage.
Dynamic probe method of the present invention is based on breakpoint mechanism, and when processor was carried out break-poing instruction, it was unusual to produce breakpoint, and control authority is transferred to exception handler.Dynamic probe utilizes dynamic instruction replacement technology, replaces the instruction of the particular address that will debug with break-poing instruction, and when program was carried out break-poing instruction, it was unusual to trigger breakpoint.At this moment, can in time notify debugger, check the address that breakpoint takes place, breakpoint processing procedure of search breakpoint place correspondence or the like through the breakpoint interrupt handling routine of revising.Adopt this technology, probe will fully dynamically be inserted in the internal storage code, and writing with writing of application source code of the probe operation of definition, insertion and deletion probe is irrelevant fully.The developer who is application program does not need to consider whether will insert dynamic probe in program run in the process of coding source code fully, does not need the source code of update routine when using dynamic probe yet.
In the processor of different architecture, use different break-poing instructions.In the architecture of IA-32, adopt the INT3 break-poing instruction, in the ARM architecture, use the Break break-poing instruction.The disposal route of breakpoint can be defined by the user.Debugger is not done any code revision action, just adopts the specific method record to need probe address and the corresponding probe handling procedure that inserts.When debugged program loads into internal memory, and when preparing to carry out, the content that debugger will insert the probe address place is saved, and it is replaced to break-poing instruction.In the program run, activate when carrying out the position of breakpoint and interrupt, the interrupt handling routine that process is revised will be judged the position of breakpoint, give debugger with control authority, to carry out the probe handling procedure of probe correspondence therewith.Replace break-poing instruction with original instruction again after being finished, follow-up processing is carried out in the perhaps original instruction of Simulation execution then.Probe can repeatedly be triggered, and promptly can reuse break-poing instruction and replace when former instruction is finished.
In order to realize goal of the invention two, the technical scheme of employing is as follows:
The application of a kind of dynamic probe method in embedded system, concrete application process are when the tested program operation of embedded system, adopt breakpoint mechanism that probe is inserted into the tested program routine, collect the detailed performance information of embedded system with interference-free.
In the technique scheme, the relevant information of the detailed performance information of described collection embedded system when tested program being moved by probe survey realize.
Dynamic instrumentation thought is quoted in the application of the present invention in embedded system, the relevant information of dynamic instrumentation and collection embedded system in embedded program operation.The efficient of surveying like this with data aggregation obviously improves, and the accuracy and the completeness of data are greatly improved.
The application of dynamic probe method of the present invention in embedded system proposed some Key Implementation Technology:
1, instruction replacement technology: in order to realize probe dynamic pitching pile in program run, carry out the detection and the collection of data, the present invention takes to instruct the replacement technology to realize the insertion of dynamic probe.Insert breakpoint, monitoring contextual information, the specific data field of dump when breakpoint is triggered.When debugged program loads into internal memory, and when preparing to carry out, the content that debugger will insert the probe address place is saved, and it is replaced to break-poing instruction.In the program run, activate when carrying out the position of breakpoint and interrupt, the interrupt handling routine that process is revised is given debugger with control authority, to carry out the probe handling procedure of probe correspondence therewith with the position of judgement place breakpoint.Replace break-poing instruction with original instruction again after being finished, follow-up processing is carried out in the perhaps original instruction of Simulation execution then.
2, the plug-in mounting strategy of dynamic probe: probe pitching pile strategy is meant the position that probe is implanted.In the present invention, in order to satisfy the demand of embedded development, the task division of finishing according to probe, strategy that can probe is divided into seven types: function probe, fundamental block probe, branch's probe, assert probe, time probe, variation-tracking probe and system information traces probe.Every type probe adopts specific plug-in mounting strategy, the corresponding information of dynamic instrumentation embedded system.
3, the type of dynamic probe: in the present invention,, design 14 kinds of dynamic probe functions of two classes, in order to the various types of information of dynamic instrumentation in embedded development at the demand of embedded development.Wherein a class mainly contains for the relevant probe of application information: function pitching pile probe functions, piece pitching pile probe functions, branch's pitching pile probe functions, time pitching pile probe functions, assert pitching pile probe, character variable pitching pile probe functions, integer variable pitching pile probe functions, long variable pitching pile probe functions, floating-point variable pitching pile probe functions, double-precision floating point variable pitching pile probe functions, long double-precision floating point variable pitching pile probe functions.Another kind of for having: CPU probe, I/O probe, internal memory probe with the relevant probe of detection system information.
In the embedded dynamic probe of design, can not influence the characteristic of probe itself, comprise dynamic and carry out efficient, and will note meeting the demand of tracking; Should improve service efficiency, make things convenient for the management of probe again.The present invention is directed to following cardinal rule, design and realize embedded dynamic probe:
1, keep dynamic: the fundamental characteristics of embedded dynamic probe is a dynamic, keeps its dynamic characteristic during precondition when design.The dynamic of probe is meant the ability of placing probe in the program of operation, the insertion of probe does not need the source code of update routine, but with in the code of embedded probe insertion with the operation of loading, and the instruction that covers the probe address place, former instruction simulated execution after the probe processing finishes.If probe is not activated, then system's operation is without any change, and the performance of system is not subjected to any influence.
2, log: embedded probe is mainly used in the event log information at record particular code place according to the requirement of follow-up mechanism.Therefore, the standard dynamic probe module of definition need be bound the concrete time of probe handling procedure and record mutually, and the user does not additionally write when using, and only need provide corresponding entry address just can register insertion.
3, eliminate dependence: the probe handling procedure is designed to interrupt handling routine and equally moves.This need reduce the dependence of probe Processing Interface to system interface and resource to greatest extent, and recovers from potential fatal error easily.The placement location of probe is unrestricted, and the time that the probe handling procedure is carried out is unrestricted, if probe is placed into wrong position, this probe can be detected and be removed automatically, does not influence the normal operation of system.
Dynamic probe of the present invention can be placed on any position, comprises in tested application program and the third party application.Third party's program comprises the operating system nucleus module, dynamic shared library, application program or the like.Being provided with of probe is effectively overall, and can be used with other debugger.If the probe mode is in executable program, then probe is active in the example of all these programs; If probe is placed in the dynamic shared library, then probe is used in the process context of this shared library active at all; Even the probe in the process instance under handling debugger control all is effective.The probe that is activated resides in the authority that any zone in the virtual address space in the physical memory all has read and write to current.
The collecting method of the existing embedded performance analysis tool of contrast, the striking features of embedded dynamic probe of the present invention is that Data Dynamic is collected, and the dirigibility height, method is easy, is easy to realize.Experimental result shows that the data correctness, accuracy and the completeness that adopt embedded dynamic probe to collect are all better.
Compare with the dynamic probe Dprobes of IBM, embedded dynamic probe of the present invention has following characteristics:
At first, the Dprobes of IBM is mainly used in the detection under the stand-alone environment, and dynamic probe described in the invention is aimed at the characteristics of embedded development and Demand Design, is applicable to the specific (special) requirements of embedded cross exploitation.The source code of probe is through generating the probe binary program after the cross compile, the mode by serial ports, JTAG or network downloads on the embedded platform then, carries out the task of dynamic instrumentation on embedded platform.
Secondly, owing to probe of the present invention is implanted based on breakpoint mechanism, so the scope of application of embedded dynamic probe described in the invention is more extensive than Dprobes.The Dprobes of IBM can only be applied on the computing machine of X86 architecture, and dynamic probe of the present invention can be applied on the embedded platform of any architecture, not only comprise the X86 architecture, also comprise ARM, the architecture of MIPS and common flush bonding processors such as 51.The user of probe only need understand the corresponding break-poing instruction of embedded platform leaved for development and get final product.
Once more, embedded dynamic probe described in the invention is more flexible than Dprobes.The kind of the information that Dprobes detects is fixed, and can not change.And the embedded dynamic probe that designs among the present invention can customize dissimilar probes according to demand to collect information specific.Like this, during dynamic probe described in the present invention can be applied in the data aggregation of embedded performance analysis tool, embedded Coverage Testing Tool and surveys.
At last, the information that detects of embedded dynamic probe described in the invention is more comprehensive than Dprobes.The Dprobes of IBM generally is applied to the detection and the collection of kernel information, and embedded dynamic probe of the present invention not only can be surveyed the information of embedded system, the relevant information in the time of can also surveying the built-in application program operation.
Description of drawings
Fig. 1 is embedded dynamic probe operational process synoptic diagram;
Fig. 2 is embedded dynamic instrumentation framework EM-DDF structural drawing;
Fig. 3 is embedded probe EM-DP structure composition diagram;
Fig. 4 is embedded probe insertion process synoptic diagram;
Fig. 5 is the processing procedure synoptic diagram of embedded probe.
Embodiment
Below in conjunction with accompanying drawing, concrete enforcement of the present invention is described in further detail.
Embedded dynamic probe workflow is as shown in Figure 1: original program implementation process showed as a series of sequential instructions stream.Use probe must at first determine probe points, i.e. the position of probe insertion.Determine after the probe points, replace the original instruction in probe points place with the probe call instruction, carry out probe instructions then at the probe points place.The action of wait probe needs to carry out the former instruction at probe points place after finishing, then the instruction stream after the original application program probe points of continuation execution.
For application programs is surveyed, set up corresponding detection model and probe model.Detection model is responsible for system module and is divided " linear block " and " probe " design; The probe model is responsible for that probe initialization, relevant information are obtained, the detecting information record.
Detection model is T={M
B, P
D, wherein, T is a detection model, M
BBe program module linear block process, P
DBe the probe model.The probe model is P
D={ P
I, P
T, P
W, P wherein
IBe probe initialization procedure, P
TBe detecting probe information acquisition process, P
WBe probe acquisition of information recording process.
When program is surveyed, be each linear block at first with procedure division, for linear block statement probe variable, be probe variable initialize then; The probe initialization is carried out detecting information and is obtained, when wrong generation, and the identification of the local scene of protection, probe target localization and target type etc.; At last the probe test outcome record is got up, revise the probe variable, recover on-the-spot.
The probe variable is with matrix P
MBExpression, wherein M is the number of modules of system divides, in concrete application program system, M is the maximal value of each module event procedure and function sum; B is the maximal value of each Module Division linear block branches.
Employing dynamic instrumentation technology among the present invention is set up embedded dynamic instrumentation framework EM-DDF.The main target of EM-DDF is to obtain detailed performance data.Sensing point is set in system, the ruuning situation of program is followed the tracks of, for the developer provides performance data, to reach the target that it eliminates focus and bottleneck.Therefore EM-DDF is based on being provided with the tracking sensing point in system, the performance information during with the acquisition program run.
As shown in Figure 2: EM-DDF provides the interface of making a forcible entry into Any Application routine interference-free acquisition of information, use its Debugging message such as collecting and treating apparatus register and global data structures like a cork, the information that the instruction acquisition that the user also can utilize its execution oneself to write needs.Its core comprises dynamic probe manager DPM (Dynamic Probes Manager) and dynamic probe event handler DPEH (Dynamic Probes Event Handler).Wherein DPM is responsible for accepting the registration or the de-registration request of probe, and each probe definition is saved among the dynamic probe object DPO (Dynamic Probe Object), and DPO is the object that is used to describe probe, wherein also comprises some processing instructions.No matter when load the page or leaf that comprises probe module in internal memory, all will insert probe, reload when making maculature, probe also will insert once more; Comprise the concrete instruction that when activating probe, need carry out among the DPEH, finish the concrete response that breakpoint is interrupted.EM-DDF has designed three functions for inserting dynamic probe: pre-service function pre-handler, and it was carried out before the instruction of carrying out debugged memory address place; Aftertreatment function post-handler, it is carried out after debugged instruction is carried out; Fault processing Function e rror-handler, it is carried out when instruction makes mistakes.Dynamically write the probe module when this detection framework is followed the tracks of except support, also support embedded dynamic probe EM-DP, it is the standard probe of writing in advance according to the demand of embedded performance evaluation, can directly use.
As shown in Figure 3, embedded probe EM-DP (Embedded Dynamic Probes) is made of two parts, is respectively embedded dynamic probe manager (EDPM) and embedded dynamic probe storehouse (EDPL).
Wherein, embedded dynamic probe manager is the core of whole embedded dynamic probe, and it is responsible for any work in the probe life cycle, comprises the inquiry of probe, the definition of probe, and the deletion of probe, and carry out probe to the whole DPM that surveys mechanism and register.
The user can submit the probe register requirement to by the dynamic probe interface, it and EDPM module communication, if the probe that the user need insert has been present in the probe library, the directly registration of the DPM in dynamic instrumentation mechanism of EDPM, otherwise, just, at first generate standard probe by EDPM definition probe, and it is saved in the probe library, and then in DPM, register.
Comprise various types of embedded probes in the embedded dynamic probe storehouse, as linear block probe, branch's probe, module probe, I/O probe, time probe, synchronous mutual exclusion probe etc.These probes are created by EDPM.Each probe all includes three and handles function, is respectively X_pre_handler (), X_post_handler () and X_error_handler ().Handle function respectively before breakpoint inserts instruction for these three, afterwards and instruction carry out when makeing mistakes.Each probe all has the sign-probe identifier of its uniqueness.When probe is created, probe is not fitted into system, but return a probe identifier, and its probe identifier is preserved in the probe library, so that use in the future.Key component in the probe library is a probe registration form, has write down function name, probe identifier, probe button.onrelease and some other index information of probe correspondence in this table.But convenient like this EDPM carries out the probe inquiry and dynamic probe event handler (DPEH) is carried out concrete operation in the response breakpoint.
When using embedded dynamic probe, by the em-dprobe data structure dynamic probe is described, it has been preserved position that probe inserts, probe three and has handled function pre_handler, post_handler and error_handler, and forms registration probe chained list.Em-dprobe specifically describes as follows:
struct?em-dprobe{
struct?list_head?list;
char*addr;
char*pre_handler;
char*post_handler;
char*error_handler;
char?opcode;
char?insn[MAX_INSN_SIZE];
};
Being described as follows of each parameter wherein:
List represents the chained list that all probes of opening form;
Addr represents that probe is about to the position of inserting;
Pre_handler represents the position of the pre-service function of appointment;
Post_handler represents the position of the subsequent treatment function of appointment;
Error_handler represents the position of error handling processing function;
The instruction that opcode indicates to replace;
Insn[MAX_INSN_SIZE] the original instruction of expression.
For the requirement of matching embedded type dynamic probe manager, make things convenient for the management and the inquiry work of probe, design data structure mprobe preserves the probe that has existed.Shown in mprobe is defined as follows:
struct?mprobe{
int?p_index;
char*f_name;
int?p_flags;
char*pre_handler;
char*post_handler;
char*error_handler;
};
Being described as follows of each parameter wherein:
P_index writes down the index value of this probe in the probe concordance list;
The probe functions title of f_name record probe correspondence shows the content of the tracking incident of probe records;
Whether p_flags sign probe is self-defining;
Pre_handler represents the position of the pre-service function of appointment;
Post_handler represents the position of the subsequent treatment function of appointment;
Error_handler represents the position of error handling processing function;
Use embedded dynamic probe, when probe inserts, need judge this probe whether existed with probe library in.If then provide the address inlet just can directly register insertion; If not, generate after the new probe by EDPM, register again.Embedded probe tabulation is in charge of and is safeguarded by EDPM.Definition three function f ind_probe (), add_probe () and delete_probe () finish the action that User Defined probe and deletion User Defined probe were searched, added to existing probe respectively.
Probe pitching pile strategy is meant the position that probe is implanted.In general, probe program with the upper/lower positions pitching pile:
1, the entrance and exit place of program;
2, the entrance and exit place of fundamental block;
3, before the transfer instruction, before goto, continue, break, return language;
4, before the labelled statement, as LABLE
Concrete, for the different probe in embedded dynamic probe storehouse different pitching pile strategies is arranged.The task division of finishing according to probe, strategy that can probe is divided into seven types: function probe, fundamental block probe, branch's probe, assert probe, time probe, variation-tracking probe and system information traces probe.
The function probe: the first BOB(beginning of block) place at each function implants this probe, if function is chosen as pitching pile, then returns 1, otherwise returns 0.In addition, also be responsible for creating the data tracking file for main () function.
Fundamental block probe:, adopted statement pitching pile with fundamental block unit in order to raise the efficiency.A fundamental block pitching pile once.Can probe be triggered, and the function that depends on the fundamental block place is by pitching pile, and promptly " the function probe " of fundamental block place function returns 1, and the piece at this statement place is performed simultaneously.
Branch's probe: in the C language, branched structure is divided into if, if-else, while, do-while, several structures of for.Which kind of branched structure all contains condition criterion, and branch's probe then is that the value of conditional expression is followed the tracks of.Branch's probe is implanted when above-mentioned statement.
Assert probe: assert to show as a logical expression, assert that therefore probe only needs assert that the next statement stem that the position is set implants to be asserted as the logical expression of content.If this asserts that the statement at place is performed, assert that then probe writes 1 or 0 in the data tracking file.
The variation-tracking probe: variation-tracking has been supported the atomic type variable of all C language, is classified as 6 class data types but change on the variation-tracking probe.The implied terms that the variation-tracking probe uses is, the somewhere that variable must be after statement is tracked.The method that realizes variation-tracking is: in tracking place to implanting the variation-tracking probe functions.
Time probe:, implant the system time of time probe functions to intercept and capture in the place that indicates time tracking.
The system information traces probe: at the local implant system information trace probe that program begins, all-the-way tracking obtains system information in running program running process.
The process of inserting probe is as shown in Figure 4:
Embedded dynamic probe is registered when being called, and nullifies calling when finishing.Therefore, constructed fuction init_probe () and exit_probe ().Init_probe () function is finished register initialization, and it at first fills in the em-dprobe structure, calls register_em-dprobe () then and carries out the probe registration, and all registered probes are formed a probe chained list.Exit_probe () is the cancel register probe then.
The probe registration is mainly finished by register_em-dprobe () function.The core of this function is that em-dprobe needs to insert probe memory address place corresponding instruction with the break-poing instruction replacement, and original instruction will be saved.The function implementation is as follows: at first increase new probe node in the probe chained list; Next preserves the instruction at raw address place; Instruct replacement work with break-poing instruction; Return at last.
The cancellation work of probe is finished by unregister_em-dprobe () function, and the main work of this function is exactly deletion of node from the probe chained list.
The registration and unregistration of probe all is to need operation probe chained list, and the carrying out of therefore necessary mutual exclusion keeps the atomicity of registration and unregistration operation, in order not to make any any mistakes.
After the probe registration, registration function register_em-dprobe () uses break-poing instruction to replace original instruction, when programmed control reaches the address of breakpoint, carries out the breakpoint abnormality processing.Original breakpoint exception handler is revised by probe.At this moment, with checking whether the place, address at breakpoint exists probe, if exist, just carry out the probe preprocessor, carry out the instruction of probe interior then, carry out the probe action, carry out the probe post processor subsequently, during if make a mistake and then carry out the probe error handler; If there is no just will carry out normal breakpoint exception handler, submit daily record at last to.The probe processing procedure is as shown in Figure 5:
Wherein, the probe preprocessor is carried out by em-dprobe_pre_handler () function, and this function shielding is interrupted, and preserves the former instruction that probe inserts the address, instructs replacements then, and the pre_handler () that defines of invoke user oneself; The probe post processor is carried out by em-dprobe_post_handler () function, the post_handler () of this functional expansion user oneself definition; The probe error handler is carried out by em-dprobe_error_handler () function, and this function is responsible for the error handler error_handler () of invoke user definition.
Comprise various embedded dynamic probe in the embedded dynamic probe storehouse (EDPL), be used in the process of Embedded performance evaluation, follow the tracks of and collect different types of information.According to the information that will collect and obtain in the embedded performance evaluation process, probe is divided into two big classes, and a part is to be used for collecting with the relevant probe of application information; Another part is the probe of collection system relevant information.Concrete probe functions is as follows:
Follow the relevant probe of application information:
Function pitching pile probe functions func_probe (): the effect of this probe is a pitching pile when function is carried out, and collects the related data of function implementation status, comprises function ID, function call person and callee, the function information such as number of times, function parameter that are called.
Piece pitching pile probe functions block_probe (): the effect of this probe is a pitching pile when fundamental block is carried out, and collects the related data of fundamental block implementation status, comprises fundamental block ID, fundamental block execution number of times, the affiliated function of fundamental block etc.
The pitching pile probe functions branch_probe of branch (): the effect of this probe is to carry out pitching pile when carrying out in branch, follows the tracks of branch's implementation status.
Time pitching pile probe functions time_probe (): the effect of this probe is that program is carried out the time pitching pile, collects relevant temporal information, comprise program begin/begin the finish time, function/begin the finish time, fundamental block/finish time or the like.
Assert pitching pile probe assert_probe (): the effect of this probe is to follow the tracks of to assert the result.
Character variable pitching pile probe functions var_char_probe (): the effect of this probe is to follow the tracks of the character categorical variable.
Integer variable pitching pile probe functions var_int_probe (): the effect of this probe is the shaping variable.
Long variable pitching pile probe functions var_long_int_probe (): the effect of this probe is to follow the tracks of long shaping variable.
Floating-point variable pitching pile probe functions var_float_probe (): the effect of this probe is a variable of following the tracks of the float type.
Double-precision floating point variable pitching pile probe functions var_double_probe (): the effect of this probe is a variable of following the tracks of the double type.
Long double-precision floating point variable pitching pile probe functions var_long_double_probe (): the effect of this probe is a variable of following the tracks of the longdouble type.
Follow the relevant probe of detection system information:
CPU probe cpu_probe (): the effect of this probe is to follow the tracks of and collect the CPU relevant information;
I/O probe io_probe (): the effect of this probe is to follow the tracks of and collect the I/O relevant information;
Internal memory probe mem_probe (): the effect of this probe is to follow the tracks of and collect the internal memory relevant information.
Claims (9)
1, a kind of dynamic probe method is characterized in that adopting when tested program is moved breakpoint mechanism that probe is inserted in the tested program; The specific implementation process is at first to determine the insertion position of probe, replaces original instruction at the place, insertion position with the probe call instruction then, carries out probe instructions, and the action of wait probe is carried out the former instruction at place, insertion position after finishing again.
2, dynamic probe method according to claim 1 is characterized in that described probe comprises embedded dynamic probe manager and embedded dynamic probe storehouse; Described embedded dynamic probe manager is responsible for definition, registration, inquiry, the deletion of probe, the defined probe of described embedded dynamic probe library storage.
3, dynamic probe method according to claim 1 and 2 is characterized in that by the em-dprobe data structure described probe being described, and described em-dprobe is specific as follows:
struct?em-dprobe{
struct?list_head?list;
char?*addr;
char*pre_handler;
char*post_handler;
char*error_handler;
char?opcode;
char?insn[MAX_INSN_SIZE];
};
Wherein, list represents the formed chained list of all probes of opening; Addr represents that probe is about to the position of inserting; Pre_handler represents the position of the pre-service function of appointment; Post_handler represents the position of the subsequent treatment function of appointment; Error_handler represents the position of error handling processing function; The instruction that opcode indicates to replace; Charinsn[MAX_INSN_SIZE] the original instruction of expression.
4, dynamic probe method according to claim 3 is characterized in that adopting data structure mprobe to describe the already present probe of preserving, and described mprobe is defined as follows:
struct?mprobe{
int?p_index;
char*f_name;
int?p_flags;
char*pre_handler;
char*post_handler;
char*error_handler;
};
Wherein, p_index writes down the index value of this probe in the probe concordance list; The probe functions title of f_name record probe correspondence shows the content of the tracking incident of probe records; Whether p_flags sign probe is self-defining; Pre_handler represents the position of the pre-service function of appointment; Post_handler represents the position of the subsequent treatment function of appointment; Error_handler represents the position of error handling processing function.
5, dynamic probe method according to claim 4, the insertion position that it is characterized in that described dynamic probe comprises the entrance and exit place of program; And/or the entrance and exit place of fundamental block; And/or before the transfer instruction; And/or before the labelled statement.
6, dynamic probe method according to claim 5, it is characterized in that also obtaining detailed performance data by the dynamic probe framework, described dynamic probe framework comprises dynamic probe manager and dynamic probe event handler, described dynamic probe manager is responsible for accepting the registration or the de-registration request of probe, and the definition of each probe is saved in the dynamic probe object, described dynamic probe event handler comprises the concrete instruction that need carry out when activating probe, finish the concrete response that breakpoint is interrupted.
7, the application of a kind of dynamic probe method in embedded system is characterized in that adopting breakpoint mechanism that probe is inserted into the tested program routine when the tested program operation of embedded system, collects the detailed performance information of embedded system with interference-free.
8, the application of dynamic probe method according to claim 7 in embedded system, the detailed performance information that the it is characterized in that described collection embedded system relevant information when tested program being moved by probe survey realize.
9, according to claim 7 or 8 application of described dynamic probe method in embedded system, it is characterized in that this application process comprises:
(1) instruction replacement technology comprises and inserts breakpoint, monitoring contextual information, the specific data field of dump when breakpoint is triggered;
(2) the pitching pile strategy of dynamic probe, i.e. the dynamic probe position of inserting, described pitching pile strategy comprises function probe, fundamental block probe, branch's probe, assert probe, time probe, variation-tracking probe and system information traces probe;
(3) type of dynamic probe comprises with the relevant dynamic probe of application information, and with the relevant dynamic probe of detection system information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200710028580 CN101067798A (en) | 2007-06-14 | 2007-06-14 | Dynamic probe method and application in embedded system thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200710028580 CN101067798A (en) | 2007-06-14 | 2007-06-14 | Dynamic probe method and application in embedded system thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101067798A true CN101067798A (en) | 2007-11-07 |
Family
ID=38880360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200710028580 Pending CN101067798A (en) | 2007-06-14 | 2007-06-14 | Dynamic probe method and application in embedded system thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101067798A (en) |
Cited By (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102222015A (en) * | 2010-04-13 | 2011-10-19 | 三星电子(中国)研发中心 | System and method for detecting deadlock in multithreaded program |
CN102918508A (en) * | 2010-06-28 | 2013-02-06 | 英特尔公司 | Replaying architectural execution with a probeless trace capture |
CN103744782A (en) * | 2014-01-02 | 2014-04-23 | 北京百度网讯科技有限公司 | Method and device for acquiring program execution sequence |
CN104461521A (en) * | 2014-11-26 | 2015-03-25 | 北京航空航天大学 | Application program playback method and system |
CN105227354A (en) * | 2015-09-07 | 2016-01-06 | 浪潮软件集团有限公司 | Log-based method for monitoring and managing distributed system |
CN105786692A (en) * | 2014-12-24 | 2016-07-20 | 远光软件股份有限公司 | Analysis method of software operating period performance |
CN106155892A (en) * | 2015-04-03 | 2016-11-23 | 腾讯科技(深圳)有限公司 | Judge method and the program test equipment of Application testing coverage |
CN106250312A (en) * | 2016-07-29 | 2016-12-21 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN107491392A (en) * | 2017-08-22 | 2017-12-19 | 中国联合网络通信集团有限公司 | Application program capacity acquisition method and device |
CN107678938A (en) * | 2017-08-24 | 2018-02-09 | 阿里巴巴集团控股有限公司 | The adjustment method and equipment of a kind of application program |
CN108536514A (en) * | 2017-03-01 | 2018-09-14 | 龙芯中科技术有限公司 | A kind of recognition methods of hotspot approach and device |
CN108614704A (en) * | 2017-01-17 | 2018-10-02 | 腾讯科技(深圳)有限公司 | Code compiling method and device |
CN109815140A (en) * | 2019-01-05 | 2019-05-28 | 咪付(广西)网络技术有限公司 | A kind of automatization test system and method for the realization of embedded type C language |
CN109960627A (en) * | 2017-12-14 | 2019-07-02 | 现代自动车株式会社 | Control electronics and its operating method and computer readable recording medium |
CN110147324A (en) * | 2019-04-28 | 2019-08-20 | 北京航空航天大学 | A kind of the on-line testing equipment and on-line testing method of embedded software time response |
CN110457121A (en) * | 2019-07-26 | 2019-11-15 | 中国人民解放军军事科学院国防科技创新研究院 | A kind of detecting probe method and device for supporting User space Real-time Task Dispatch |
CN110543420A (en) * | 2019-08-30 | 2019-12-06 | 苏州浪潮智能科技有限公司 | Software testing method, system, terminal and storage medium |
CN110580220A (en) * | 2019-08-12 | 2019-12-17 | 百富计算机技术(深圳)有限公司 | method for measuring execution time of code segment and terminal equipment |
CN111104281A (en) * | 2019-11-20 | 2020-05-05 | 腾讯科技(深圳)有限公司 | Game performance monitoring method, device, system and storage medium |
CN112199261A (en) * | 2019-07-08 | 2021-01-08 | 腾讯科技(深圳)有限公司 | Application program performance analysis method and device and electronic equipment |
CN112346963A (en) * | 2019-08-09 | 2021-02-09 | 腾讯科技(深圳)有限公司 | Method and device for pile insertion testing based on AOP (automatic optical plane processing) and electronic equipment |
CN112433945A (en) * | 2020-11-26 | 2021-03-02 | 百富计算机技术(深圳)有限公司 | Method and device for dynamically tracking program and electronic equipment |
CN113360419A (en) * | 2021-08-11 | 2021-09-07 | 云智慧(北京)科技有限公司 | Application data processing method, device and equipment |
CN113918955A (en) * | 2021-09-29 | 2022-01-11 | 杭州默安科技有限公司 | Linux kernel vulnerability permission promotion detection blocking method and system |
CN115658551A (en) * | 2022-12-26 | 2023-01-31 | 海马云(天津)信息技术有限公司 | Code testing method, storage medium, electronic device and apparatus |
-
2007
- 2007-06-14 CN CN 200710028580 patent/CN101067798A/en active Pending
Cited By (37)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102222015A (en) * | 2010-04-13 | 2011-10-19 | 三星电子(中国)研发中心 | System and method for detecting deadlock in multithreaded program |
CN102222015B (en) * | 2010-04-13 | 2016-04-27 | 三星电子(中国)研发中心 | Detect the method and system of the deadlock in multithread programs |
CN102918508A (en) * | 2010-06-28 | 2013-02-06 | 英特尔公司 | Replaying architectural execution with a probeless trace capture |
CN102918508B (en) * | 2010-06-28 | 2016-02-24 | 英特尔公司 | The replay architecture of catching without probe tracking is adopted to perform |
CN103744782A (en) * | 2014-01-02 | 2014-04-23 | 北京百度网讯科技有限公司 | Method and device for acquiring program execution sequence |
CN104461521B (en) * | 2014-11-26 | 2018-11-13 | 北京航空航天大学 | A kind of application program playback method and system |
CN104461521A (en) * | 2014-11-26 | 2015-03-25 | 北京航空航天大学 | Application program playback method and system |
CN105786692A (en) * | 2014-12-24 | 2016-07-20 | 远光软件股份有限公司 | Analysis method of software operating period performance |
CN105786692B (en) * | 2014-12-24 | 2019-02-05 | 远光软件股份有限公司 | A kind of software runtime method for analyzing performance |
CN106155892A (en) * | 2015-04-03 | 2016-11-23 | 腾讯科技(深圳)有限公司 | Judge method and the program test equipment of Application testing coverage |
CN105227354A (en) * | 2015-09-07 | 2016-01-06 | 浪潮软件集团有限公司 | Log-based method for monitoring and managing distributed system |
CN106250312B (en) * | 2016-07-29 | 2019-01-08 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN106250312A (en) * | 2016-07-29 | 2016-12-21 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN108614704A (en) * | 2017-01-17 | 2018-10-02 | 腾讯科技(深圳)有限公司 | Code compiling method and device |
CN108536514A (en) * | 2017-03-01 | 2018-09-14 | 龙芯中科技术有限公司 | A kind of recognition methods of hotspot approach and device |
CN108536514B (en) * | 2017-03-01 | 2020-10-27 | 龙芯中科技术有限公司 | Hot spot method identification method and device |
CN107491392A (en) * | 2017-08-22 | 2017-12-19 | 中国联合网络通信集团有限公司 | Application program capacity acquisition method and device |
CN107678938A (en) * | 2017-08-24 | 2018-02-09 | 阿里巴巴集团控股有限公司 | The adjustment method and equipment of a kind of application program |
CN109960627A (en) * | 2017-12-14 | 2019-07-02 | 现代自动车株式会社 | Control electronics and its operating method and computer readable recording medium |
CN109960627B (en) * | 2017-12-14 | 2023-10-20 | 现代自动车株式会社 | Electronic control device, method of operating the same, and computer-readable recording medium |
CN109815140A (en) * | 2019-01-05 | 2019-05-28 | 咪付(广西)网络技术有限公司 | A kind of automatization test system and method for the realization of embedded type C language |
CN110147324A (en) * | 2019-04-28 | 2019-08-20 | 北京航空航天大学 | A kind of the on-line testing equipment and on-line testing method of embedded software time response |
CN112199261A (en) * | 2019-07-08 | 2021-01-08 | 腾讯科技(深圳)有限公司 | Application program performance analysis method and device and electronic equipment |
CN112199261B (en) * | 2019-07-08 | 2023-12-26 | 腾讯科技(深圳)有限公司 | Application program performance analysis method and device and electronic equipment |
CN110457121A (en) * | 2019-07-26 | 2019-11-15 | 中国人民解放军军事科学院国防科技创新研究院 | A kind of detecting probe method and device for supporting User space Real-time Task Dispatch |
CN112346963B (en) * | 2019-08-09 | 2024-03-22 | 腾讯科技(深圳)有限公司 | Pile inserting test method and device based on AOP and electronic equipment |
CN112346963A (en) * | 2019-08-09 | 2021-02-09 | 腾讯科技(深圳)有限公司 | Method and device for pile insertion testing based on AOP (automatic optical plane processing) and electronic equipment |
CN110580220A (en) * | 2019-08-12 | 2019-12-17 | 百富计算机技术(深圳)有限公司 | method for measuring execution time of code segment and terminal equipment |
CN110543420A (en) * | 2019-08-30 | 2019-12-06 | 苏州浪潮智能科技有限公司 | Software testing method, system, terminal and storage medium |
CN110543420B (en) * | 2019-08-30 | 2023-01-10 | 苏州浪潮智能科技有限公司 | Software testing method, system, terminal and storage medium |
CN111104281B (en) * | 2019-11-20 | 2022-07-22 | 腾讯科技(深圳)有限公司 | Game performance monitoring method, device, system and storage medium |
CN111104281A (en) * | 2019-11-20 | 2020-05-05 | 腾讯科技(深圳)有限公司 | Game performance monitoring method, device, system and storage medium |
CN112433945A (en) * | 2020-11-26 | 2021-03-02 | 百富计算机技术(深圳)有限公司 | Method and device for dynamically tracking program and electronic equipment |
CN113360419B (en) * | 2021-08-11 | 2022-06-07 | 云智慧(北京)科技有限公司 | Application data processing method, device and equipment |
CN113360419A (en) * | 2021-08-11 | 2021-09-07 | 云智慧(北京)科技有限公司 | Application data processing method, device and equipment |
CN113918955A (en) * | 2021-09-29 | 2022-01-11 | 杭州默安科技有限公司 | Linux kernel vulnerability permission promotion detection blocking method and system |
CN115658551A (en) * | 2022-12-26 | 2023-01-31 | 海马云(天津)信息技术有限公司 | Code testing method, storage medium, electronic device and apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101067798A (en) | Dynamic probe method and application in embedded system thereof | |
Della Toffola et al. | Performance problems you can fix: A dynamic analysis of memoization opportunities | |
Bhansali et al. | Framework for instruction-level tracing and analysis of program executions | |
Kasikci et al. | Failure sketching: A technique for automated root cause diagnosis of in-production failures | |
Guo et al. | Characterizing and detecting resource leaks in Android applications | |
Dufour et al. | Blended analysis for performance understanding of framework-based applications | |
Shen et al. | Cudaadvisor: Llvm-based runtime profiling for modern gpus | |
US9727436B2 (en) | Adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests | |
US10541042B2 (en) | Level-crossing memory trace inspection queries | |
CN1885275A (en) | Embedded system and real-time monitoring and processing method thereof | |
Pellegrini et al. | Autonomic state management for optimistic simulation platforms | |
CN1828544A (en) | Mechanism to exploit synchronization overhead to improve multithreaded performance | |
Arnold et al. | QVM: An efficient runtime for detecting defects in deployed systems | |
CN1282085C (en) | Method of parallel regulating multi-task of imbedding system | |
Sasongko et al. | ReuseTracker: fast yet accurate multicore reuse distance analyzer | |
Li et al. | DroidPerf: profiling memory objects on android devices | |
Zhou et al. | ValueExpert: Exploring value patterns in GPU-Accelerated applications | |
Schulz et al. | Owl: next generation system monitoring | |
Dongarra et al. | Performance instrumentation and measurement for terascale systems | |
CN100347683C (en) | Structure-irrelevant micro-processor verification and evaluation method | |
Zuo et al. | JPortal: Precise and efficient control-flow tracing for JVM programs with Intel Processor Trace | |
Tan et al. | SyzDirect: Directed Greybox Fuzzing for Linux Kernel | |
Hofer et al. | Lightweight Java profiling with partial safepoints and incremental stack tracing | |
Fiedor et al. | Advances in the ANaConDA framework for dynamic analysis and testing of concurrent C/C++ programs | |
Ruprecht et al. | Automatic feature selection in large-scale system-software product lines |
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 |