CN104536870B - A kind of process monitoring method and device - Google Patents

A kind of process monitoring method and device Download PDF

Info

Publication number
CN104536870B
CN104536870B CN201410857076.6A CN201410857076A CN104536870B CN 104536870 B CN104536870 B CN 104536870B CN 201410857076 A CN201410857076 A CN 201410857076A CN 104536870 B CN104536870 B CN 104536870B
Authority
CN
China
Prior art keywords
php
function
interpreters
information
monitoring
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.)
Active
Application number
CN201410857076.6A
Other languages
Chinese (zh)
Other versions
CN104536870A (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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410857076.6A priority Critical patent/CN104536870B/en
Publication of CN104536870A publication Critical patent/CN104536870A/en
Application granted granted Critical
Publication of CN104536870B publication Critical patent/CN104536870B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

An embodiment of the present invention provides a kind of process monitoring method and device, method therein specifically includes:The operation of PHP interpreters is performed into function and replaces with preset monitoring function;And the operation compiled using the monitoring function execution PHP interpreters for process, and utilize the monitoring function to monitor the function information in the implementation procedure of the operation.The embodiment of the present invention can obtain the function information in the implementation procedure of operation in real time and be exported, the problem of therefore, it is possible to facilitate developer's fast positioning PHP scripts of PHP scripts.

Description

A kind of process monitoring method and device
Technical field
The present invention relates to field of computer technology, more particularly to a kind of process monitoring method and device.
Background technology
Usually operation has multiple processes in the operating systems such as Linux, Unix.At present, process occur long operational time, During the problems such as run-time error, it is necessary to by monitoring process come problem analysis the reason for.
Strace and pstack instruments can be used in combination with by existing scheme, be used directly to find the operation that influences the course The function call of time, then pair correlation function carries out code analysis and optimization targeted specifically.Wherein, strace instruments can track First floor system that process uses is called, and exportable system calls the time-consuming of the time point being performed and each calling;pstack Instrument can be to the process output function call stack of specified PID (process ID, Process Identity).
PHP (hypertext processor, Hypertext Preprocessor) script is a kind of to be performed by PHP interpreters Process, but existing strace and pstack are merely capable of providing the system call information of PHP interpreters, and PHP can not be provided The information of script, therefore, it is impossible to meet the analysis demand of PHP scripts.
The content of the invention
In view of the above problems, it is proposed that the present invention overcomes the above problem in order to provide one kind or solves at least in part State a kind of process monitoring method and device of problem.
According to one aspect of the present invention, there is provided a kind of process monitoring method, including:
The operation of PHP interpreters is performed into function and replaces with preset monitoring function;And
The operation compiled using the monitoring function execution PHP interpreters for process, and utilize the prison Control the function information in the implementation procedure of the function monitoring operation.
Alternatively, described the step of monitoring the function information in the implementation procedure of the operation using the monitoring function into One step includes:
Offset according to information to be monitored to the relatively preset global variable of dependent variable, obtains the address of the variable;With And
Using the monitoring function, information of the address of the variable in the implementation procedure of the operation is monitored.
Alternatively, the operation that the PHP interpreters are directed to process and compile is performed using the monitoring function described, And before the step of monitoring the function information in the implementation procedure of the operation using the monitoring function, the method is also wrapped Include:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
When the corresponding pilot switch of the process is opened, perform the PHP interpreters using the monitoring function and be directed to The operation that process compiles, and utilize the function information in the implementation procedure of the monitoring function monitoring operation;
The function information is write into the shared drive, the letter is read from the shared drive by command-line tool Number information.
Alternatively, the described the step of function information is write into the shared drive, including:
The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
Alternatively, the method further includes:
The call stack information that process corresponds to PHP interpreters is obtained using pstack;And
According to the global member variable of the PHP interpreters, searched in the call stack information of the PHP interpreters described in The corresponding function call stack information of each operation that PHP interpreters perform.
Alternatively, the global variable according to the PHP interpreters, in the call stack information of the PHP interpreters The step of searching each operation that the PHP interpreters perform corresponding function call stack information further comprises:
The context environmental that operation according to PHP interpreters performs, obtains the current operation that the PHP interpreters perform Operate execution information;And
According to the global variable of the PHP interpreters and the operation execution information of the current operation, explained in the PHP The corresponding function call stack information of current operation that the PHP interpreters perform is searched in the call stack information of device.
Alternatively, the opening and closing of the pilot switch are controlled by the command-line tool.
According to another aspect of the present invention, there is provided a kind of process monitoring device, including:
Replacement module, preset monitoring function is replaced with for the operation of PHP interpreters to be performed function;And
Monitoring module, for performing the operation that the PHP interpreters are directed to process and compile using the monitoring function, And the function information in the implementation procedure of the operation is monitored using the monitoring function.
Alternatively, the monitoring module, further comprises:
Address acquisition submodule, for the offset according to information to be monitored to the relatively preset global variable of dependent variable, is obtained Take the address of the variable;And
Monitoring submodule, for utilizing the monitoring function, monitors execution of the address in the operation of the variable Information in journey.
Alternatively, described device further includes:
Judgment module, for compiling to obtain for process using the monitoring function execution PHP interpreters described Operation, and before monitoring using the monitoring function operation of the function information in the implementation procedure of the operation, pass through reading Shared drive is taken, judges whether the corresponding pilot switch of the process is opened;
The then monitoring module, specifically for when the corresponding pilot switch of the process is opened, utilizing the monitoring letter Number performs the PHP interpreters and is directed to the operation that process compiles, and monitors holding for the operation using the monitoring function Function information during row;
Then described device further includes:
Writing module, for the function information to be write the shared drive, by command-line tool out of described share Deposit the middle reading function information.
Alternatively, said write module, specifically for the function information is write process described in the shared drive Corresponding Memory Mapping File.
Alternatively, described device further includes:
Stack data obtaining module, for obtaining the call stack information that process corresponds to PHP interpreters using pstack;And
Searching module, for the global member variable according to the PHP interpreters, in the call stack of the PHP interpreters The corresponding function call stack information of each operation that the PHP interpreters perform is searched in information.
Alternatively, the searching module, further comprises:
Acquisition submodule is operated, for the context environmental performed according to the operation of PHP interpreters, obtains the PHP solutions Release the operation execution information of the current operation of device execution;And
Submodule is searched in operation, and the operation for global variable and the current operation according to the PHP interpreters is held Row information, searches the corresponding function of current operation that the PHP interpreters perform in the call stack information of the PHP interpreters Call stack information.
Alternatively, the opening and closing of the pilot switch are controlled by the command-line tool.
A kind of process monitoring method and device according to embodiments of the present invention, can perform letter by the operation of PHP interpreters Number replaces with preset monitoring function, and performs what the PHP interpreters were compiled for process using the monitoring function Operation, and monitor using the monitoring function function information in the implementation procedure of the operation, function information here can be with For all function informations of PHP functions in the process of implementation, such as function name, function parameter, line number, filename information, also, The information such as function return value, function call time can also be obtained after the completion of function execution, in this way, operation can be obtained in real time Implementation procedure in function information and exported, therefore, it is possible to facilitate developer's fast positioning PHP feet of PHP scripts This problem of.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of specification, and in order to allow above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by the embodiment of the present invention.
Brief description of the drawings
By reading the detailed description of hereafter optional embodiment, it is various other the advantages of and benefit it is common for this area Technical staff will be clear understanding.Attached drawing is only used for showing the purpose of optional embodiment, and is not considered as to the present invention Limitation.And in whole attached drawing, identical component is denoted by the same reference numerals.In the accompanying drawings:
Fig. 1 shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention;
Fig. 2 shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention;
Fig. 3 shows a kind of structure diagram of process monitoring system according to an embodiment of the invention;
Fig. 4 shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention;And
Fig. 5 shows a kind of structure diagram of process monitoring device according to an embodiment of the invention.
Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in attached drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure Completely it is communicated to those skilled in the art.
Reference Fig. 1, shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention, Specifically it may include steps of:
Step 101, by PHP interpreters operation perform function replace with preset monitoring function;And
Step 102, perform the operation that the PHP interpreters are directed to process and compile, and profit using the monitoring function The function information in the implementation procedure of the operation is monitored with the monitoring function.
PHP scripts can generally pass through morphology parsing, syntax parsing, compiling generation intermediate code and hold in PHP interpreters Row intermediate code and etc.;Wherein, the step of intermediate code is performed under default situations is to pass through zend/zend_vm_ Zend_execute function calls in execute.h files perform completion, for all intermediate codes, acquiescence realization be with Perform in order, jump out and perform when function is run into, the position jumped out is returned after having performed and is continued to execute.
One of the core concepts of the embodiments of the present invention is, by zend_execute, zend_execute of PHP interpreters Perform function Deng operation and replace with preset monitoring function, and using the monitoring function perform the PHP interpreters be directed into The operation that journey compiles, and utilize the letter in the implementation procedure of the monitoring function monitoring operation (op, operation) Number information, function information here can be all function informations of PHP functions in the process of implementation, as function name, function are joined The information such as number, line number, filename, also, function return value, function call time etc. can also be obtained after the completion of function execution Information, in this way, function information and output during the implementation procedure of operation can be obtained in real time, therefore, it is possible to facilitate PHP scripts The problem of developer's fast positioning PHP scripts.
In the concrete realization, when PHP interpreters initialize, zend_execute can be directed toward to the execute of acquiescence, Also, zend_execute can be replaced with to preset monitoring function phptrace_old_ in actually compiling and before performing Execute, monitoring function phptrace_old_execute had not only been realized to original zend_execute encapsulation, but also addition The function of function information in the implementation procedure of the monitoring operation.
In practical applications, each information of the acquisition can be write * data files, and it is defeated by the * data files Go out.Certainly, the embodiment of the present invention is not any limitation as the specific way of output.
In a kind of application scenarios of the present invention, letter of the address of variable in the implementation procedure of the operation can be monitored Breath, to realize the purpose of the PHP code of analysis information of interest.Correspondingly, it is described to monitor the behaviour using the monitoring function The step of function information in the implementation procedure of work, it can specifically include:It is relatively preset complete to dependent variable according to information to be monitored The offset of office's variable, obtains the address of the variable;And the monitoring function is utilized, the address of the variable is monitored in institute State the information in the implementation procedure of operation.Wherein, the information to be monitored can be various information of interest, for example, can make The preset global variable of some cores of PHP script process is obtained with GDB (GNU detects wrong device, GNU Debugger), and utilizes institute Monitoring function is stated, monitors information of the address of the variable in the implementation procedure of the operation.
In another application scenarios of the present invention, when showing " there is no file " in the online interface of PHP scripts and literary There are during this document in part folder, the reason for monitoring function locating above-mentioned file inconsistence problems can be utilized.Correspondingly, exist Monitor in the function information in the implementation procedure of the operation, it is found that the return value of function opendir () reports an error, and Opendir () is the function for opening catalogue handle, therefore the reason for can positioning above-mentioned file inconsistence problems is:Open Catalogue goes wrong, rather than file is not present in file.
Certainly, above application scene is intended only as example, and those skilled in the art can according to the actual requirements, by the present invention Embodiment is applied to other application scene, the reason for such as being used to position " certain function timing is long ", alternatively, for positioning The reason for " PHP scripts perform time length " etc., the embodiment of the present invention is not any limitation as specific application scenarios.
To sum up, the operation of PHP interpreters is performed function and replaces with preset monitoring function by the embodiment of the present invention, and is utilized The monitoring function performs the PHP interpreters and is directed to the operation that process compiles, and utilizes the monitoring function monitoring institute The function information in the implementation procedure of operation is stated, function information here can be all letters of PHP functions in the process of implementation Number information, such as function name, function parameter, line number, filename information, also, letter can also be obtained after the completion of function execution Number return values, the information such as function call time, in this way, function information and progress during the implementation procedure of operation can be obtained in real time Output, the problem of therefore, it is possible to facilitate developer's fast positioning PHP scripts of PHP scripts.
Reference Fig. 2, shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention, Specifically it may include steps of:
Step 201, by reading shared drive, judge whether the corresponding pilot switch of the process is opened;
Step 202, when the corresponding pilot switch of the process is opened, utilize the monitoring function to perform the PHP solutions Release device and be directed to the operation that process compiles, and the function letter in the implementation procedure of the operation is monitored using the monitoring function Breath;
Step 203, by the function information write the shared drive, is read by command-line tool from the shared drive Take the function information.
Relative to embodiment illustrated in fig. 1, the present embodiment can in shared drive the corresponding pilot switch of storage process, and Judge whether the corresponding pilot switch of the process is opened by reading shared drive, so as to determine to be according to judging result It is no to be turned on and off monitoring function;Wherein, when the corresponding pilot switch of the process is opened, monitoring function can be opened, and The operation compiled using the monitoring function execution PHP interpreters for process, and utilize the monitoring function prison Control the function information in the implementation procedure of the operation;When the corresponding pilot switch of the process is closed, monitoring can be closed Function.
In practical applications, it is the pilot switch of all processes in storage program area, can be stored with shared drive The pilot switch of preset number, such as preset number can be 216Etc., certainly, the embodiment of the present invention is to the preset number Concrete numerical value be not any limitation as.
In a kind of alternative embodiment of the present invention, the described the step of function information is write into the shared drive, It can specifically include:The function information is write into the corresponding Memory Mapping File of process described in the shared drive.Pass through Memory Mapping File can retain the region of an address space, while physical storage is submitted to this region, simply memory The physical storage of File Mapping is from a file being already present on disk, and the page file of nonsystematic, and right This document first must map file before being operated, and memory is loaded into from disk just as by whole file.By This can be seen that using Memory Mapping File handle be stored in the file on disk when, it will not be necessary to again to file perform I/O it is (defeated Enter/export, Input/Output) operation, it means that for file application and it need not be distributed again when handling file Caching, the operation of all file caches are directly managed by operating system, and file data is loaded into memory, number due to eliminating According to from the interior write-back for being stored to file and releasing memory block so that file of the Memory Mapping File in processing big data quantity When can play the effect that writing speed is fast and reading speed is fast.Mmap files are a kind of example of Memory Mapping File, certainly originally Inventive embodiments are not any limitation as specific Memory Mapping File.
To make those skilled in the art more fully understand the embodiment of the present invention, with reference to Fig. 3, one according to the present invention is shown A kind of structure diagram of process monitoring system of embodiment, can specifically include:Process monitoring device 301, shared drive 302 With command-line tool 303;
Wherein, shared drive 302 can specifically include:Command area 321 and data field 322, wherein, command area 321 can be used In the information for storing the corresponding pilot switch position of each process, data field 322 can be used for the execution for storing each process respective operations Function information in journey;
Command-line tool 303 can be used for by performing write operation to each pilot switch position in the command area 321, with control The opening and closing state of each pilot switch position, and can also be used to from the data field 322 read each process respective operations Function information in implementation procedure, and the function information of reading is shown;
The process monitoring device 301 can be used for the information for monitoring the corresponding pilot switch position of each process, be corresponded in process Pilot switch position information for open when, can open real time monitoring operating system in each process respective operations implementation procedure In function information function;And when the information of the corresponding pilot switch position of process is closes, policer operation system can be closed The function of function information in system in the implementation procedure of each process respective operations.
In practical applications, monitoring device 301 and command-line tool 303 can also be communicated by heartbeat mechanism, its In, monitoring device 301 and command-line tool 303 can send heartbeat message mutually, wherein, when monitoring device 301 is in heartbeat week When the heartbeat message of the transmission of command-line tool 303 is not received in the phase, it is believed that the communication connection of the two disconnects, therefore can close Monitoring function is closed, to save the resource of necessary for monitoring.Wherein, the heartbeat message between monitoring device 301 and command-line tool 303 It can preserve to above-mentioned command area 321.
Reference Fig. 4, shows a kind of step flow diagram of process monitoring method according to an embodiment of the invention, Specifically it may include steps of:
Step 401, by PHP interpreters operation perform function replace with preset monitoring function;
Step 402, perform the operation that the PHP interpreters are directed to process and compile, and profit using the monitoring function The function information in the implementation procedure of the operation is monitored with the monitoring function;
Step 403, obtain the call stack information that process corresponds to PHP interpreters using pstack;
Step 44, the global member variable according to the PHP interpreters, in the call stack information of the PHP interpreters Search the corresponding function call stack information of each operation that the PHP interpreters perform.
Relative to embodiment illustrated in fig. 1, the present embodiment is except can be with the letter in the implementation procedure of monitoring process respective operations Outside number information, it can also search to obtain the corresponding function call stack information of each operation of PHP interpreters execution, namely be capable of providing The snapshot functions for respectively operating corresponding function call stack information that PHP interpreters perform, are directly obtained relative to using pstack The call stack information of PHP interpreters is merely capable of the information of reflection PHP interpreter ranks, the function call stack that the present embodiment obtains Information can reflect the running state information of the PHP scripts such as function call stack of PHP scripts of process performed by PHP interpreters, Therefore the problem of developer's fast positioning PHP scripts of PHP scripts being facilitated.
There is corresponding global member variable during PHP interpreters perform PHP scripts, these global member variables can The storage of information needed during for running, wherein, zend_executor_globals can be used for the various of storage PHP interpreters State, therefore, can be searched using zend_executor_globals in the call stack information of the PHP interpreters described in The corresponding function call stack information of each operation that PHP interpreters perform.
In a kind of alternative embodiment of the present invention, the global variable according to the PHP interpreters, in the PHP The step of corresponding function call stack information of each operation that the PHP interpreters perform is searched in the call stack information of interpreter, It may further include:
The context environmental that sub-step A1, the operation according to PHP interpreters perform, obtains what the PHP interpreters performed The operation execution information of current operation;And
The operation execution information of sub-step A2, the global variable according to the PHP interpreters and the current operation, in institute State and the corresponding function call stack information of current operation that the PHP interpreters perform is searched in the call stack information of PHP interpreters.
PHP interpreters can using zend_execute_data to store the operation in current operation implementation procedure when information, And the execution function PRev_execute_data of its last action can be got by zend_execute_data, successively The structure for being used to characterize the context environmental that operation performs of zend_execute_data → PRev_execute_data is traveled through, Information when can obtain all operations corresponding operation of PHP scripts.
In one kind application example of the present invention, the structure of zend_execute_data is as follows:
struct_zend_execute_data{
struct_zend_op*opline;
zend_function_state function_state;
zend_function*fbc;/*Function Being Called*/
zend_class_entry*called_scope;
zend_op_array*op_array;
zval*object;
union_temp_variable*Ts;
zval***CVs;
HashTable*symbol_table;
struct_zend_execute_data*PRev_execute_data;
zval*old_error_reporting;
zend_bool nested;
zval**original_return_value;
zend_class_entry*current_scope;
zend_class_entry*current_called_scope;
zval*current_this;
zval*current_object;
struct_zend_op*call_opline;
};
Information when zend_execute_data is used to store the operation in current operation implementation procedure, wherein, its member Function_state can be used for the function status information in storage current operation implementation procedure, therefore, can be based on Function_state obtains the function call stack information in current operation implementation procedure.
Also, the member PRev_execute_data of zend_execute_data performs letter available for last action Breath, therefore, can be by traveling through being held for characterizing operation for zend_execute_data → PRev_execute_data successively The structure of capable context environmental, obtains the corresponding function call stack information of all operations of PHP scripts.
For embodiment of the method, in order to be briefly described, therefore it is all expressed as to a series of combination of actions, but this area Technical staff should know, the embodiment of the present invention and from the limitation of described sequence of movement, because implementing according to the present invention Example, some steps can use other orders or be carried out at the same time.Secondly, those skilled in the art should also know, specification Described in embodiment belong to alternative embodiment, necessary to the involved action not necessarily embodiment of the present invention.
Reference Fig. 5, shows a kind of structure diagram of process monitoring device according to an embodiment of the invention, specifically It can include following module:
Replacement module 501, preset monitoring function is replaced with for the operation of PHP interpreters to be performed function;And
Monitoring module 502, for the behaviour compiled using the monitoring function execution PHP interpreters for process Make, and the function information in the implementation procedure of the operation is monitored using the monitoring function.
In a kind of alternative embodiment of the present invention, the monitoring module 502, may further include:
Address acquisition submodule, for the offset according to information to be monitored to the relatively preset global variable of dependent variable, is obtained Take the address of the variable;And
Monitoring submodule, for utilizing the monitoring function, monitors execution of the address in the operation of the variable Information in journey.
In another alternative embodiment of the present invention, described device can also include:
Judgment module, for compiling to obtain for process using the monitoring function execution PHP interpreters described Operation, and before monitoring using the monitoring function operation of the function information in the implementation procedure of the operation, pass through reading Shared drive is taken, judges whether the corresponding pilot switch of the process is opened;
The then monitoring module 502, can be specifically used for, when the corresponding pilot switch of the process is opened, utilizing the prison Control function performs the PHP interpreters and is directed to the operation that process compiles, and monitors the operation using the monitoring function Implementation procedure in function information;
Then described device can also include:
Writing module, for the function information to be write the shared drive, by command-line tool out of described share Deposit the middle reading function information.
In another alternative embodiment of the present invention, said write module, can be specifically used for writing the function information Enter the corresponding Memory Mapping File of process described in the shared drive.
In a kind of alternative embodiment of the present invention, the opening and closing of the pilot switch can be by the command-line tool Control.
In another alternative embodiment of the present invention, described device can also include:
Stack data obtaining module, for obtaining the call stack information that process corresponds to PHP interpreters using pstack;
Searching module, for the global member variable according to the PHP interpreters, in the call stack of the PHP interpreters The corresponding function call stack information of each operation that the PHP interpreters perform is searched in information.
In a kind of alternative embodiment of the present invention, the searching module, may further include:
Acquisition submodule is operated, for the context environmental performed according to the operation of PHP interpreters, obtains the PHP solutions Release the operation execution information of the current operation of device execution;
Submodule is searched in operation, and the operation for global variable and the current operation according to the PHP interpreters is held Row information, searches the corresponding function of current operation that the PHP interpreters perform in the call stack information of the PHP interpreters Call stack information.
For device embodiment, since it is substantially similar to embodiment of the method, so description is fairly simple, it is related Part illustrates referring to the part of embodiment of the method.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein. Various general-purpose systems can also be used together with teaching based on this.As described above, required by constructing this kind of system Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that it can utilize various Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair Bright preferred forms.
In the specification that this place provides, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect, Above in the description to the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor The application claims of shield features more more than the feature being expressly recited in each claim.It is more precisely, such as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself Separate embodiments all as the present invention.
Those skilled in the art, which are appreciated that, to carry out adaptively the module in the equipment in embodiment Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and attached drawing) and so to appoint Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power Profit requires, summary and attached drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation Replace.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed One of meaning mode can use in any combination.
The all parts embodiment of the present invention can be with hardware realization, or to be run on one or more processor Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that it can use in practice Microprocessor or digital signal processor (DSP) are realized in process monitoring method and device according to embodiments of the present invention The some or all functions of some or all components.The present invention is also implemented as being used to perform method as described herein Some or all equipment or program of device (for example, computer program and computer program product).Such reality The program of the existing present invention can store on a computer-readable medium, or can have the form of one or more signal. Such signal can be downloaded from Internet platform and obtained, and either be provided or in the form of any other on carrier signal There is provided.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol between bracket should not be configured to limitations on claims.Word " comprising " does not exclude the presence of not Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such Element.The present invention can be by means of including the hardware of some different elements and being come by means of properly programmed computer real It is existing.In if the unit claim of equipment for drying is listed, several in these devices can be by same hardware branch To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame Claim.
The invention discloses A1, a kind of process monitoring method, including:
The operation of PHP interpreters is performed into function and replaces with preset monitoring function;And
The operation compiled using the monitoring function execution PHP interpreters for process, and utilize the prison Control the function information in the implementation procedure of the function monitoring operation.
A2, the method as described in A 1, the function monitored using the monitoring function in the implementation procedure of the operation The step of information, further comprises:
Offset according to information to be monitored to the relatively preset global variable of dependent variable, obtains the address of the variable;With And
Using the monitoring function, information of the address of the variable in the implementation procedure of the operation is monitored.
A3, the method as described in A1, the PHP interpreters are performed for process compiling described using the monitoring function Obtained operation, and the step of monitor the function information in the implementation procedure of the operation using the monitoring function before, institute The method of stating further includes:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
When the corresponding pilot switch of the process is opened, perform the PHP interpreters using the monitoring function and be directed to The operation that process compiles, and utilize the function information in the implementation procedure of the monitoring function monitoring operation;
The function information is write into the shared drive, the letter is read from the shared drive by command-line tool Number information.
A4, the method as described in A3, the described the step of function information is write into the shared drive, including:
The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
A5, the method as described in A1 or A2 or A3 or A4, the method further include:
The call stack information that process corresponds to PHP interpreters is obtained using pstack;And
According to the global member variable of the PHP interpreters, searched in the call stack information of the PHP interpreters described in The corresponding function call stack information of each operation that PHP interpreters perform.
A6, the method as described in A5, the global variable according to the PHP interpreters, in the tune of the PHP interpreters The step of function call stack information corresponding with each operation that the PHP interpreters execution is searched in stack information, further comprises:
The context environmental that operation according to PHP interpreters performs, obtains the current operation that the PHP interpreters perform Operate execution information;And
According to the global variable of the PHP interpreters and the operation execution information of the current operation, explained in the PHP The corresponding function call stack information of current operation that the PHP interpreters perform is searched in the call stack information of device.
A7, the method as described in A3, the opening and closing of the pilot switch are controlled by the command-line tool.
The invention also discloses B8, a kind of process monitoring device, including:
Replacement module, preset monitoring function is replaced with for the operation of PHP interpreters to be performed function;And
Monitoring module, for performing the operation that the PHP interpreters are directed to process and compile using the monitoring function, And the function information in the implementation procedure of the operation is monitored using the monitoring function.
B9, the device as described in claim B8, the monitoring module, further comprises:
Address acquisition submodule, for the offset according to information to be monitored to the relatively preset global variable of dependent variable, is obtained Take the address of the variable;And
Monitoring submodule, for utilizing the monitoring function, monitors execution of the address in the operation of the variable Information in journey.
B10, the device as described in B8, described device further include:
Judgment module, for compiling to obtain for process using the monitoring function execution PHP interpreters described Operation, and before monitoring using the monitoring function operation of the function information in the implementation procedure of the operation, pass through reading Shared drive is taken, judges whether the corresponding pilot switch of the process is opened;
The then monitoring module, specifically for when the corresponding pilot switch of the process is opened, utilizing the monitoring letter Number performs the PHP interpreters and is directed to the operation that process compiles, and monitors holding for the operation using the monitoring function Function information during row;
Then described device further includes:
Writing module, for the function information to be write the shared drive, by command-line tool out of described share Deposit the middle reading function information.
B11, the device as described in B10, said write module, specifically for function information write-in is described shared interior The corresponding Memory Mapping File of process described in depositing.
B12, the device as described in B8 or B9 or B10 or B11, described device further include:
Stack data obtaining module, for obtaining the call stack information that process corresponds to PHP interpreters using pstack;And
Searching module, for the global member variable according to the PHP interpreters, in the call stack of the PHP interpreters The corresponding function call stack information of each operation that the PHP interpreters perform is searched in information.
B13, the device as described in B12, the searching module, further comprises:
Acquisition submodule is operated, for the context environmental performed according to the operation of PHP interpreters, obtains the PHP solutions Release the operation execution information of the current operation of device execution;And
Submodule is searched in operation, and the operation for global variable and the current operation according to the PHP interpreters is held Row information, searches the corresponding function of current operation that the PHP interpreters perform in the call stack information of the PHP interpreters Call stack information.
B14, the device as described in B10, the opening and closing of the pilot switch are controlled by the command-line tool.

Claims (12)

1. a kind of process monitoring method, including:
The operation of PHP interpreters is performed into function and replaces with preset monitoring function;And
The operation compiled using the monitoring function execution PHP interpreters for process, and utilize the monitoring letter Number monitors the function information in the implementation procedure of the operation;
The method further includes:
The call stack information that process corresponds to PHP interpreters is obtained using pstack;And
According to the global member variable of the PHP interpreters, the PHP is searched in the call stack information of the PHP interpreters The corresponding function call stack information of each operation that interpreter performs.
2. the method as described in claim 1, it is characterised in that the execution that the operation is monitored using the monitoring function During function information the step of further comprise:
Offset according to information to be monitored to the relatively preset global variable of dependent variable, obtains the address of the variable;And
Using the monitoring function, information of the address of the variable in the implementation procedure of the operation is monitored.
3. the method as described in claim 1, it is characterised in that perform the PHP explanations using the monitoring function described Device is directed to the operation that process compiles, and the function information in the implementation procedure of the operation is monitored using the monitoring function The step of before, the method further includes:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
When the corresponding pilot switch of the process is opened, perform the PHP interpreters using the monitoring function and be directed to process Obtained operation is compiled, and the function information in the implementation procedure of the operation is monitored using the monitoring function;
The function information is write into the shared drive, reads the function letter from the shared drive by command-line tool Breath.
4. method as claimed in claim 3, it is characterised in that the step that the function information is write to the shared drive Suddenly, including:
The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
5. the method as described in claim 1, it is characterised in that the global variable according to the PHP interpreters, described The step for respectively operating corresponding function call stack information that the PHP interpreters perform is searched in the call stack information of PHP interpreters Suddenly further comprise:
The context environmental that operation according to PHP interpreters performs, obtains the operation for the current operation that the PHP interpreters perform Execution information;And
According to the global variable of the PHP interpreters and the operation execution information of the current operation, in the PHP interpreters The corresponding function call stack information of current operation that the PHP interpreters perform is searched in call stack information.
6. method as claimed in claim 3, it is characterised in that the opening and closing of the pilot switch are by the order line work Tool control.
7. a kind of process monitoring device, including:
Replacement module, preset monitoring function is replaced with for the operation of PHP interpreters to be performed function;And
Monitoring module, for performing the operation that the PHP interpreters are directed to process and compile, and profit using the monitoring function The function information in the implementation procedure of the operation is monitored with the monitoring function;
Described device further includes:
Stack data obtaining module, for obtaining the call stack information that process corresponds to PHP interpreters using pstack;And
Searching module, for the global member variable according to the PHP interpreters, in the call stack information of the PHP interpreters The middle corresponding function call stack information of each operation searched the PHP interpreters and performed.
8. device as claimed in claim 7, it is characterised in that the monitoring module, further comprises:
Address acquisition submodule, for the offset according to information to be monitored to the relatively preset global variable of dependent variable, obtains institute State the address of variable;And
Monitoring submodule, for utilizing the monitoring function, monitors the address of the variable in the implementation procedure of the operation Information.
9. device as claimed in claim 7, it is characterised in that described device further includes:
Judgment module, in the behaviour compiled using the monitoring function execution PHP interpreters for process Make, and before the operation using the function information in the implementation procedure of the monitoring function monitoring operation, by reading altogether Memory is enjoyed, judges whether the corresponding pilot switch of the process is opened;
The then monitoring module, specifically for when the corresponding pilot switch of the process is opened, being held using the monitoring function The row PHP interpreters are directed to the operation that process compiles, and the execution of the operation is monitored using the monitoring function Function information in journey;
Then described device further includes:
Writing module, for the function information to be write the shared drive, by command-line tool from the shared drive Read the function information.
10. device as claimed in claim 9, it is characterised in that said write module, specifically for the function information is write Enter the corresponding Memory Mapping File of process described in the shared drive.
11. device as claimed in claim 7, it is characterised in that the searching module, further comprises:
Acquisition submodule is operated, for the context environmental performed according to the operation of PHP interpreters, obtains the PHP interpreters The operation execution information of the current operation of execution;And
Submodule is searched in operation, and the operation for global variable and the current operation according to the PHP interpreters performs letter Breath, searches the corresponding function call of current operation that the PHP interpreters perform in the call stack information of the PHP interpreters Stack information.
12. device as claimed in claim 9, it is characterised in that the opening and closing of the pilot switch are by the order line Instrument controls.
CN201410857076.6A 2014-12-31 2014-12-31 A kind of process monitoring method and device Active CN104536870B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410857076.6A CN104536870B (en) 2014-12-31 2014-12-31 A kind of process monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410857076.6A CN104536870B (en) 2014-12-31 2014-12-31 A kind of process monitoring method and device

Publications (2)

Publication Number Publication Date
CN104536870A CN104536870A (en) 2015-04-22
CN104536870B true CN104536870B (en) 2018-05-04

Family

ID=52852400

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410857076.6A Active CN104536870B (en) 2014-12-31 2014-12-31 A kind of process monitoring method and device

Country Status (1)

Country Link
CN (1) CN104536870B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095071B (en) * 2015-06-30 2018-03-23 百度在线网络技术(北京)有限公司 A kind of scene performance information methods, devices and systems for being used to obtain application
CN106897083A (en) * 2015-12-24 2017-06-27 北京奇虎科技有限公司 A kind of method and device of security sweep
CN106897051B (en) * 2015-12-24 2022-01-25 北京奇虎科技有限公司 Process cleaning method and device
CN106897050A (en) * 2015-12-24 2017-06-27 北京奇虎科技有限公司 A kind of method and device of process cleaning
CN107402885A (en) * 2017-08-02 2017-11-28 郑州云海信息技术有限公司 A kind of program debugging method and device
CN109947624B (en) * 2019-03-25 2023-02-10 深圳市腾讯信息技术有限公司 State monitoring method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN103839008A (en) * 2014-03-21 2014-06-04 彭岸峰 Immune safety service for one-word script backdoors and PHP variable function backdoors

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5861438B2 (en) * 2011-12-16 2016-02-16 株式会社オートネットワーク技術研究所 Control device and process monitoring method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN103839008A (en) * 2014-03-21 2014-06-04 彭岸峰 Immune safety service for one-word script backdoors and PHP variable function backdoors

Also Published As

Publication number Publication date
CN104536870A (en) 2015-04-22

Similar Documents

Publication Publication Date Title
CN104536870B (en) A kind of process monitoring method and device
US9514026B2 (en) Debugging analysis in running multi-user systems
US9934128B2 (en) Dynamic per-method probing during runtime
EP3619611B1 (en) Conditional debugging of server-side production code
US20160188450A1 (en) Automated application test system
CN108345542A (en) Abnormality eliminating method and device in a kind of application program
CN105468529A (en) Accurate traversal method and apparatus for UI controls of android application
KR102118236B1 (en) Operating system support for contracts
US8364691B2 (en) Dynamic query-based debug point mapper
CN107015841B (en) Preprocessing method for program compiling and program compiling device
CN110673837B (en) Code repairing method and device, electronic equipment and computer readable storage medium
US10169212B2 (en) Code coverage through overlay hooks
Dennis et al. Two-stage agent program verification
Heinzemann et al. vTSL-a formally verifiable DSL for specifying robot tasks
CN108304213A (en) Run the hot restorative procedure and device of program
WO2017123367A1 (en) Program randomization for cyber-attack resilient control in programmable logic controllers
Paikan et al. A generic testing framework for test driven development of robotic systems
EP3619612B1 (en) Temporary de-optimization of target functions in a cloud debugger
CN105117243B (en) A kind of method and apparatus for the startup time obtaining application program
CN104915295A (en) Game software debugging method and device
CN106897051B (en) Process cleaning method and device
CN106897083A (en) A kind of method and device of security sweep
CN106897050A (en) A kind of method and device of process cleaning
KR101834530B1 (en) Dynamic collaboration service platform and Method for providing an application service at the same platform
Winikoff How testable are BDI agents? An analysis of branch coverage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220720

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right