CN103631573A - Method and system for obtaining execution time of transferable functions - Google Patents

Method and system for obtaining execution time of transferable functions Download PDF

Info

Publication number
CN103631573A
CN103631573A CN201210305374.5A CN201210305374A CN103631573A CN 103631573 A CN103631573 A CN 103631573A CN 201210305374 A CN201210305374 A CN 201210305374A CN 103631573 A CN103631573 A CN 103631573A
Authority
CN
China
Prior art keywords
function
transportable
working time
node
application program
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
Application number
CN201210305374.5A
Other languages
Chinese (zh)
Other versions
CN103631573B (en
Inventor
邹同亮
刘震
袁小燕
董强
罗曼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN201210305374.5A priority Critical patent/CN103631573B/en
Publication of CN103631573A publication Critical patent/CN103631573A/en
Application granted granted Critical
Publication of CN103631573B publication Critical patent/CN103631573B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a method and system for obtaining the execution time of transferable functions. The method for obtaining the execution time of the transferable functions comprises the steps that a source code of a disassembling tool (Dexdump) is modified, so that a function call relationship of an executable program of an application program is obtained; preprocessing is conducted according to limiting conditions and the function call relationship, so that the transferable functions with the run time needing to be calculated are obtained; an run time function is loaded and calculated, so that the run time of the transferable functions is obtained. According to the method for obtaining the execution time of the transferable functions, the function call relationship in the Android executable program can be analyzed without the requirements for the application of a program source code and the modification of a dex file, so that the transferable functions capable of being transferred to a cloud side for execution are obtained according to the limiting conditions, the execution time of the transferable functions is analyzed, and compared with an existing method, the method is higher in applicability.

Description

The preparation method of transportable function timing and system
Technical field
The present invention relates in computer technology, relate in particular to a kind of preparation method and system of transportable function timing.
Background technology
With respect to other mobile device, portability and the communicativeness of mobile phone are stronger, and the network insertion of 7 * 24 hours can be provided.But be limited by the restriction of hardware, the computing power of mobile phone and storage capacity are all very limited, and cloud computing has superpower computing power and storage capacity and many advantages, if the two is combined, which part running and comparing on mobile phone that is analysis application is consuming time, part consuming time is put into high in the clouds and carries out, thereby the execution speed of quickening application program provides better user to experience.In current mobile phone operating system, Android (Android) is main flow mobile phone operating system, so two key issues of our Main Analysis Android application program: first problem is to analyze the function that meets transition condition in Android application program, be that these functions do not relate to local resource, such as user interface (UI), hardware resource etc.; Second Problem is on the basis of first problem, to analyze running and comparing function consuming time on mobile phone.
For first problem: how to analyze in Android application program which function and can move to high in the clouds and carry out? the solution of this problem be filter out those functions that relate to local resource (such as: with UI, hardware, the function that network is relevant and this locality (NATIVE) function) and directly and indirect call these relate to the function of local resource, the reason of filtering the former is the local resource that these functions need mobile phone terminal, high in the clouds cannot provide, the reason of filtering the latter is, C calls B, B calls A (A → B → C), if A function relates to local resource, B, C function also relates to local resource, so B, C function can not move to high in the clouds and carry out.To sum up head it off need to be analyzed the call relation of function in Android application program, and concrete methods of realizing is as follows:
Method 1, Android provide an instrument Dmtracedump can utilize the result of following the tracks of view (Traceview) analysis to carry out analytic function call relation, but Dmtracedump is used at present need to an object-oriented, the support of literal translation formula computer programming language python script, and it comprises all built-in functions (because Traceview has analyzed all built-in functions), meanwhile, Traceview need to change application program source code and could realize;
The use of TraceView:
Revise code (code), in the starting and ending position of needs debugging, adding the debug function of Android API (is Debug.startMethodTracing (" calc "), Debug.stopMethodTracing ()) " calc " obtains the text of Debugging message, i.e. after program operation, can under the root directory of SD, produce calc.trace file and preserve the data while moving.
Under temp catalogue calc.trace file by order adb pull/sdcard/calc.trace/tmp copy pc machine, by order traceview calc.trace, calc.trace file is analyzed.
Method 2, utilize disassemblers, the disassemblers that Android provides is at present Dexdump, and this instrument can only obtain the class of Android executable program and the relevant information of function.
In above-mentioned two kinds of methods, the first needs source code, in the situation that there is no source code, can not realize and function that the inside comprises too many, to analyzing, also can have a great impact; The second cannot obtain function calling relationship.
For Second Problem: how to analyze and can move to high in the clouds to carry out in function those functions running and comparing on mobile phone consuming time, specifically can adopt with the following method:
Method 1, Android provide one to carry analysis tool: Traceview, and it is a patterned instrument, and finally it can produce a chart, for performance evaluation is described.This instrument needs the source code of application program and need to revise source code just can complete, it can follow the tracks of whole methods, comprise built-in function, the function of bottom virtual machine operation and all functions in program, concrete modification method can be referring to the method 1 adopting for first problem.
Method 2, in the reference position of the function of application source code, add the function of acquisition, at the end position of function, also add the acquisition function of time, two functions that obtain are subtracted each other, thereby obtain the working time of function.
The object code of method 3, application programs (being executable program) carries out pitching pile, inserts the instruction of the function of above-mentioned two kinds of methods in object code.
In above-mentioned three kinds of methods, first two need to have the source code of application program, just helpless in the situation that there is no source code, and the third method, due to executable program (dex) the file inside of Android compactness very, it is all packaged in all classes (class) file of an application program in a dex file, so it is very large to realize the pitching pile difficulty of dex file.
Summary of the invention
The embodiment of the present invention provides a kind of preparation method and system of transportable function timing, and to overcome, prior art must obtain application source code or modification dex file just can obtain the defect of function calling relationship and execution time.
The embodiment of the present invention provides a kind of preparation method of transportable function timing, and the method comprises:
Disassemblers (Dexdump) source code is modified, obtain the function calling relationship of the executable program of application program;
According to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time;
Loading calculation function working time, obtains working time of described transportable function.
Preferably, described disassemblers (Dexdump) source code is modified, obtains the function calling relationship of the executable program of application program, comprising:
Executable program (.dex) File Mapping, to internal memory, is called to document analysis (dexFileParse) function it is analyzed, the result of analysis is deposited in the first data structure; According to .dex file described in described the first data structure analysis, all class data are deposited in the second data structure; Each direct function and Virtual Function in analysis classes, then obtain the function calling relationship of described executable program by instruction analysis.
Preferably, described transportable function refers to and user interface (UI), hardware resource and network incoherent non-local (NATIVE) function; And/or
Described restrictive condition comprises one or more in following condition:
Function in application program and local device have alternately;
Function in application program and input and output (IO) have alternately;
Function in application program and network have alternately; And
Function in application program is NATIVE function.
Preferably, describedly according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time, comprising:
Described function calling relationship is read in to adjacency list, and mark meets function node and father node and the ancestor node of described restrictive condition, the built-in function node that after mark is complete, from the beginning scanning mark are not labeled again; Then remove the node being labeled, the node that output is not labeled, the described node not being labeled is transportable function.
Preferably, described loading calculation function working time, obtains working time of described transportable function, comprising:
When virtual machine activation, the text that comprises described transportable function is read in Hash table; Described virtual machine loading calculation function working time, judges that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby obtain the working time of described current function.
Preferably, described virtual machine loading calculation function working time, judge that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby the working time that obtains described current function, comprising:
At described virtual machine, explain current function pop down place, add to obtain the function of function operation start time, set up oneself a chain stack, by the start time pop down of the function of described acquisition function operation start time and current function operation simultaneously; At described virtual machine, explain current function bullet stack place, add the function that obtains the function operation end time, the end time of the current function operation obtaining is done to bullet stack operation, thereby calculate the working time of described current function.
The embodiment of the present invention also provides a kind of acquisition system of transportable function timing, and this system comprises:
Static analysis module, for disassemblers (Dexdump) source code is modified, obtain the function calling relationship of the executable program of application program, according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time;
Performance analysis module, for loading calculation function working time, obtains the working time of described transportable function.
Preferably, described transportable function refers to and user interface (UI), hardware resource and network incoherent non-local (NATIVE) function; And/or
Described restrictive condition comprises one or more in following condition:
Function in application program and local device have alternately;
Function in application program and input and output (IO) have alternately;
Function in application program and network have alternately; And
Function in application program is NATIVE function.
Preferably, described static analysis module comprises:
Dis-assembling unit, for: executable program (.dex) File Mapping, to internal memory, is called to document analysis (dexFileParse) function it is analyzed, the result of analysis is deposited in the first data structure; According to .dex file described in described the first data structure analysis, all class data are deposited in the second data structure; Each direct function and Virtual Function in analysis classes, then obtain the function calling relationship of described executable program by instruction analysis;
Pretreatment module, for: described function calling relationship is read in to adjacency list, and mark meets function node and father node and the ancestor node of described restrictive condition, the built-in function node that after mark is complete, from the beginning scanning mark are not labeled again; Then remove the node being labeled, the node that output is not labeled, the described node not being labeled is transportable function.
Preferably, described performance analysis module, specifically for: when the virtual machine activation, the text that comprises described transportable function is read in Hash table; Described virtual machine loading calculation function working time, judges that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby obtain the working time of described current function.
Preferably, described performance analysis module, specifically for: at described virtual machine, explain current function pop down place, add the function that obtains the function operation start time, set up oneself a chain stack, by the start time pop down of the function of described acquisition function operation start time and current function operation simultaneously; At described virtual machine, explain current function bullet stack place, add the function that obtains the function operation end time, the end time of the current function operation obtaining is done to bullet stack operation, thereby calculate the working time of described current function.
Preferably, described system is arranged in Android (Android) mobile terminal.
The embodiment of the present invention, do not need application source code, do not need to revise dex file and can realize the analysis to function calling relationship in Android executable program yet, thereby obtain can migrate to according to restrictive condition the transportable function that carry out in high in the clouds, analyze again the execution time of these migration functions, than existing method, there is stronger applicability.
Accompanying drawing explanation
Fig. 1 is the structural representation of the acquisition system embodiment of the transportable function timing of the present invention;
Fig. 2 is the structural representation of static analysis module in Fig. 1 of the present invention;
Fig. 3 is the process flow diagram that the present invention revises Dexdump source code process;
Fig. 4 is the process flow diagram of preprocessing process of the present invention;
Fig. 5 is the process flow diagram of performance analysis process of the present invention.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, hereinafter in connection with accompanying drawing, embodiments of the invention are elaborated.It should be noted that, in the situation that not conflicting, the embodiment in the application and the feature in embodiment be combination in any mutually.
The embodiment of the present invention by analyzing Android executable program in Linux environment, obtain the function information except restrictive condition, then in Android running environment, the function of executable program is analyzed, computational analysis obtains the working time of function.
The embodiment of the present invention provides a kind of acquisition system of transportable function timing, and as shown in Figure 1, this system comprises: static analysis module 11 and performance analysis module 12; This static analysis module, for disassemblers (Dexdump) source code is modified, obtain the function calling relationship of the executable program of application program, according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time; This performance analysis module, for loading calculation function working time, obtains the working time of described transportable function.
This static analysis module is usingd Android executable program Dex file and restrictive condition CWinInetConnection names such as () function relevant to UI, hardware, network and NATIVE functions as input, analysis is met transportable function and the relevant information of condition, the output of static analysis module, as the input of performance analysis module, is analyzed the working time that obtains transportable function.
The implementation of wherein, static analysis module and dynamic module is as follows:
(1) static analysis module
This static analysis module comprises dis-assembling unit 111 and pretreatment unit two parts 112, as shown in Figure 2.In dis-assembling unit herein and traditional sense, the something in common of decompiling is that the file of analyzing is all executable program, and difference is the call relation that can obtain between function.Pretreatment unit is mainly by restrictive condition, the call relation obtaining to be processed.
Wherein, the realization of dis-assembling unit mainly (has in Android source code by analyzing the source code of Dexdump, in detail visible Android official website), Dex file layout and Dalvik operational code (opcodes), Dexdump source code is modified, obtain inputting the function calling relationship of application program executable program.
The realization of pretreatment unit is usingd the output of dis-assembling unit as input, the function that meets restrictive condition is carried out to mark, again father's node of this function and its ancestors are all carried out to mark, the built-in function node that after mark is complete, from the beginning scanning and mark are not labeled again, a labeling function itself now, this process is referred to as mark (Mark); Remove again the node being labeled, node to text that output is not labeled, this process is called removing (Sweep); Being referred to as these two processes is Mark-Sweep (this thought is mainly to use for reference the reclaim mechanism of Java GC).
(2) performance analysis module
It is different in the performance analysis that this module is carried out and traditional sense, adding calculating function working time in the source code of application program, performance analysis is herein to obtain by adding calculating function working time in the virtual machine in Android operating system (Dalvik virtual machine) source code, at Dalvik virtual machine, explain application program function pop down place, add the function that obtains function operation initial time, set up oneself a chain stack (structure of stack is as follows), by function and time pop down simultaneously; At Dalvik virtual machine, explain application program bullet stack place, add the function that obtains the function operation end time, now also do and play stack operation (stack of stack herein for oneself setting up), the working time of computing function, be recorded in Hash table.
The structure of stack is as follows:
Figure BDA00002054016800081
Above-mentioned using the output of static analysis as input, read in Hash (hash) table, the computing formula of hash code is hash=hash*31+* (FuncNameAndProtoName) ++, FuncNameAndProtoName is the character string of function name and function prototype combination, hash code can guarantee uniqueness like this, without collision detection.
Calculate the function operation time in hash table, mainly with linux system built-in function int gettimeofday (struct timeval*tv, struct timezone*tz), the chain stack that stack adopts the embodiment of the present invention to realize, analyzing source code pop down, be to find that, except principal function, other functions except current operation function itself being pressed in stack, also will be pressed into its call function in stack when pop down, in like manner, when playing stack, operation function itself and its call function all will be carried out bullet stack operation.
To be recorded in the time in hash table, when program end of run, write text, upgrade the output of static analysis module.
Be arranged in the said system of mobile terminal, do not need application source code, do not need to revise dex file and can realize the analysis to function calling relationship in Android executable program yet, thereby obtain can migrate to according to restrictive condition the transportable function that carry out in high in the clouds, analyze again the execution time of these migration functions, can effectively accelerate the execution speed of application program, improve user's experience.
The embodiment of the present invention also provides a kind of preparation method of transportable function timing, and the method comprises:
Step 1, disassemblers (Dexdump) source code is modified, obtain the function calling relationship of application program executable program;
Step 2, according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time;
Step 3, loading calculation function working time, obtain working time of described transportable function.
In above-mentioned steps one, revise the call relation that dexdump instrument source code obtains method (being function), also will obtain prototype and the access rights of affiliated class, method name and method of method simultaneously; Specific implementation as shown in Figure 3, comprises the steps:
Step 301, by .dex File Mapping to internal memory;
Step 302, call dexFileParse function it is analyzed, the result of analysis is deposited in for example DexFile data structure of the first data structure;
Wherein, Dexfile is self-defining data structure, and content comprises header information, constant pool information, type information, function and category information etc.;
Step 303, according to DexFile data structure analysis .dex file;
Step 304, all class data are deposited into the second data structure for example in DexClassData data structure;
Wherein, DexClassData is also self-defining data structure, and content comprises the information such as the header information, static fields, example domains, direct method table, empty method table of class.What direct method table was deposited is static method, private method and building method, and empty method table is deposited and put into is the empty method (function) of class;
Each direct function and Virtual Function in step 305, analysis classes, then obtain call relation by instruction analysis.
In order to verify technical scheme of the present invention, can adopt the recursive program of a matrix multiple to test, the test result that following table 1 is matrix multiple:
Table 1 call relation table
Figure BDA00002054016800101
Wherein, the class name of first row: L is that dalvik all has when resolving before class name, and a/b represents bag name, and matrix represents class name, "; " be the sign that dalvik finishes for class name, secondary series is that method name is function name, and the 3rd row are shorthands of function prototype, and I is int, L represents int[] []; In called function, the implication of relevant field is identical with call function.In table, computeMatrix is entrance function, loopCompute be carry out matrix operation pass rule function, it can call the matrix multiple computing that self completes low dimension, passs the number of times that calls of rule and the dimension that depends on matrix, and every grade is passed through computeResult amalgamation result after completing.
When decompiling, to built-in function part, can not obtain its access rights, in this case convenient processing of consolidation form is set to NULL, and self-defining function is NULL, represents that application developer does not arrange access rights to this function really.
In above-mentioned steps two, restrictive condition comprises:
In application program, function and local device are such as camera, touch etc. has alternately;
In application program, function and IO are such as waiting for that user's input etc. is relevant;
In application program, function and network interaction are relevant such as sending http request etc.;
Native function in application program.
Filtering is mainly by the class name under method, for checking the present invention, enumerates the class name that common needs filter, as shown in table 2.
The class name that the common needs of table 2 filter
java.io
java.nio.channels
android.graphics.drawable
android.hardware.usb
android.media
android.net.wifi
android.telephony
android.view
Concrete performing step as shown in Figure 4, comprising:
Step 401, call relation is read in to adjacency list;
Adjacency list form is: gauge outfit is CWinInetConnection name, method name, and access rights and marker bit (whether meeting restrictive condition), chained list is for preserving the index value of direct father's node of this function;
Step 402, deposit restrictive condition in queue;
Step 403, mark meet method and its father node (comprising its direct father node and indirect father node) of restrictive condition;
The node of step 404, signature library function (its node of a mark itself);
The gauge outfit node not being labeled, judges whether its father's node is not labeled, if be labeled, and this gauge outfit node of mark (do not allow nested move to high in the clouds carry out);
The node that step 405, deletion are labeled, i.e. output is not labeled node.
The result of being proceeded after filtration by the result of dis-assembling is table 3.
Table 3 need to be analyzed the function table of working time
Class name Method name Prototype
La/b/matrix; computeMatrix ILI
La/b/matrix; loopCompute LLLLI
La/b/matrix; computeResult IL
After dis-assembling and pre-service, the CWinInetConnection name satisfying condition, method name and prototype are outputed in a text and (are below referred to as test.txt), by this text by (adb push) write Android simulator or mobile phone /data/data/ (Activity name)/catalogue under.
In above-mentioned steps three, revise dalvik virtual machine, have increased access to the function of transportable function timing in test.txt text; Detailed process as shown in Figure 5, comprising:
Step 501, when virtual machine activation, test.txt is read in hash table;
Step 502, virtual machine loading calculation function working time;
Step 503, judge that whether current function is at hash table, if, perform step 504; Do not exist, by original execution sequence, carry out, carry out function itself;
This current function can be the function that runs to Dalvik interpreter, comprises built-in function, the function of dalvik, the arbitrary function in all functions of upper level applications;
Step 504, obtain start time of current function operation;
Step 505, move current function itself;
Step 506, obtain the end time of current function operation, thereby obtain the working time of current function.
Wherein, by analyzing virtual machine source code, the loading of application program function is mainly in~/dalvik/vm/mterp/c/gotoTarget.c, in this C file, there is a series of GOTO_TARGET function, these functions are exactly the entrance and exit of loading function, such as GOTO_TARGET (invokeVirtual, bool methodCallRange) for loading an empty method, GOTO_TARGET (invokeDirect, bool methodCallRange) for loading a direct method, bullet stack when GOTO_TARGET (returnFromMethod) returns for function is processed, the function that adds the acquisition time at this function entrance place, obtain while start time pop down, in this loading function exit, add the function of acquisition time, obtain the end time, thereby play stack the working time that obtains function, be also the implementation at analog function simultaneously when the time of acquisition.
Particularly, in the porch of GOTO_TARGET function, add and obtain the function of time, below with GOTO_TARGET (invokeDirect, bool methodCallRange) be example, at this function entrance place, add getstarttime (const Method*cur, const Method*callMethod) function, the method that cur is current execution, callMethod is the method for calling cur.In the porch of GOTO_TARGET (returnFromMethod) function, adding acquisition end time function is getendtime (const Method*cur), the method that cur is current execution.
When dalvik virtual machine end of run, hash table is write to test.txt again, i.e. the execution time of renewal function, just can judge which function need to be put into high in the clouds and carry out according to this execution time afterwards.
The preparation method of above-mentioned transportable function timing, do not need application source code, do not need to revise dex file and can realize the analysis to function calling relationship in Android executable program yet, thereby obtain can migrate to according to restrictive condition the transportable function that carry out in high in the clouds, analyze again the execution time of these migration functions, can effectively accelerate the execution speed of application program, improve user's experience.
One of ordinary skill in the art will appreciate that all or part of step in said method can come instruction related hardware to complete by program, said procedure can be stored in computer-readable recording medium, as ROM (read-only memory), disk or CD etc.Alternatively, all or part of step of above-described embodiment also can realize with one or more integrated circuit.Correspondingly, each the module/unit in above-described embodiment can adopt the form of hardware to realize, and also can adopt the form of software function module to realize.The present invention is not restricted to the combination of the hardware and software of any particular form.
Above embodiment is only unrestricted in order to technical scheme of the present invention to be described, only with reference to preferred embodiment, the present invention is had been described in detail.Those of ordinary skill in the art should be appreciated that and can modify or be equal to replacement technical scheme of the present invention, and do not depart from the spirit and scope of technical solution of the present invention, all should be encompassed in the middle of claim scope of the present invention.

Claims (12)

1. a preparation method for transportable function timing, is characterized in that, the method comprises:
Disassemblers (Dexdump) source code is modified, obtain the function calling relationship of the executable program of application program;
According to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time;
Loading calculation function working time, obtains working time of described transportable function.
2. method according to claim 1, is characterized in that:
Described disassemblers (Dexdump) source code is modified, obtains the function calling relationship of the executable program of application program, comprising:
Executable program (.dex) File Mapping, to internal memory, is called to document analysis (dexFileParse) function it is analyzed, the result of analysis is deposited in the first data structure; According to .dex file described in described the first data structure analysis, all class data are deposited in the second data structure; Each direct function and Virtual Function in analysis classes, then obtain the function calling relationship of described executable program by instruction analysis.
3. method according to claim 1, is characterized in that:
Described transportable function refers to and user interface (UI), hardware resource and network incoherent non-local (NATIVE) function; And/or
Described restrictive condition comprises one or more in following condition:
Function in application program and local device have alternately;
Function in application program and input and output (IO) have alternately;
Function in application program and network have alternately; And
Function in application program is NATIVE function.
4. method according to claim 3, is characterized in that:
Describedly according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time, comprising:
Described function calling relationship is read in to adjacency list, and mark meets function node and father node and the ancestor node of described restrictive condition, the built-in function node that after mark is complete, from the beginning scanning mark are not labeled again; Then remove the node being labeled, the node that output is not labeled, the described node not being labeled is transportable function.
5. according to the method described in the arbitrary claim of claim 1-4, it is characterized in that:
Described loading calculation function working time, obtains working time of described transportable function, comprising:
When virtual machine activation, the text that comprises described transportable function is read in Hash table; Described virtual machine loading calculation function working time, judges that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby obtain the working time of described current function.
6. method according to claim 5, is characterized in that:
Described virtual machine loading calculation function working time, judge that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby obtain the working time of described current function, comprising:
At described virtual machine, explain current function pop down place, add to obtain the function of function operation start time, set up oneself a chain stack, by the start time pop down of the function of described acquisition function operation start time and current function operation simultaneously; At described virtual machine, explain current function bullet stack place, add the function that obtains the function operation end time, the end time of the current function operation obtaining is done to bullet stack operation, thereby calculate the working time of described current function.
7. an acquisition system for transportable function timing, is characterized in that, this system comprises:
Static analysis module, for disassemblers (Dexdump) source code is modified, obtain the function calling relationship of the executable program of application program, according to restrictive condition and described function calling relationship, carry out pre-service, acquisition need to be calculated the transportable function of working time;
Performance analysis module, for loading calculation function working time, obtains the working time of described transportable function.
8. system according to claim 7, is characterized in that:
Described transportable function refers to and user interface (UI), hardware resource and network incoherent non-local (NATIVE) function; And/or
Described restrictive condition comprises one or more in following condition:
Function in application program and local device have alternately;
Function in application program and input and output (IO) have alternately;
Function in application program and network have alternately; And
Function in application program is NATIVE function.
9. system according to claim 8, is characterized in that, described static analysis module comprises:
Dis-assembling unit, for: executable program (.dex) File Mapping, to internal memory, is called to document analysis (dexFileParse) function it is analyzed, the result of analysis is deposited in the first data structure; According to .dex file described in described the first data structure analysis, all class data are deposited in the second data structure; Each direct function and Virtual Function in analysis classes, then obtain the function calling relationship of described executable program by instruction analysis;
Pretreatment module, for: described function calling relationship is read in to adjacency list, and mark meets function node and father node and the ancestor node of described restrictive condition, the built-in function node that after mark is complete, from the beginning scanning mark are not labeled again; Then remove the node being labeled, the node that output is not labeled, the described node not being labeled is transportable function.
10. according to the system described in the arbitrary claim of claim 7-9, it is characterized in that:
Described performance analysis module, specifically for: when the virtual machine activation, the text that comprises described transportable function is read in Hash table; Described virtual machine loading calculation function working time, judges that current function is whether in this Hash table, if, obtain the start time of described current function operation, move described current function, obtain the end time of described current function operation, thereby obtain the working time of described current function.
11. systems according to claim 10, is characterized in that:
Described performance analysis module, specifically for: at described virtual machine, explain current function pop down place, add to obtain the function of function operation start time, set up oneself a chain stack, by the start time pop down of the function of described acquisition function operation start time and current function operation simultaneously; At described virtual machine, explain current function bullet stack place, add the function that obtains the function operation end time, the end time of the current function operation obtaining is done to bullet stack operation, thereby calculate the working time of described current function.
12. systems according to claim 11, is characterized in that:
Described system is arranged in Android (Android) mobile terminal.
CN201210305374.5A 2012-08-24 2012-08-24 The preparation method and system of transportable function timing Active CN103631573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210305374.5A CN103631573B (en) 2012-08-24 2012-08-24 The preparation method and system of transportable function timing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210305374.5A CN103631573B (en) 2012-08-24 2012-08-24 The preparation method and system of transportable function timing

Publications (2)

Publication Number Publication Date
CN103631573A true CN103631573A (en) 2014-03-12
CN103631573B CN103631573B (en) 2017-12-08

Family

ID=50212674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210305374.5A Active CN103631573B (en) 2012-08-24 2012-08-24 The preparation method and system of transportable function timing

Country Status (1)

Country Link
CN (1) CN103631573B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045620A (en) * 2015-07-07 2015-11-11 深信服网络科技(深圳)有限公司 Method for measuring webpage first screen loading time and detection equipment
CN105786621A (en) * 2016-02-29 2016-07-20 四川理工学院 Android mobile phone application accelerating system and method based on cloud computing
CN105867930A (en) * 2016-04-05 2016-08-17 华为技术有限公司 Display method and device for function calling relation and terminal
CN108304303A (en) * 2018-01-03 2018-07-20 珠海金山网络游戏科技有限公司 A kind of method and system of the script runnability of statistics frame sync server
CN109445956A (en) * 2018-09-19 2019-03-08 北京大学 A kind of cloud towards smartwatch application-end calculating load sharing method
CN110187988A (en) * 2019-06-06 2019-08-30 中国科学技术大学 Static function calling figure construction method suitable for Virtual Function and function pointer
CN111563035A (en) * 2020-04-22 2020-08-21 腾讯科技(成都)有限公司 Test result display method, device, equipment and storage medium
CN112486563A (en) * 2020-12-02 2021-03-12 车智互联(北京)科技有限公司 Code management method, system, computing device and readable storage medium
CN112527302A (en) * 2019-09-19 2021-03-19 北京字节跳动网络技术有限公司 Error detection method and device, terminal and storage medium
CN112882912A (en) * 2021-02-01 2021-06-01 华东师范大学 Function running time measuring method applied to parallel scientific computation program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122881A (en) * 2007-09-20 2008-02-13 福建星网锐捷网络有限公司 CPU abnormal point positioning diagnosis method based MIPS structure
CN101393521A (en) * 2008-11-13 2009-03-25 上海交通大学 Extracting system for internal curing data of windows application program
CN101957760A (en) * 2010-10-21 2011-01-26 浙江工商大学 Method for measuring process execution time
CN102144222A (en) * 2008-07-02 2011-08-03 国立大学法人东京工业大学 Execution time estimation method, execution time estimation program, and execution time estimation device
CN102520984A (en) * 2011-11-29 2012-06-27 北京广利核系统工程有限公司 Computing method for worst time of object software in specified hardware environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122881A (en) * 2007-09-20 2008-02-13 福建星网锐捷网络有限公司 CPU abnormal point positioning diagnosis method based MIPS structure
CN102144222A (en) * 2008-07-02 2011-08-03 国立大学法人东京工业大学 Execution time estimation method, execution time estimation program, and execution time estimation device
CN101393521A (en) * 2008-11-13 2009-03-25 上海交通大学 Extracting system for internal curing data of windows application program
CN101957760A (en) * 2010-10-21 2011-01-26 浙江工商大学 Method for measuring process execution time
CN102520984A (en) * 2011-11-29 2012-06-27 北京广利核系统工程有限公司 Computing method for worst time of object software in specified hardware environment

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045620A (en) * 2015-07-07 2015-11-11 深信服网络科技(深圳)有限公司 Method for measuring webpage first screen loading time and detection equipment
CN105045620B (en) * 2015-07-07 2019-01-11 深信服网络科技(深圳)有限公司 Measure the method and detection device of webpage head screen load time
CN105786621A (en) * 2016-02-29 2016-07-20 四川理工学院 Android mobile phone application accelerating system and method based on cloud computing
CN105867930B (en) * 2016-04-05 2019-03-19 华为技术有限公司 A kind of display methods of function calling relationship, device and terminal
CN105867930A (en) * 2016-04-05 2016-08-17 华为技术有限公司 Display method and device for function calling relation and terminal
CN108304303A (en) * 2018-01-03 2018-07-20 珠海金山网络游戏科技有限公司 A kind of method and system of the script runnability of statistics frame sync server
CN109445956A (en) * 2018-09-19 2019-03-08 北京大学 A kind of cloud towards smartwatch application-end calculating load sharing method
CN109445956B (en) * 2018-09-19 2022-07-22 北京大学 Cloud-end computing load sharing method for smart watch application
CN110187988A (en) * 2019-06-06 2019-08-30 中国科学技术大学 Static function calling figure construction method suitable for Virtual Function and function pointer
CN112527302A (en) * 2019-09-19 2021-03-19 北京字节跳动网络技术有限公司 Error detection method and device, terminal and storage medium
CN112527302B (en) * 2019-09-19 2024-03-01 北京字节跳动网络技术有限公司 Error detection method and device, terminal and storage medium
CN111563035A (en) * 2020-04-22 2020-08-21 腾讯科技(成都)有限公司 Test result display method, device, equipment and storage medium
CN112486563A (en) * 2020-12-02 2021-03-12 车智互联(北京)科技有限公司 Code management method, system, computing device and readable storage medium
CN112882912A (en) * 2021-02-01 2021-06-01 华东师范大学 Function running time measuring method applied to parallel scientific computation program

Also Published As

Publication number Publication date
CN103631573B (en) 2017-12-08

Similar Documents

Publication Publication Date Title
CN103631573A (en) Method and system for obtaining execution time of transferable functions
JP6122493B2 (en) Adaptively portable library
Sen et al. Jalangi: A selective record-replay and dynamic analysis framework for JavaScript
US9875173B2 (en) Time travel debugging in managed runtime
US10353679B2 (en) Collecting profile data for modified global variables
CN106325970A (en) Compiling method and compiling system
EP3035191A1 (en) Identifying source code used to build executable files
CN105224370A (en) A kind of method and apparatus of loading ELF document
CN107766130B (en) Method and device for migrating virtual machine to container
Saltaformaggio et al. {DSCRETE}: Automatic rendering of forensic information from memory images via application logic reuse
US20110173594A1 (en) Selective Loading of Code Elements for Code Analysis
CN105740144A (en) Automated testing method and system for Android mobile Terminal
US20160077831A1 (en) Accurate and performant code design using memoization
CN111427782A (en) Operation method, device, equipment and storage medium of android dynamic link library
KR101478034B1 (en) Apparatus for analyzing code in contents, method thereof and computer recordable medium storing the method
US20170083298A1 (en) Resilient format for distribution of ahead-of-time compiled code components
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
Casinghino et al. Using binary analysis frameworks: The case for BAP and angr
JP5952218B2 (en) Information processing apparatus and information processing method
CN101593257B (en) System and method for protecting software based on.Net virtual machine
CN110633210A (en) File execution method and device, storage medium and electronic equipment
US11886589B2 (en) Process wrapping method for evading anti-analysis of native codes, recording medium and device for performing the method
CN113656044B (en) Android installation package compression method and device, computer equipment and storage medium
JP5464673B2 (en) Compilation support device, compilation support method, and program
Cam et al. uitXkernel: Android Kernel Forensic for Security Analysis Purposes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant