CN109947624A - Method for monitoring state and device - Google Patents

Method for monitoring state and device Download PDF

Info

Publication number
CN109947624A
CN109947624A CN201910230213.6A CN201910230213A CN109947624A CN 109947624 A CN109947624 A CN 109947624A CN 201910230213 A CN201910230213 A CN 201910230213A CN 109947624 A CN109947624 A CN 109947624A
Authority
CN
China
Prior art keywords
function
objective function
operating parameter
monitoring
objective
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
CN201910230213.6A
Other languages
Chinese (zh)
Other versions
CN109947624B (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.)
Shenzhen Tencent Information Technology Co Ltd
Original Assignee
Shenzhen Tencent Information Technology Co Ltd
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 Shenzhen Tencent Information Technology Co Ltd filed Critical Shenzhen Tencent Information Technology Co Ltd
Priority to CN201910230213.6A priority Critical patent/CN109947624B/en
Publication of CN109947624A publication Critical patent/CN109947624A/en
Application granted granted Critical
Publication of CN109947624B publication Critical patent/CN109947624B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the present application discloses a kind of method for monitoring state and device, and wherein method includes: to obtain objective function to be monitored, and obtain the corresponding calling function of the objective function;The source code of the objective function is resolved into intermediate code, and the calling function is replaced with into monitoring function;By running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained;The operating status of the objective function is determined according to the operating parameter.Using the application, the convenience for obtaining operating status operation can be improved.

Description

Method for monitoring state and device
Technical field
This application involves monitoring technology field, a kind of method for monitoring state and device have been related generally to.
Background technique
With the continuous development of information technology, service provider develops service entry usually using large-scale server cluster Mesh, to meet the diversified business demand of user.In order to guarantee service item can normal table operation, need to server set The operating status (such as: executing time, memory consumption etc.) for each function for including in each service item in group is supervised Control.In the prior art, condition monitoring is realized generally by pitching pile, i.e., stake generation is inserted into the source code of objective function Code, by the operating status for running stake Code obtaining objective function.As it can be seen that this method needs to modify code, and for large-scale item For mesh, it is difficult to realize.
Summary of the invention
The embodiment of the present application provides a kind of method for monitoring state and device, and the convenience for obtaining operating status operation can be improved Property.
In a first aspect, the embodiment of the present application provides a kind of method for monitoring state, in which:
Objective function to be monitored is obtained, and obtains the corresponding calling function of the objective function;
The source code of the objective function is resolved into intermediate code, and the calling function is replaced with into monitoring function;
By running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained;
The operating status of the objective function is determined according to the operating parameter.
Second aspect, the embodiment of the present application provide a kind of state monitoring device, comprising:
Acquiring unit, for obtaining objective function to be monitored, and the corresponding calling function of the acquisition objective function;
Resolution unit, for the source code of the objective function to be resolved to intermediate code;
Replacement unit, for the calling function to be replaced with monitoring function;
The acquiring unit is also used to by running the monitoring function, and the intermediate code for obtaining the objective function is held Operating parameter when row;
Determination unit, for determining the operating status of the objective function according to the operating parameter.
The embodiment of the present application third aspect provides another state monitoring device, and the state monitoring device includes processing Device, communication interface and memory, wherein the memory stores computer program, and the computer program includes program instruction, The processor is configured for calling described program instruction, executes method described in first aspect.
The embodiment of the present application fourth aspect provides a kind of computer readable storage medium, the computer readable storage medium It is stored with computer program, the computer program includes program instruction, and described program instruction is worked as to be executed by state monitoring device When so that the state monitoring device is executed method described in first aspect.
Using the embodiment of the present application, the corresponding calling function of objective function and the objective function to be monitored is obtained, so The source code of the objective function is resolved into intermediate code afterwards, and the calling function is replaced with into monitoring function, it should by operation Function is monitored, the operating parameter that the intermediate code of the objective function is performed is obtained, the mesh is then determined according to the operating parameter The operating status of scalar functions.As it can be seen that the calling function of objective function is replaced with monitoring function to realize condition monitoring, without repairing Change source code, improve the convenience for obtaining operating status operation, while the accuracy for obtaining operating status can be improved.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is the network architecture schematic diagram using the embodiment of the present application;
Fig. 2 is a kind of flow diagram of method for monitoring state provided by the embodiments of the present application;
Fig. 3 is the histogram between a kind of function provided by the embodiments of the present application and system execution time;
Fig. 4 is a kind of schematic diagram of function execution sequence provided by the embodiments of the present application;
Fig. 5 is the flow diagram of another method for monitoring state provided by the embodiments of the present application;
Fig. 6 is the flow diagram of another method for monitoring state provided by the embodiments of the present application;
Fig. 7 is a kind of logical construction schematic diagram of state monitoring device provided by the embodiments of the present application;
Fig. 8 is a kind of entity structure schematic diagram of state monitoring device provided by the embodiments of the present application.
Specific embodiment
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall in the protection scope of this application.
The description and claims of this application and term " first " in above-mentioned attached drawing, " second " etc. are for distinguishing Different objects, are not use to describe a particular order.In addition, term " includes " and " having " and their any deformations, it is intended that It is to cover and non-exclusive includes.Such as the process, method, system, product or equipment for containing a series of steps or units do not have It is defined in listed step or unit, but optionally further comprising the step of not listing or unit, or optionally also wrap Include other step or units intrinsic for these process, methods, product or equipment.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments It is contained at least one embodiment of the application.Each position in the description occur the phrase might not each mean it is identical Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and Implicitly understand, embodiment described herein can be combined with other embodiments.
Referring to Figure 1, Fig. 1 is the network architecture schematic diagram using the embodiment of the present application.The network architecture schematic diagram includes Server 101, user terminal 102 and user 103.It should be noted that each in network architecture schematic diagram shown in FIG. 1 sets Standby quantity and form does not constitute the restriction to the embodiment of the present application for illustrating.
Wherein, user terminal 102 can be personal computer shown in FIG. 1 (personal computer, PC), notes This computer or smart phone can also be all-in-one machine, palm PC, tablet computer (pad), smart television playback terminal, vehicle-mounted The electronic equipments such as terminal or portable devices.PC end user terminal, such as all-in-one machine etc., operating system may include but unlimited In linux system, Unix system, Windows serial system (such as Windows xp, 7 Windows etc.), Mac OS system X Operating systems such as (operating systems of Apple Computers).Mobile end user terminal, such as smart phone etc., operating system can wrap Include but be not limited to the operating systems such as Android system, IOS (operating system of iPhone), Window system.
Server 101 is similar with general computer architecture, including processor, hard disk, memory, system bus etc., is used for Service is provided for user terminal 102.The server 101 can run on individual equipment, can also run on multiple servers The server cluster of composition, it is not limited here.
User 103 can be the user of practical operation user terminal 102, be also possible to developer.User 103 can be right User terminal 102 is input operation instruction, and is correspondingly operated with controlling the execution of user terminal 102.
Application program can be installed and be run to user terminal 102 in the embodiment of the present application, and server 101 can be user The corresponding server of the application program that terminal 102 is installed, provides application service for application program.Wherein, which can To be the application of the support network service such as page browsing application, instant messaging application, game application, it is not limited here.
Such as: in the scene of page browsing application, user 103 runs the page browsing application in user terminal 102, And the browse request of target network address is submitted to page browsing application, then server-side 101 responds the browse request, so that user is whole The corresponding displayed page of the browse request is shown in end 102.
In view of the existing drawback of current state monitoring, the embodiment of the present application provide a kind of method for monitoring state, device and The convenience for obtaining operating status operation can be improved in storage medium.
The state monitoring device of the embodiment of the present application can be the application program on user terminal, for user terminal journey The operating status of each function in sequence is monitored;The application program being also possible on server, for serve end program The operating status of each function is monitored.The application subsequent embodiment is carried out with the operating status of each function to serve end program It is illustrated for monitoring.The serve end program refers to be run in server, provides the program of service to user terminal by interface.
The detailed process of method for monitoring state provided by the embodiments of the present application is further illustrated below.
Referring to Fig. 2, Fig. 2 is a kind of flow diagram of method for monitoring state disclosed in the embodiment of the present application.Such as Fig. 2 institute Show, this method may include step S201~S204.Wherein:
S201: obtaining objective function to be monitored, and obtains the corresponding calling function of the objective function.
In the embodiment of the present application, objective function is any custom function in any serve end program to be monitored. Wherein, custom function refers to that server operator or server program producer are more customized for serve end program The function of calling, these custom function are commonly used in some application programming interface (Application of execution Programming Interface, API) it is unable to complete function, such as semaphore receiver function.These custom function also have There is specified interface IP address, corresponding custom function can be called by these specified interface IP addresses.
Wherein, API refer in server system carry some functions predetermined, such as under Linux system when Between obtain API, including time and gettimeofday etc..API is common function, and usually major part serve end program reads text The operation of part, acquisition time, the acquisition network information etc. is completed by calling API.These API have fixed interface Address can call corresponding API by these interface IP addresses.
In the operational process of program, custom function can be called, and function call is multiple, and being used to execution every time should be certainly Defined function calls function can be identical every time, can also be different.In the embodiment of the present application, if operational objective function, is first transported The calling function of the row objective function, then the objective function is executed by the calling function.
Objective function calls function including at least the function name of the objective function, by C language (in terms of a procedure-oriented Calculation machine programming language) for, if the form of objective function be int z=max (x, y), the entitled z of the function of the objective function, The form of the calling function of the objective function can be int b=z (3,2), i.e., by function call objective function, and will Integer 3 has been assigned to b.
It is appreciated that the function for including in all serve end programs can refer to the progress of method provided by the present embodiment Condition monitoring determines that time-consuming is more in the serve end program, EMS memory occupation amount is larger and function there may be loophole with this, from And convenient for improving the performance of server-side.
S202: the source code of the objective function is resolved into intermediate code, and the calling function is replaced with into monitoring function.
In the embodiment of the present application, it is the source program that objective function is write that the source code of objective function, which is programmer, i.e., According to certain programming language specification writing, human-readable text file.
Since serve end program is realized usually using server-side programming language, and server-side programming language is explanation type Programming language, the implementation procedure for explanation type programming language are that objective function is first resolved to computer-readable binary system Code, then execute the binary code.In the embodiment of the present application, intermediate code be parse the objective function source code obtain two Ary codes.
In the embodiment of the present application, monitoring function is for obtaining the operating parameter that the intermediate code of objective function is performed. Using the corresponding calling function of objective function as monitoring function, then without modification source code, setting monitoring function behaviour is improved The convenience of work.And after function will be called to replace with monitoring function, the monitoring function of the objective function is first run, is being run During the monitoring function, call the calling function to execute the intermediate code, thus the execution of the intermediate code to objective function Operating parameter in the process is monitored, and improves the accuracy for obtaining operating parameter.
S203: by running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained.
In the embodiment of the present application, the operating parameter that the intermediate code of objective function is performed may include that system executes in this Between at the beginning of code and deadline, central processing unit (Central Processing Unit, CPU) execute the intermediate code At the beginning of and deadline, graphics processor (Graphics Processing Unit, GPU) execute opening for the intermediate code Time and deadline, the system of beginning execute the intermediate code during free memory size or executed using memory size, CPU Remaining CPU during remaining cpu resource or occupancy cpu resource, GPU during the intermediate code execute the intermediate code is provided Source or occupancy cpu resource etc..If server further includes middleware, which may also include middleware and executes the intermediate code Middleware response speed etc..If server further includes database, which may also include database and executes the intermediate code Database response speed etc., it is not limited here.
Above-mentioned middleware is a kind of independent system software or service routine, positioned at the operation of user terminal/server On system.Middleware include one group of service, in order to operate in multiple softwares on one or more machine by network into Row interaction.
It should be noted that run the monitoring function obtain objective function the operating parameter that is performed of intermediate code it Afterwards, the monitoring function can be terminated, to avoid the objective function is monitored always, convenient for improving the performance of server-side.And terminate the prison After controlling function, when calling the objective function next time, using calling function next time as monitoring function, acquisition fortune is improved The accuracy of row parameter.
S204: the operating status of the objective function is determined according to the operating parameter.
In the embodiment of the present application, operating status may include that system executes the intermediate code corresponding execution time, CPU is executed Intermediate code corresponding execution time, GPU execute intermediate code corresponding execution time, EMS memory occupation, memory peak value, CPU usage, GPU utilization rate etc..
The application for determine operating status method without limitation, for example, system execute the time can be executed by the system this Difference between the deadline and time started of intermediate code obtains.For another example when EMS memory occupation can be executed by the system completion Using memory size and obtaining when starting using the difference between memory size is executed, or according to the residue in implementation procedure Memory size is obtained using the average value between memory size.In another example memory peak value can be by according to surplus in implementation procedure Remaining memory size uses the maximum value acquisition etc. between memory size.
In method for monitoring state as shown in Figure 2, by obtaining objective function and the objective function pair to be monitored The source code of the objective function is resolved to intermediate code, and the calling function is replaced with monitoring function by the calling function answered. By running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained, it is true according to the operating parameter The calling function of objective function, can be replaced with monitoring function to realize condition monitoring by the operating status of the fixed objective function, It is not necessary to modify source codes, to improve the convenience for obtaining operating status operation, improve the accuracy for obtaining operating status.
It, will after determining the operating status of the objective function according to the operating parameter in a kind of possible embodiment The operating status of the objective function is added in log.
Wherein, log includes at least the operating status and the operating status of other functions and relatively time-consuming of the objective function Function, EMS memory occupation amount be larger and mark information there may be functions such as loopholes.The log can be to scheme or the shape of table Formula embodies, it is not limited here.
Other functions are any customized letter in the corresponding serve end program of objective function other than the objective function Number.The method for obtaining the operating status of objective function can refer to for the method for obtaining the operating status of other functions, herein not It repeats again.
It is appreciated that the operating status of the objective function is added to after monitoring the operating status of objective function In log, production environment problem can be analyzed convenient for programmer, so that search performance bottleneck, optimizes program.
Further, the operating status of each function in the log is analyzed, is determined of problems in each function Problem function;The problem function is labeled.
Wherein, problem function can be that relatively time-consuming function, EMS memory occupation amount are larger, there are functions of loophole etc., herein Without limitation.
In the embodiment of the present application, the method for determining problem function may include following three kinds of embodiments.
The first embodiment compares the value of the operating parameter of each function in log, the value of operating parameter is selected to be greater than The function of first threshold is determined as problem function.
Wherein, it can refer to the method for obtaining the operating parameter of objective function for obtaining the operating parameter of each function, then it is right The dimension for the operating parameter answered is also consistent, can determine operating parameter range in the dimension by comparing the corresponding value of every dimension. In this embodiment, the value of operating parameter without limitation, is greater than the function of first threshold as problem function by first threshold, from And it can the biggish function of operating parameter in each dimension of mark.
Assuming that objective function is first function, other functions are second function, third function, the 4th function, the 5th function With the 6th function, it is illustrated with the system execution time in operating parameter, referring to figure 3..Wherein, first function is It is 135.5ms that system, which executes time-consuming, and it is 111.3ms that the system of second function, which executes time-consuming, and the system of third function executes time-consuming and is 37.1ms, it is 19.1ms that the system of the 4th function, which executes time-consuming, and it is 6.3ms, the 6th function that the system of the 5th function, which executes time-consuming, System to execute time-consuming be 6.3ms.Assuming that first threshold is 50ms, then first function, second function are problem function.
Second of embodiment obtains the evaluation of estimate of each function according to the value of the operating parameter of each function in log, choosing The function that evaluation of estimate is selected greater than second threshold is determined as problem function.
In this embodiment, the corresponding evaluation score value of operating parameter that each dimension can be obtained respectively, further according to each dimension The corresponding evaluation score value of operating parameter and preset weights obtain the evaluation of estimate of each function.In this way, big by selection evaluation of estimate In second threshold function as problem function, it is contemplated that influence of multiple dimensions for function operation, improve determine problem letter Several accuracys.
Assuming that objective function be function 1, other functions be function 2 and function 3, using operating status be system execution the time, CPU executes time, EMS memory occupation and memory peak value and is illustrated, and please refers to the following table 1.Wherein, when the system of function 1 executes Between be 85.1ms, CPU execute the time be 82.2ms, EMS memory occupation 2.4MB, memory peak value be 4.2MB;The system of function 2 is held The row time is 102.3ms, and CPU executes the time as 99.9ms, and EMS memory occupation 2.5MB, memory peak value is 4.2MB;Function 3 is System executes the time as 276.3ms, and CPU executes the time as 85.1ms, and EMS memory occupation 2.6MB, memory peak value is 4.3MB.
Assuming that system is executed the evaluation score value of the execution time in the time greater than 100ms as 1;CPU is executed into the time In with system execute time phase difference 10ms evaluation score value as 1;Again by memory consumption and evaluation of the memory peak value less than 0.5 point Value is used as 1.Wherein, system executes the time, CPU executes time and memory consumption and the corresponding preset weights of memory peak value are 0.5,0.3 and 0.2, then the evaluation of estimate of function 1 is 0.2, and the evaluation of estimate of function 2 is 0.7, and the evaluation of estimate of function 3 is 1.If second Threshold value is 0.5, it is determined that problem function is function 2 and function 3.
Table 1
The third embodiment, operating parameter include that system executes the time, and system in each function of log is executed the time Greater than third threshold value function as reference function, determine at least one correlation function for influencing reference function operation, according to The value of the operating parameter of each correlation function determines problem function.
Wherein, without limitation, the system of reference function executes the time greater than third threshold value to third threshold value.
Correlation function is the function for influencing reference function operation.For example, as shown in figure 4, first carry out first function, then execute Second function, third function, the 4th function finally execute the 5th function.If reference function is third function, correlation function is First function and second function.
It is appreciated that function is the minimum unit of programming language, numerous function is by mutually calling one service of composition Hold program.In this embodiment, reference function is first determined according to the system execution time, then determines what influence reference function executed At least one correlation function, then the operating parameter by analyzing a correlation function determine the problems in serve end program function. In this way, improving the accuracy for the function that searches problem by the call relation quick positioning question function between function.
It should be noted that above-mentioned three kinds of embodiments do not constitute the restriction to the embodiment of the present application, in practical application, Problem function can also be determined using other embodiments.
The application for problem function mask method without limitation, can be iris out problem function or using enhancing The method of display problem function.
It is appreciated that after the operating status for analyzing each function, it may be determined that the problems in each function function, and carry out Mark, in this way, programmer directly can analyze production environment problem according to markup information, so that search performance bottleneck, optimizes program.
Referring to Fig. 5, Fig. 5 is the flow diagram of another kind method for monitoring state disclosed in the embodiment of the present application.Such as Fig. 5 Shown, this method may include step S501~S506.Wherein:
S501, objective function to be monitored is obtained, and obtains the corresponding calling function of the objective function.
Wherein, step S501 can refer to the description of step S201, and details are not described herein.
S502, interpreter is obtained according to the source code type of the objective function.
S503, the source code of the objective function is parsed using the interpreter to obtain the centre of the objective function Code.
In the embodiment of the present application, source code type writes language for objective function.The source code type can wrap It includes: Ruby, JavaScript, HyperText Preprocessor (Hypertext Preprocessor, PHP), list preprocessor (List Preprocessor, LISP), Perl, R, the explanation types programming language such as Python.
It is appreciated that different programming languages has the characteristics that its is different, there is also certain differences for syntax rule, such as: JavaScript is a kind of literal translation formula scripting language;And PHP is a kind of general open source scripting language.And in JavaScript, It is true that empty object and empty array, which are converted to boolean value, but is converted to boolean value in the hollow object sky array of PHP and is false.Therefore, analysis syntactic structure can be write according to source code, to identify the original of the source code of objective function Type of code.
In the embodiment of the present application, interpreter is the tool for parsing the source code of objective function.It is appreciated that not There is also certain differences for resolution rules corresponding to same programming language, therefore, obtain interpreter according to the source code type, The accuracy of parsing source code can be improved.Such as: if the source code type of objective function is PHP type, i.e. objective function Source code PHP interpreter can be first passed through then corresponding interpreter is then PHP interpreter using PHP language compilation Objective function is resolved into intermediate code;The binary code is executed again.
It is appreciated that first obtaining interpreter according to the source code type of the objective function, then using the interpreter to this The source code of objective function is parsed to obtain the intermediate code of the objective function.In this way, the accurate of parsing intermediate code can be improved Property.
S504, call the application programming interface of the interpreter that the calling function is replaced with monitoring function.
In the embodiment of the present application, interpreter is to be obtained according to source code type, and the API of interpreter includes original The corresponding basic function of type of code then necessarily includes the corresponding calling function of objective function.It is appreciated that by calling the solution The calling function is replaced with the monitoring function by the API for releasing device, and it is not necessary to modify source codes, improves replacement monitoring function Accuracy.For different types of source code, the API of the corresponding interpreter of source code can be called, function will be called to replace It is changed to monitoring function.
S505, pass through the operation monitoring function, obtain the operating parameter that the intermediate code of the objective function is performed.
S506, the operating status that the objective function is determined according to the operating parameter.
Wherein, step S505-S506 can refer to the description of step S203-S204, and details are not described herein.
In method for monitoring state as shown in Figure 5, it is corresponding to obtain objective function and the objective function to be monitored Function is called, the interpreter obtained by the source code type of the objective function carries out the source code of the objective function Parsing obtains the intermediate code of the objective function, and the accuracy of parsing intermediate code can be improved.Recall the application program of the interpreter The calling function is replaced with monitoring function by programming interface, by running the monitoring function, obtains the intermediate code of the objective function The operating parameter being performed determines the operating status of the objective function.As it can be seen that the calling function of objective function is replaced with prison Function is controlled to realize condition monitoring, it is not necessary to modify source code, improves the convenience for obtaining operating status operation, while can mention Height obtains the accuracy of operating status.
Referring to Fig. 6, Fig. 6 is the flow diagram of another method for monitoring state disclosed in the embodiment of the present application.Such as Fig. 6 Shown, this method may include step S601~607.Wherein:
S601, objective function to be monitored is obtained, and obtains the corresponding calling function of the objective function.
S602, the source code of the objective function is resolved to intermediate code, and the calling function is replaced with into monitoring function.
Wherein, step S601-S602 can refer to the description of step S201-S202, and details are not described herein.
S603, when bringing into operation the monitoring function, obtain the first operating parameter.
S604, during running the monitoring function, call the intermediate code of the calling function to execute the objective function.
S605, when the objective function intermediate code execute complete when, obtain the second operating parameter.
In the embodiment of the present application, the first operating parameter is the operating parameter monitored when function operation starts.Due to the mesh The monitoring function of scalar functions is the calling function of objective function, then without modification source code, operational efficiency is high, can be ignored and calls The time for monitoring function executes operating parameter when starting using the first operating parameter as the intermediate code of objective function.
Second operating parameter is that the intermediate code of objective function executes operating parameter when completing.That is, the first operation Parameter and the second operating parameter can execute the operating parameter of front and back respectively as the intermediate code of objective function.
It is appreciated that first running the monitoring function, and bringing into operation after function will be called to replace with monitoring function When the monitoring function, the first operating parameter is obtained.During running the monitoring function, call the calling function to execute this The intermediate code of objective function.When the intermediate code of the objective function executes completion, the second operating parameter is obtained, thus to target letter Operating parameter in the implementation procedure of several intermediate codes is monitored.Since the monitoring function of the objective function is objective function Function is called, then without modification source code, the efficiency and standard for obtaining the first operating parameter and the second operating parameter can be improved True property.
S606, difference between second operating parameter and first operating parameter is obtained.
S607, the operating status that the objective function is determined according to the difference.
As previously mentioned, the first operating parameter and the second operating parameter are respectively that the intermediate code of objective function executes the fortune of front and back Row parameter, then by obtaining the difference between the second operating parameter and the first operating parameter, it may be determined that intermediate code is transported during executing Variation between row parameter, that is, determine the operating status of objective function.
For example, the first operating parameter is at the beginning of system executes intermediate code, the second operating parameter is during system executes Between code deadline, then system can be obtained according to the difference between the deadline and the time started and execute intermediate code and held The row time.Again for example: the first operating parameter is the first remaining cpu resource when CPU executes intermediate code, and the second operating parameter is CPU executes the second remaining cpu resource of intermediate code, then according to the difference between the second remaining cpu resource and the first remaining cpu resource Value, which can obtain, executes the occupied cpu resource of intermediate code.
In method for monitoring state as shown in FIG. 6, by obtaining objective function and the objective function pair to be monitored The source code of the objective function is resolved to intermediate code, and the calling function is replaced with monitoring function by the calling function answered. Due to the calling function that monitoring function is objective function, then without modification source code, setting monitoring function operation is improved Convenience, while improving the accuracy of replacement monitoring function.Then, by running the monitoring function, acquisition brings into operation this The intermediate code of the first operating parameter and the objective function when monitoring function executes the second operating parameter completed.Finally, logical The difference crossed between second operating parameter and first operating parameter determines the operating status of the objective function.In this way, passing through It calls the monitoring function to obtain the operating parameter of the intermediate code execution front and back of objective function, improves the efficiency for obtaining operating status And accuracy.
It is above-mentioned to illustrate the method for the embodiment of the present application, the device of the embodiment of the present application is provided below.
Fig. 7 is please referred to, Fig. 7 is a kind of logical construction schematic diagram of state monitoring device provided by the embodiments of the present application, such as Shown in Fig. 7, above-mentioned state monitoring device 700 includes:
Acquiring unit 701, for obtaining objective function to be monitored, and the corresponding calling letter of the acquisition objective function Number;
Resolution unit 702, for the source code of the objective function to be resolved to intermediate code;
Replacement unit 703, for the calling function to be replaced with monitoring function;
The acquiring unit 701 is also used to obtain the intermediate code quilt of the objective function by running the monitoring function Operating parameter when execution;
Determination unit 704, for determining the operating status of the objective function according to the operating parameter.
In a possible example, the resolution unit 702, specifically for the source code according to the objective function Type obtains interpreter;The source code of the objective function is parsed using the interpreter to obtain the objective function Intermediate code.
In a possible example, the replacement unit 703, specifically for calling the application program of the interpreter to compile The calling function is replaced with the monitoring function by journey interface.
In a possible example, the operating parameter includes the first operating parameter and the second operating parameter;It is described to obtain Unit 701 is taken, specifically for obtaining first operating parameter when bringing into operation the monitoring function;Running the prison During controlling function, the calling function is called to execute the intermediate code of the objective function;To in the objective function Between code execute when completing, obtain second operating parameter.
In a possible example, the determination unit 704 is specifically used for obtaining second operating parameter and described Difference between first operating parameter;The operating status of the objective function is determined according to the difference.
In a possible example, described device 700 further include:
Adding unit 705, for the operating status of the objective function to be added in log.
It further include the operating status of other functions in a possible example, in the log;Described device 700 is also wrapped It includes:
Analytical unit 706 is analyzed for the operating status to each function in the log, is determined in the log Problem function of problems;
Unit 707 is marked, for being labeled to described problem function.
In a possible example, the analytical unit 706, specifically for the fortune of each function in the log The value of row parameter;The function that the value of selection operating parameter is greater than first threshold is determined as problem letter of problems in the log Number;Alternatively, obtaining the evaluation of estimate of each function according to the value of the operating parameter of each function in the log;Select evaluation of estimate It is determined as problem function of problems in the log greater than the function of second threshold.
The function of state monitoring device in preceding method embodiment may be implemented in the state monitoring device, condition monitoring dress Setting each unit execution detailed process may refer to the execution step of state monitoring device in preceding method embodiment, herein not It is repeating.
Fig. 8 is please referred to, Fig. 8 is a kind of entity structure schematic diagram of state monitoring device provided by the embodiments of the present application, should State monitoring device 800 includes processor 801, communication interface 802 and memory 803.It processor 801, communication interface 802 and deposits Reservoir 803 can be connected with each other by bus 804, can also be connected otherwise.Acquiring unit 701 shown in Fig. 7, The correlation function that resolution unit 702, replacement unit 703, determination unit 704, analytical unit 706 and mark unit 707 are realized It can be realized by one or more processors 801.The correlation function that adding unit 705 shown in Fig. 7 is realized can lead to Memory 803 is crossed to realize.
Wherein, processor 801 include be one or more processors, for example including one or more central processing units, In the case that processor 801 is a CPU, which can be monokaryon CPU, be also possible to multi-core CPU.It applies in the application reality It applies in example, processor 801 realizes Fig. 2, Fig. 5 and embodiment shown in fig. 6 for state of a control monitoring device.
Communication interface 802 is for realizing the communication between other equipment, for example, if state monitoring device 800 is user Terminal, then the communication interface 802 can realize the communication between the equipment such as user terminal and server;If state monitoring device 800 For server, then the communication interface 802 can realize the communication between the equipment such as server and user terminal.
Memory 803 include but is not limited to be random access memory (random access memory, RAM), it is read-only Memory (read-only memory, ROM), Erasable Programmable Read Only Memory EPROM (erasable programmable Read only memory, EPROM) or portable read-only memory (compact disc read-only memory, CD- ROM), the memory 803 is for storing dependent instruction and data.
In the embodiment of the present application, the memory 803 stores computer program, and the computer program includes that program refers to It enables, the processor 801 is configured for calling described program instruction, and above procedure includes the finger for executing following steps It enables:
Objective function to be monitored is obtained, and obtains the corresponding calling function of the objective function;
The source code of the objective function is resolved into intermediate code, and the calling function is replaced with into monitoring function;
By running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained;
The operating status of the objective function is determined according to the operating parameter.
Using above-described embodiment, the calling function of objective function is replaced with into monitoring function to realize condition monitoring, is not necessarily to Source code is modified, the convenience for obtaining operating status operation is improved, while the accuracy for obtaining operating status can be improved.
In a possible example, in terms of the source code by the objective function resolves to intermediate code, institute The instruction in program is stated to be specifically used for executing following operation:
Interpreter is obtained according to the source code type of the objective function;
The source code of the objective function is parsed using the interpreter to obtain the centre of the objective function Code.
In a possible example, it is described the calling function is replaced with to monitoring function in terms of, in described program Instruction be specifically used for executing following operation:
Call the application programming interface of the interpreter that the calling function is replaced with the monitoring function.
In a possible example, the operating parameter includes the first operating parameter and the second operating parameter;Described By running the monitoring function, the operating parameter aspect that the intermediate code of the objective function is performed, described program are obtained In instruction be specifically used for executing following operation:
When bringing into operation the monitoring function, first operating parameter is obtained;
During running the monitoring function, the calling function is called to execute the centre of the objective function Code;
When the intermediate code of the objective function executes completion, second operating parameter is obtained.
In a possible example, in the operating status side for determining the objective function according to the operating parameter Face, the instruction in described program are specifically used for executing following operation:
Obtain the difference between second operating parameter and first operating parameter;
The operating status of the objective function is determined according to the difference.
In a possible example, it is described according to the operating parameter determine the objective function operating status it Afterwards, the instruction in described program is also used to execute following operation:
The operating status of the objective function is added in log.
It further include the operating status of other functions in a possible example, in the log;Finger in described program Order is also used to execute following operation:
The operating status of each function in the log is analyzed, determines problem letter of problems in the log Number;
Described problem function is labeled.
It in a possible example, analyzes, determines in the operating status to each function in the log In the log in terms of problem function of problems, the instruction in described program is specifically used for executing following operation:
Compare the value of the operating parameter of each function in the log;
The function that the value of selection operating parameter is greater than first threshold is determined as problem function of problems in the log;
Alternatively, obtaining the evaluation of estimate of each function according to the value of the operating parameter of each function in the log;
The function that selection evaluation of estimate is greater than second threshold is determined as problem function of problems in the log.
The embodiment of the present application also provides a kind of computer readable storage medium, which has meter Calculation machine program, the computer program include program instruction, which makes condition monitoring when being executed by state monitoring device Device executes above method embodiment.
It should be noted that for simple description, therefore, it is stated as a systems for each embodiment of the method above-mentioned The combination of actions of column, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described, because For according to the present invention, certain some step can be performed in other orders or simultaneously.Secondly, those skilled in the art also should Know, the embodiments described in the specification are all preferred embodiments, related actions and modules not necessarily this hair Necessary to bright.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in some embodiment Part, reference can be made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can store in a computer-readable memory, memory It may include: flash disk, ROM, RAM, disk or CD etc..
The embodiment of the present application is described in detail above, specific case used herein to the principle of the application and Embodiment is expounded, the description of the example is only used to help understand the method for the present application and its core ideas; At the same time, for those skilled in the art can in specific embodiments and applications according to the thought of the application There is change place, to sum up, the contents of this specification should not be construed as limiting the present application.

Claims (10)

1. a kind of method for monitoring state characterized by comprising
Objective function to be monitored is obtained, and obtains the corresponding calling function of the objective function;
The source code of the objective function is resolved into intermediate code, and the calling function is replaced with into monitoring function;
By running the monitoring function, the operating parameter that the intermediate code of the objective function is performed is obtained;
The operating status of the objective function is determined according to the operating parameter.
2. the method as described in claim 1, which is characterized in that the source code by the objective function resolves to centre Code, comprising:
Interpreter is obtained according to the source code type of the objective function;
The source code of the objective function is parsed using the interpreter to obtain the intermediate code of the objective function.
3. method according to claim 2, which is characterized in that described that the calling function is replaced with monitoring function, comprising:
Call the application programming interface of the interpreter that the calling function is replaced with the monitoring function.
4. the method as described in claim 1, which is characterized in that the operating parameter includes the first operating parameter and the second operation Parameter;It is described that the operating parameter that the intermediate code of the objective function is performed is obtained by the operation monitoring function, it wraps It includes:
When bringing into operation the monitoring function, first operating parameter is obtained;
During running the monitoring function, the calling function is called to execute the intermediate code of the objective function;
When the intermediate code of the objective function executes completion, second operating parameter is obtained.
5. method as claimed in claim 4, which is characterized in that described to determine the objective function according to the operating parameter Operating status, comprising:
Obtain the difference between second operating parameter and first operating parameter;
The operating status of the objective function is determined according to the difference.
6. the method according to claim 1 to 5, which is characterized in that described according to operating parameter determination After the operating status of objective function, the method also includes:
The operating status of the objective function is added in log.
7. method as claimed in claim 6, which is characterized in that further include the operating status of other functions in the log;Institute State method further include:
The operating status of each function in the log is analyzed, determines problem function of problems in the log;
Described problem function is labeled.
8. the method for claim 7, which is characterized in that the operating status to each function in the log carries out Analysis, determines problem function of problems in the log, comprising:
Compare the value of the operating parameter of each function in the log;
The function that the value of selection operating parameter is greater than first threshold is determined as problem function of problems in the log;
Alternatively, obtaining the evaluation of estimate of each function according to the value of the operating parameter of each function in the log;
The function that selection evaluation of estimate is greater than second threshold is determined as problem function of problems in the log.
9. a kind of state monitoring device characterized by comprising
Acquiring unit, for obtaining objective function to be monitored, and the corresponding calling function of the acquisition objective function;
Resolution unit, for the source code of the objective function to be resolved to intermediate code;
Replacement unit, for the calling function to be replaced with monitoring function;
The acquiring unit is also used to by running the monitoring function, and the intermediate code for obtaining the objective function is performed Operating parameter;
Determination unit, for determining the operating status of the objective function according to the operating parameter.
10. a kind of state monitoring device, which is characterized in that the state monitoring device includes processor, communication interface and storage Device, wherein the memory stores computer program, and the computer program includes program instruction, and the processor is configured For calling described program to instruct, the method according to claim 1 is executed.
CN201910230213.6A 2019-03-25 2019-03-25 State monitoring method and device Active CN109947624B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910230213.6A CN109947624B (en) 2019-03-25 2019-03-25 State monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910230213.6A CN109947624B (en) 2019-03-25 2019-03-25 State monitoring method and device

Publications (2)

Publication Number Publication Date
CN109947624A true CN109947624A (en) 2019-06-28
CN109947624B CN109947624B (en) 2023-02-10

Family

ID=67011808

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910230213.6A Active CN109947624B (en) 2019-03-25 2019-03-25 State monitoring method and device

Country Status (1)

Country Link
CN (1) CN109947624B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457196A (en) * 2019-08-16 2019-11-15 腾讯科技(深圳)有限公司 The acquisition methods and device of function timing
CN110781060A (en) * 2019-09-20 2020-02-11 平安普惠企业管理有限公司 Function monitoring method and device, computer equipment and storage medium
CN112925693A (en) * 2021-02-25 2021-06-08 平安普惠企业管理有限公司 System monitoring method and device, computer equipment and storage medium
CN113064832A (en) * 2021-04-22 2021-07-02 中国工商银行股份有限公司 Application program energy consumption detection method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1419192A (en) * 2001-10-31 2003-05-21 亚普公司 Intermediate code pretreatment, executive device, executive system and computer program products
CN103294580A (en) * 2012-02-02 2013-09-11 塔塔咨询服务有限公司 Real time performance monitoring
CN103309796A (en) * 2012-03-09 2013-09-18 腾讯科技(深圳)有限公司 Monitoring method and device of component object model (COM) object
CN103544095A (en) * 2012-07-12 2014-01-29 腾讯科技(深圳)有限公司 Server program monitoring method and system of server program
CN104536870A (en) * 2014-12-31 2015-04-22 北京奇虎科技有限公司 Process monitoring method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1419192A (en) * 2001-10-31 2003-05-21 亚普公司 Intermediate code pretreatment, executive device, executive system and computer program products
CN103294580A (en) * 2012-02-02 2013-09-11 塔塔咨询服务有限公司 Real time performance monitoring
CN103309796A (en) * 2012-03-09 2013-09-18 腾讯科技(深圳)有限公司 Monitoring method and device of component object model (COM) object
CN103544095A (en) * 2012-07-12 2014-01-29 腾讯科技(深圳)有限公司 Server program monitoring method and system of server program
CN104536870A (en) * 2014-12-31 2015-04-22 北京奇虎科技有限公司 Process monitoring method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457196A (en) * 2019-08-16 2019-11-15 腾讯科技(深圳)有限公司 The acquisition methods and device of function timing
CN110457196B (en) * 2019-08-16 2023-10-24 腾讯科技(深圳)有限公司 Method and device for acquiring function execution time
CN110781060A (en) * 2019-09-20 2020-02-11 平安普惠企业管理有限公司 Function monitoring method and device, computer equipment and storage medium
CN112925693A (en) * 2021-02-25 2021-06-08 平安普惠企业管理有限公司 System monitoring method and device, computer equipment and storage medium
CN112925693B (en) * 2021-02-25 2023-11-03 新疆北斗同创信息科技有限公司 System monitoring method, device, computer equipment and storage medium
CN113064832A (en) * 2021-04-22 2021-07-02 中国工商银行股份有限公司 Application program energy consumption detection method and device

Also Published As

Publication number Publication date
CN109947624B (en) 2023-02-10

Similar Documents

Publication Publication Date Title
CN109947624A (en) Method for monitoring state and device
CN109446570B (en) Business process display method, device, computer equipment and storage medium
CN106649084A (en) Function call information obtaining method and apparatus, and test device
CN110944048B (en) Service logic configuration method and device
CN113467868B (en) Method and device for creating equipment resources
WO2014194654A1 (en) Method and apparatus for page view switching
CN106326099B (en) A kind of method, apparatus and electronic equipment for program tracking
CN111399840A (en) Module development method and device
CN112988185A (en) Cloud application updating method, device and system, electronic equipment and storage medium
US20140365960A1 (en) Method and apparatus for page view switching
CN112199261A (en) Application program performance analysis method and device and electronic equipment
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
CN111694735A (en) Page performance testing method and device, electronic equipment and storage medium
CN111382044A (en) Positioning method and positioning device for performance bottleneck, electronic equipment and storage medium
CN103326892A (en) Web interface operation method and device
CN113778515A (en) Method and device for determining program package change information
CN113076728A (en) Data filling method of dialog box and related equipment
CN114374595B (en) Event node attribution analysis method, device, electronic equipment and storage medium
CN108846141A (en) A kind of offline cache loading method and device
CN115022036B (en) Attack traffic generation method and system and network security test system
CN110427935B (en) Webpage element identification method and server
CN116028108A (en) Method, device, equipment and storage medium for analyzing dependent package installation time
US20220100631A1 (en) Microservices graph generation
CN115964096A (en) Automatic check rule configuration method, check rule check method and device
CN107632848B (en) Data processing method and device

Legal Events

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