CN106897050A - A kind of method and device of process cleaning - Google Patents

A kind of method and device of process cleaning Download PDF

Info

Publication number
CN106897050A
CN106897050A CN201510984720.0A CN201510984720A CN106897050A CN 106897050 A CN106897050 A CN 106897050A CN 201510984720 A CN201510984720 A CN 201510984720A CN 106897050 A CN106897050 A CN 106897050A
Authority
CN
China
Prior art keywords
php
function information
information
interpreters
implementation procedure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510984720.0A
Other languages
Chinese (zh)
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
Qizhi Software Beijing 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 CN201510984720.0A priority Critical patent/CN106897050A/en
Publication of CN106897050A publication Critical patent/CN106897050A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/442Shutdown

Abstract

A kind of method and device of process cleaning is the embodiment of the invention provides, PHP trace routines are created in PHP interpreters;The function information in the implementation procedure of the operation that the PHP interpreters are obtained for process compiling is tracked using the PHP trace routines;According to the function information, the application program in detection application program corresponding with the function information with the presence or absence of resources occupation rate more than pre-set ratio;Detect the presence of the resources occupation rate more than the pre-set ratio application program when, inessential process is chosen from the process being currently running, and remove the inessential process.The embodiment of the present invention can in real time obtain the function information in the implementation procedure of operation and be exported, and the developer therefore, it is possible to facilitate PHP scripts quickly positions the problem of PHP scripts.

Description

A kind of method and device of process cleaning
Technical field
The present invention relates to field of computer technology, more particularly to a kind of method and device of process cleaning.
Background technology
Generally operation has multiple processes in the operating systems such as Linux, Unix.At present, occur in process During the problems such as long operational time, run-time error, it is necessary to by monitoring process come problem analysis the reason for.
Can be used in combination with for strace and pstack instruments by existing scheme, be used directly to find influence The function call of process run time, then pair correlation function carries out code analysis and optimization targeted specifically.Its In, strace instruments can track the first floor system that process uses and call, and exportable system is called and is performed Time point and each call it is time-consuming;Pstack instruments can be to specifying PID (process ID, Process Identity process output function call stack).
PHP (hypertext processor, Hypertext Preprocessor) script is a kind of by PHP explanations Device is come the process that performs, but existing strace and pstack are merely capable of the system for providing PHP interpreters Recalls information, and the information of PHP scripts cannot be provided, therefore, it is impossible to meet the analysis of PHP scripts Demand.
The content of the invention
In view of the above problems, it is proposed that the present invention overcomes above mentioned problem or at least part of to provide one kind Solve the above problems a kind of process cleaning method and apparatus.
According to one aspect of the present invention, there is provided a kind of method of process cleaning, methods described includes:
PHP trace routines are created in PHP interpreters;
The operation that the PHP interpreters are obtained for process compiling is tracked using the PHP trace routines Implementation procedure in function information;
According to the function information, with the presence or absence of money in detection application program corresponding with the function information Application program of the source occupancy more than pre-set ratio;
Detect the presence of the resources occupation rate more than the pre-set ratio application program when, from Inessential process is chosen in the process of operation, and removes the inessential process.
Optionally, it is described to track the PHP interpreters for process volume using the PHP trace routines The function information in the implementation procedure of the operation for obtaining is translated, is specifically included:
According to information to be monitored to the side-play amount of the relatively preset global variable of dependent variable, the variable is obtained Address;And
Using the PHP trace routines, the implementation procedure of the address in the operation of the variable is monitored In information.
Optionally, the PHP interpreters are tracked for process using the PHP trace routines described Before function information in the implementation procedure of the operation that compiling is obtained, methods described also includes:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
It is described using PHP trace routines tracking when the corresponding pilot switch of the process is opened Function information in the implementation procedure of operation;
The function information is write into the shared drive, is read from the shared drive by command-line tool Take the function information.
Optionally, the step of write-in shared drive by the function information, including:
The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
Optionally, methods described also includes:
The operation that the PHP interpreters are obtained for process compiling is obtained using the PHP trace routines Implementation procedure in call stack information.
Optionally, 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 device of process cleaning, described device includes:
Function creation unit, for creating PHP trace routines in PHP interpreters;
Monitoring unit, process is directed to for tracking the PHP interpreters using the PHP trace routines Function information in the implementation procedure of the operation that compiling is obtained;
Detection unit, for according to the function information, detecting application journey corresponding with the function information Application program in sequence with the presence or absence of resources occupation rate more than pre-set ratio;
Clearing cell, for detecting the presence of application of the resources occupation rate more than the pre-set ratio During program, inessential process is chosen from the process being currently running, and remove the inessential process.
Optionally, the monitoring unit, specifically includes:
Address acquisition subelement, for according to information to be monitored to the inclined of the relatively preset global variable of dependent variable Shifting amount, obtains the address of the variable;And
Monitoring subelement, for utilizing the PHP trace routines, monitors the address of the variable in institute State the information in the implementation procedure of operation.
Optionally, described device also includes:
Judging unit, for tracking the PHP interpreters pin using the PHP trace routines described Before function information in the implementation procedure of the operation obtained to process compiling, by reading shared drive, Judge whether the corresponding pilot switch of the process is opened;
The monitoring unit, specifically for when the corresponding pilot switch of the process is opened, using described PHP trace routines track the function information in the implementation procedure of the operation;
Then described device also includes:
Writing unit, for the function information to be write into the shared drive, by command-line tool from institute State and read the function information in shared drive.
Optionally, said write unit, specifically for by the function information write-in shared drive The corresponding Memory Mapping File of the process.
Optionally, described device also includes:
Stack information acquisition unit, for obtaining the PHP interpreters pin using the PHP trace routines Call stack information in the implementation procedure of the operation obtained to process compiling;.
Optionally, the opening and closing of the pilot switch are controlled by the command-line tool.
A kind of method and device of process cleaning according to embodiments of the present invention, creates in PHP interpreters Build PHP trace routines;The PHP interpreters are tracked using the PHP trace routines to be compiled for process The function information in the implementation procedure of the operation for obtaining is translated, function information here can be PHP functions All function informations 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, this Sample, can in real time obtain the function information in the implementation procedure of operation and be exported, therefore, it is possible to side Just the developer of PHP scripts quickly positions the problem of PHP scripts;But also can be according to the letter The resources occupation rate of application program, is detecting the presence of a certain application journey in number information monitor in real time processor When the resources occupation rate of degree is more than the pre-set ratio, then the inessential process is removed such that it is able to really Protect stable operating performance of the resources occupation rate more than the application program of the pre-set ratio.
Described above is only the general introduction of technical solution of the present invention, in order to better understand skill of the invention Art means, and can be practiced according to the content of specification, and it is of the invention above and other in order to allow Objects, features and advantages can become apparent, below especially exemplified by specific embodiment of the invention.
Brief description of the drawings
By reading the detailed description of hereafter optional embodiment, various other advantages and benefit are for this Field those of ordinary skill will be clear understanding.Accompanying drawing is only used for showing the purpose of optional embodiment, And it is not considered as limitation of the present invention.And in whole accompanying drawing, be denoted by the same reference numerals Identical part.In the accompanying drawings:
Fig. 1 shows a kind of the first flow of the method for process cleaning according to an embodiment of the invention Figure;
Fig. 2 shows a kind of second flow of the method for process cleaning according to an embodiment of the invention Figure;
Fig. 3 shows a kind of structure chart of the device of process cleaning according to an embodiment of the invention.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although being shown in accompanying drawing The exemplary embodiment of the disclosure, it being understood, however, that may be realized in various forms the disclosure without Should be limited by embodiments set forth here.Conversely, there is provided these embodiments are able to more thoroughly Understand the disclosure, and can by the scope of the present disclosure it is complete convey to those skilled in the art.
Referring to Fig. 1, a kind of method that process is cleared up is provided according to one embodiment of the invention, specifically may be used To comprise the following steps:
S101, the establishment PHP trace routines in PHP interpreters;And
S102, the PHP interpreters are tracked using the PHP trace routines obtained for process compiling Operation implementation procedure in function information;
S103, according to the function information, detect in application program corresponding with the function information whether There is application program of the resources occupation rate more than pre-set ratio;
S104, detect the presence of the resources occupation rate more than the pre-set ratio application program when, Inessential process is chosen from the process being currently running, and removes the inessential process.
Wherein, PHP scripts typically can be by morphology parsing, syntax parsing, volume in PHP interpreters Translate generation intermediate code and perform the steps such as intermediate code;Wherein, intermediate code is performed under default situations Step has been performed by the zend_execute function calls in zend/zend_vm_execute.h files Into for all of intermediate code, acquiescence realization is to perform in order, when function is run into Execution is jumped out, the position jumped out is returned after having performed and is continued executing with.
In step S101, PHP trace routines, the PHP tracking are created in PHP interpreters Program is specially PHPtrace functions, and PHPtrace functions are specifically a realization of class strace, different , strace is called for tracing system, and PHPtrace functions can be used for following the trail of PHP functions tune With so that the PHP trace routines for creating being capable of monitor in real time PHP function call informations.
Can be specifically a realization of class strace due to PHPtrace functions in specific implementation process, The PHP trace routines are created such that it is able to framework directly according to strace.
Next step S102 is performed, it is in this step, described using PHP trace routines tracking Function information in the implementation procedure of the operation that PHP interpreters are obtained for process compiling.
In specific implementation process, because the PHP trace routines are specifically a realization of class strace, Obtained for process compiling such that it is able to monitor the PHP interpreters using the PHP trace routines Operation implementation procedure in function information.
Specifically, being compiled for process by PHP interpreters described in the PHP trace routines monitor in real time The all function call informations in the implementation procedure of the operation for obtaining are translated, it is of course also possible to monitor described All function call informations of other scripts performed in PHP interpreters, the application is not specifically limited.
One of the core concepts of the embodiments of the present invention is that PHP tracking journeys are created in PHP interpreters Sequence, the PHP trace routines are specially PHPtrace functions, and PHPtrace functions can be specifically class One realization of strace, unlike, strace is called for tracing system, and PHPtrace functions Can be used for following the trail of PHP function calls, and then cause after the PHP trace routines are created, profit With described in the PHP trace routines operate (op, operation) implementation procedure in function information, Here function information can be PHP functions all function informations in the process of implementation, such as function name, The information such as function parameter, line number, filename, also, function can also be obtained after the completion of function execution The information such as return value, function call time, so, can in real time obtain the letter in the implementation procedure of operation Number information is simultaneously exported, and the developer therefore, it is possible to facilitate PHP scripts quickly positions PHP scripts Problem.
In actual applications, each information of the acquisition can be write * data files, and by the * data File is exported.Certainly, the embodiment of the present invention is not any limitation as to the specific way of output.
Next perform step S103, according to the function information, detect corresponding with the function information Application program in the presence or absence of resources occupation rate more than pre-set ratio application program.
In specific implementation process, in the implementation procedure for getting the operation by step S102 After function information, during step S103 is performed, due to the operation be with the processor The process of operation is corresponding, and process is corresponding with application program, such that it is able to be believed according to the function Breath, is capable of detecting when to be more than with the presence or absence of resources occupation rate in application program corresponding with the function information The application program of pre-set ratio, is detecting the presence of application journey of the resources occupation rate more than the pre-set ratio During sequence, step S104 is performed;Detecting the answering more than the pre-set ratio in the absence of resources occupation rate When using program, can continue keep the state, wherein, the function information include call function title, The information such as quantity.
Specifically, the pre-set ratio can set according to actual conditions, specifically could be arranged to not Numerical value less than 2%, for example, can be 2%, 3% etc., to ensure the operational efficiency of the processor, Wherein, the span of the resources occupation rate is 0~100%.
For example, the function detected using the PHP trace routines in the implementation procedure of the operation is believed After breath, the function information is analyzed, is accounted for for each resource for detecting a application programs With rate be 5% when, if the pre-set ratio be 2%, due to 2%<3%, then there is resources occupation rate big In the application program of the pre-set ratio, step S104 is performed.
In actual application, application of the resources occupation rate more than the pre-set ratio is being detected the presence of During program, and resources occupation rate is typically very important application more than the application program of the pre-set ratio Program, the application program can be, for example, AutoCAD for the corresponding application program of large-scale operational software, In this way, in order to ensure the stable operating performance of the application program, by removing the inessential process, being The processor cleans out more idling-resources, to cause application program resource in the process of running Ensured such that it is able to effectively improve the stable operating performance of the application program.
Detect the presence of the resources occupation rate more than the pre-set ratio application program when, perform step Rapid S104, chooses inessential process, and remove the inessential process from the process being currently running.
In specific implementation process, the resources occupation rate is being detected the presence of more than the pre-set ratio During application program, all processes being currently running in the processor are obtained, then choose described therefrom Inessential process, and remove the inessential process.
Specifically, when the inessential process is chosen, for the process being respectively currently running, examine first Whether survey process is the necessary process of system, if, it is determined that the process is not the inessential process, if It is not then to detect whether function corresponding with the process is called, if being not called upon, it is determined that the process It is the inessential process;Blacklist can certainly be set up for inessential process, by the processor In each process in all processes being currently running compare with the blacklist, from the treatment Be chosen in all processes being currently running in device process in the blacklist as it is described it is inessential enter Journey, the foundation of the blacklist can carry out Real-time Collection and enter by optimization tool, such as optimization great master etc. Journey and set up.
For example, it is a1, a2, b1 and b2 to set up the process that blacklist includes for inessential process, Then each process in all processes being currently running in the processor and the blacklist are entered Row is compared, and is detected in the processor and be there is a1 and b2 in all processes being currently running, by institute State and there is also a1 and b2 in blacklist, so, it may be determined that be all in the processor to be currently running Inessential process in process is a1 and b2, and removes a1 and b2 so that the money that a1 and b2 takes Source is released so that the utilization rate of the processor is minimized, and is that the processor is cleaned out more Idling-resource, to cause that application program resource in the process of running is ensured such that it is able to effectively Improve the stable operating performance of the application program.
In a kind of application scenarios of the invention, the execution of the address in the operation of variable can be monitored Information in journey, to realize the purpose of the PHP code for analyzing information of interest.Correspondingly, the profit The step of function information in the implementation procedure of the operation being tracked with the PHP trace routines, specifically Can include:According to information to be monitored to the side-play amount of the relatively preset global variable of dependent variable, obtain described The address of variable;And the PHP trace routines are utilized, the address of the variable is monitored in the behaviour Information in the implementation procedure of work.Wherein, the information to be monitored can be various information of interest, example Such as, it is possible to use GDB (GNU detects wrong device, GNU Debugger) obtains PHP script process The preset global variable of some cores, and the PHP trace routines are utilized, monitor the ground of the variable Information of the location in the implementation procedure of the operation.
In another application scenarios of the invention, " do not have when being shown in the online interface of PHP scripts Have file " and when there is this document in file, it is possible to use the PHP trace routines positioning is above-mentioned The reason for file inconsistence problems.Correspondingly, the function information in the implementation procedure for monitoring the operation In, it is found that the return value of function opendir () reports an error, and opendir () is for opening catalogue The function of handle, therefore be the reason for above-mentioned file inconsistence problems can be positioned:Catalogue is opened to go wrong, Rather than in file do not exist file.
Certainly, above-mentioned application scenarios are intended only as example, those skilled in the art can according to the actual requirements, The embodiment of the present invention is applied to other application scene, is such as used to position " certain function timing is long " The reason for, or, for positioning the reason for " it is long that PHP scripts perform the time " etc., the present invention is implemented Example is not any limitation as to specific application scenarios.
To sum up, the operation of PHP interpreters is performed function and replaces with preset monitoring by the embodiment of the present invention Function, and track what the PHP interpreters were obtained for process compiling using the PHP trace routines Function information in the implementation procedure of operation, function information here can performed for PHP functions All function informations in journey, 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, so, can With it is real-time obtain operation implementation procedure in function information and exported, therefore, it is possible to facilitate PHP The developer of script quickly positions the problem of PHP scripts;But also can be according to the function information The resources occupation rate of application program in monitor in real time processor, is detecting the presence of the money of a certain level of application When source occupancy is more than the pre-set ratio, then the inessential process is removed such that it is able to ensure resource Stable operating performance of the occupancy more than the application program of the pre-set ratio.
Referring to the method that Fig. 2, one embodiment of the invention provide a kind of cleaning of process, can specifically wrap Include following steps:
S201, the establishment PHP trace routines in PHP interpreters;
S202, by reading shared drive, judge whether the corresponding pilot switch of the process is opened;
S203, when the corresponding pilot switch of the process is opened, using the PHP trace routines with Function information in the implementation procedure of the operation that PHP interpreters described in track are obtained for process compiling;
S204, the function information is write into the shared drive, by command-line tool from it is described it is shared in Deposit the middle reading function information;
S205, according to the function information, detect in application program corresponding with the function information whether There is application program of the resources occupation rate more than pre-set ratio;
S206, detect the presence of the resources occupation rate more than the pre-set ratio application program when, Inessential process is chosen from the process being currently running, and removes the inessential process.
Relative to embodiment illustrated in fig. 1, the present embodiment creates PHP trace routines in PHP interpreters Afterwards, can in shared drive the corresponding pilot switch of storage process, and sentenced by reading shared drive Whether the corresponding pilot switch of the process of breaking is opened, such that it is able to be determined whether to open according to judged result Or close monitoring function;Wherein, when the corresponding pilot switch of the process is opened, monitoring can be opened Function, and track what the PHP interpreters were obtained for process compiling using the PHP trace routines Function information in the implementation procedure of operation;When the corresponding pilot switch of the process is closed, Ke Yiguan Close monitoring function.
In actual applications, it is the pilot switch of all processes in storage program area, can in shared drive With the pilot switch of the preset number that is stored with, preset number can be 2 as described16Etc., certainly, this Inventive embodiments are not any limitation as to the concrete numerical value of the preset number.
It is described that the function information is write into the shared drive in a kind of alternative embodiment of the invention The step of, can specifically include:The function information is write into process correspondence described in the shared drive Memory Mapping File.One region of address space can be retained by Memory Mapping File, while will Physical storage submits to this region, and simply the physical storage of memory limited has been deposited from one It is the file on disk, and the page file of nonsystematic, and it is necessary before being operated to this document File is mapped first, internal memory is loaded into from disk just as by whole file.It can thus be seen that When being stored in the file on disk using Memory Mapping File treatment, it will not be necessary to perform I/O to file again (defeated Enter/export, Input/Output) operation, it means that when processing file need not be again text Part application simultaneously distributes caching, and all of file cache operation is directly managed by operating system, due to cancelling File data is loaded into internal memory, data to be walked from the interior write-back for being stored to file and releasing memory block etc. Suddenly so that it is fast fast with reading that Memory Mapping File can play writing speed when the file of big data quantity is processed The fast effect of degree.Mmap files are a kind of example of Memory Mapping File, certain embodiment of the present invention pair Specific Memory Mapping File is not any limitation as.
In another embodiment, the invention provides a kind of method of process cleaning, methods described is also wrapped Include:
The operation that the PHP interpreters are obtained for process compiling is obtained using the PHP trace routines Implementation procedure in call stack information.
Relative to embodiment illustrated in fig. 1, the present embodiment is except can be with the execution of monitoring process respective operations Outside function information in journey, PHP interpreters can also be obtained using PHP trace routines lookup and held Call stack information in capable each operation implementation procedure, namely each of PHP interpreters execution can be provided The snapshot functions of the call stack information in operation implementation procedure, PHP is directly obtained relative to using pstack The call stack information of interpreter is merely capable of reflecting the execution information of PHP interpreters, for example:
pstack 3130
0x00000035ee6accc0 in__nanosleep_nocancel()from/lib64/libc.so.6
0x00000035ee6acb50 in sleep()from/lib64/libc.so.6
0x0000000000714f23 in zif_sleep()
0x00000000008e36cd in execute_internal()
0x00007f27b38b2b77 in phptrace_execute_core()from/home/renyongquan /opt/php5.4.35/lib/php/extensions/debug-non-zts-20100525/phptrace.so
0x00007f27b38b2c04 in phptrace_execute_internal()from/home/renyongq uan/opt/php5.4.35/lib/php/extensions/debug-non-zts-20100525/phptrace.so
0x00000000008e44bc in zend_do_fcall_common_helper_SPEC()
3130 for php-fpm process ID, the call stack of PHP interpreters when being viewed by pstack, But for a PHP developer, it is desirable that the call stack of PHP scripts in PHP interpreters, Can specifically be obtained by phptrace functions, it is specific as follows:
./phptrace-p 3130-s
phptrace 0.1demo,published by infra webcore team
Process id=3130
Script_filename=/home/renyongquan/opt/nginx//webapp/bloc k.php
[0x7f27b9a99dc8] sleep/home/renyongquan/opt/nginx/webapp/block.php:6
[0x7f27b9a99d08] say/home/renyongquan/opt/nginx/webapp/block.php:3
[0x7f27b9a99c50] run/home/renyongquan/opt/nginx/webapp/block.php:10
The first row of program output is version information, and the second row shows its process PID, and the third line is to work as The PHP scripts of preceding execution, are exactly call stack information since fourth line, from above- mentioned information as can be seen that Outermost layer run function calls say functions, finally have invoked sleep functions, in this way, can be by institute Stating PHPtrace functions can obtain the running state information of PHP scripts, therefore, it is possible to facilitate PHP pin This developer quickly positions the problem of PHP scripts.
For embodiment of the method, in order to be briefly described, therefore it is all expressed as a series of combination of actions, But those skilled in the art should know, the embodiment of the present invention is not limited by described sequence of movement System, because according to the embodiment of the present invention, some steps can sequentially or simultaneously be carried out using other.Its Secondary, those skilled in the art should also know, embodiment described in this description belongs to optional implementation Example, necessary to the involved action not necessarily embodiment of the present invention.
Based on technology design same as mentioned above, it is clear that one embodiment of the invention provides a kind of process The device of reason, referring to Fig. 3, described device includes:
Function creation unit 301, for creating PHP trace routines in PHP interpreters;
Monitoring unit 302, is directed to for tracking the PHP interpreters using the PHP trace routines Function information in the implementation procedure of the operation that process compiling is obtained;
Detection unit 303, for according to the function information, detecting answer corresponding with the function information With the application program in program with the presence or absence of resources occupation rate more than pre-set ratio;
Clearing cell 304, for detecting the presence of the resources occupation rate more than the pre-set ratio During application program, inessential process is chosen from the process being currently running, and remove the inessential process.
Specifically, monitoring unit 302, specifically includes:
Address acquisition subelement, for according to information to be monitored to the inclined of the relatively preset global variable of dependent variable Shifting amount, obtains the address of the variable;And
Monitoring subelement, for utilizing the PHP trace routines, monitors the address of the variable in institute State the information in the implementation procedure of operation.
Specifically, described device also includes:
Judging unit, for tracking the PHP interpreters pin using the PHP trace routines described Before function information in the implementation procedure of the operation obtained to process compiling, by reading shared drive, Judge whether the corresponding pilot switch of the process is opened;
Monitoring unit 302, specifically for when the corresponding pilot switch of the process is opened, using described PHP trace routines track the function information in the implementation procedure of the operation;
Then described device also includes:
Writing unit, for the function information to be write into the shared drive, by command-line tool from institute State and read the function information in shared drive.
Specifically, said write unit, specifically for by the function information write-in shared drive The corresponding Memory Mapping File of the process.
Specifically, described device also includes:
Stack information acquisition unit, for obtaining the PHP interpreters pin using the PHP trace routines Call stack information in the implementation procedure of the operation obtained to process compiling.
Specifically, the opening and closing of the pilot switch are controlled by the command-line tool.
In actual applications, described device and command-line tool can also be communicated by heartbeat mechanism, Wherein, described device and command-line tool can mutually send heartbeat message, wherein, when described device exists When the heartbeat message of command-line tool transmission is not received in heart beat cycle, it is believed that the communication connection of the two Disconnect, therefore monitoring function can be closed, to save the resource of necessary for monitoring.
A kind of method and device of process cleaning according to embodiments of the present invention, creates in PHP interpreters Build PHP trace routines;The PHP interpreters are tracked using the PHP trace routines to be compiled for process The function information in the implementation procedure of the operation for obtaining is translated, function information here can be PHP functions All function informations 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, this Sample, can in real time obtain the function information in the implementation procedure of operation and be exported, therefore, it is possible to side Just the developer of PHP scripts quickly positions the problem of PHP scripts;But also can be according to the letter The resources occupation rate of application program, is detecting the presence of a certain application journey in number information monitor in real time processor When the resources occupation rate of degree is more than the pre-set ratio, then the inessential process is removed such that it is able to really Protect stable operating performance of the resources occupation rate more than the application program of the pre-set ratio.
For device embodiment, because it is substantially similar to embodiment of the method, so the comparing of description Simply, the relevent part can refer to the partial explaination of embodiments of method.
Algorithm and display be not solid with any certain computer, virtual system or miscellaneous equipment provided herein There is correlation.Various general-purpose systems can also be used together with based on teaching in this.As described above, It is obvious to construct the structure required by this kind of system.Additionally, the present invention is not also for any specific Programming language.It is understood that, it is possible to use various programming languages realize the content of invention described herein, And the description done to language-specific above is to disclose preferred forms of the invention.
In specification mentioned herein, numerous specific details are set forth.It is to be appreciated, however, that this Inventive embodiment can be put into practice in the case of without these details.In some instances, not Known method, structure and technology are shown specifically, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help understand in each inventive aspect Or it is multiple, in above to the description of exemplary embodiment of the invention, each feature of the invention is sometimes It is grouped together into single embodiment, figure or descriptions thereof.However, should not be by the disclosure Method be construed to reflect following intention:I.e. the present invention for required protection requirement ratio is in each claim The middle more features of feature be expressly recited.More precisely, as the following claims reflect As, inventive aspect is all features less than single embodiment disclosed above.Therefore, it then follows Thus claims of specific embodiment are expressly incorporated in the specific embodiment, wherein each right It is required that in itself all as separate embodiments of the invention.
Those skilled in the art are appreciated that can be carried out certainly to the module in the equipment in embodiment Adaptively change and they are arranged in one or more equipment different from the embodiment.Can be with Module or unit or component in embodiment is combined into a module or unit or component, and in addition may be used To be divided into multiple submodule or subelement or sub-component.Except such feature and/or process or Outside at least some in unit exclude each other, can be using any combinations to this specification (including companion With claim, summary and accompanying drawing) disclosed in all features and so disclosed any method or All processes or unit of person's equipment are combined.Unless expressly stated otherwise, this specification (including companion With claim, summary and accompanying drawing) disclosed in each feature can it is identical by offers, equally or phase Replace like the alternative features of purpose.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include it Some included features are rather than further feature, but the group of the feature of different embodiments in its embodiment Conjunction means to be within the scope of the present invention and formed different embodiments.For example, in following power In sharp claim, the one of any of embodiment required for protection mode can make in any combination With.
All parts embodiment of the invention can be realized with hardware, or be processed with one or more The software module run on device is realized, or is realized with combinations thereof.Those skilled in the art should Understand, basis can be realized using microprocessor or digital signal processor (DSP) in practice The embodiment of the present invention process cleaning method and apparatus in some or all parts some or Repertoire.The present invention is also implemented as the part or complete for performing method as described herein The equipment or program of device (for example, computer program and computer program product) in portion.Such reality Existing program of the invention can be stored on a computer-readable medium, or can have one or more The form of signal.Such signal can be downloaded from Internet platform and obtained, or on carrier signal There is provided, or provided in any other form.
It should be noted that above-described embodiment the present invention will be described rather than limiting the invention, And those skilled in the art can design replacement without departing from the scope of the appended claims Embodiment.In the claims, any reference symbol being located between bracket should not be configured to right It is required that limitation.Word " including " do not exclude the presence of element or step not listed in the claims.Position Word "a" or "an" before element does not exclude the presence of element as multiple.The present invention can To be realized by means of the hardware for including some different elements and by means of properly programmed computer. If in the unit claim for listing equipment for drying, several in these devices can be by same Individual hardware branch is embodied.The use of word first, second, and third does not indicate that any order. These words can be construed to title.
The present invention discloses A1, a kind of method of process cleaning, it is characterised in that methods described includes:
PHP trace routines are created in PHP interpreters;
The operation that the PHP interpreters are obtained for process compiling is tracked using the PHP trace routines Implementation procedure in function information;
According to the function information, with the presence or absence of money in detection application program corresponding with the function information Application program of the source occupancy more than pre-set ratio;
Detect the presence of the resources occupation rate more than the pre-set ratio application program when, from Inessential process is chosen in the process of operation, and removes the inessential process.
A2, the method as described in A1, it is characterised in that described using PHP trace routines tracking Function information in the implementation procedure of the operation that the PHP interpreters are obtained for process compiling, specifically Including:
According to information to be monitored to the side-play amount of the relatively preset global variable of dependent variable, the variable is obtained Address;And
Using the PHP trace routines, the implementation procedure of the address in the operation of the variable is monitored In information.
A3, the method as described in A1, it is characterised in that it is described using the PHP trace routines with Before function information in the implementation procedure of the operation that PHP interpreters described in track are obtained for process compiling, Methods described also includes:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
It is described using PHP trace routines tracking when the corresponding pilot switch of the process is opened Function information in the implementation procedure of operation;
The function information is write into the shared drive, is read from the shared drive by command-line tool Take the function information.
A4, the method as described in A3, it is characterised in that described that function information write-in is described common The step of enjoying internal memory, 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, it is characterised in that methods described is also wrapped Include:
The operation that the PHP interpreters are obtained for process compiling is obtained using the PHP trace routines Implementation procedure in call stack information.
A6, the method as described in A3, it is characterised in that the opening and closing of the pilot switch are by institute State command-line tool control.
B7, a kind of device of process cleaning, it is characterised in that described device includes:
Function creation unit, for creating PHP trace routines in PHP interpreters;
Monitoring unit, process is directed to for tracking the PHP interpreters using the PHP trace routines Function information in the implementation procedure of the operation that compiling is obtained;
Detection unit, for according to the function information, detecting application journey corresponding with the function information Application program in sequence with the presence or absence of resources occupation rate more than pre-set ratio;
Clearing cell, for detecting the presence of application of the resources occupation rate more than the pre-set ratio During program, inessential process is chosen from the process being currently running, and remove the inessential process.
B8, the device as described in B7, it is characterised in that the monitoring unit, specifically include:
Address acquisition subelement, for according to information to be monitored to the inclined of the relatively preset global variable of dependent variable Shifting amount, obtains the address of the variable;And
Monitoring subelement, for utilizing the PHP trace routines, monitors the address of the variable in institute State the information in the implementation procedure of operation.
B9, the device as described in B7, it is characterised in that described device also includes:
Judging unit, for tracking the PHP interpreters pin using the PHP trace routines described Before function information in the implementation procedure of the operation obtained to process compiling, by reading shared drive, Judge whether the corresponding pilot switch of the process is opened;
The monitoring unit, specifically for when the corresponding pilot switch of the process is opened, using described PHP trace routines track the function information in the implementation procedure of the operation;
Then described device also includes:
Writing unit, for the function information to be write into the shared drive, by command-line tool from institute State and read the function information in shared drive.
B10, the device as described in B9, it is characterised in that said write unit, specifically for by institute State function information and write the corresponding Memory Mapping File of process described in the shared drive.
B11, the device as described in B7 or B8 or B9 or B10, it is characterised in that described device is also Including:
Stack information acquisition unit, for obtaining the PHP interpreters pin using the PHP trace routines Call stack information in the implementation procedure of the operation obtained to process compiling.
B12, the device as described in B9, it is characterised in that the opening and closing of the pilot switch by The command-line tool control.

Claims (10)

1. a kind of method that process is cleared up, it is characterised in that methods described includes:
PHP trace routines are created in PHP interpreters;
The operation that the PHP interpreters are obtained for process compiling is tracked using the PHP trace routines Implementation procedure in function information;
According to the function information, with the presence or absence of money in detection application program corresponding with the function information Application program of the source occupancy more than pre-set ratio;
Detect the presence of the resources occupation rate more than the pre-set ratio application program when, from Inessential process is chosen in the process of operation, and removes the inessential process.
2. the method for claim 1, it is characterised in that described to track journey using the PHP Sequence tracks the function information in the implementation procedure of the operation that the PHP interpreters are obtained for process compiling, Specifically include:
According to information to be monitored to the side-play amount of the relatively preset global variable of dependent variable, the variable is obtained Address;And
Using the PHP trace routines, the implementation procedure of the address in the operation of the variable is monitored In information.
3. the method for claim 1, it is characterised in that described using PHP tracking Program tracks the function letter in the implementation procedure of the operation that the PHP interpreters are obtained for process compiling Before breath, methods described also includes:
By reading shared drive, judge whether the corresponding pilot switch of the process is opened;
It is described using PHP trace routines tracking when the corresponding pilot switch of the process is opened Function information in the implementation procedure of operation;
The function information is write into the shared drive, is read from the shared drive by command-line tool Take the function information.
4. method as claimed in claim 3, it is characterised in that described by function information write-in The step of shared drive, including:
The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
5. method as claimed in claim 1 or 2 or 3 or 4, it is characterised in that methods described is also Including:
The operation that the PHP interpreters are obtained for process compiling is obtained using the PHP trace routines Implementation procedure in call stack information.
6. method as claimed in claim 3, it is characterised in that the unlatching of the pilot switch and pass Close and controlled by the command-line tool.
7. the device that a kind of process is cleared up, it is characterised in that described device includes:
Function creation unit, for creating PHP trace routines in PHP interpreters;
Monitoring unit, process is directed to for tracking the PHP interpreters using the PHP trace routines Function information in the implementation procedure of the operation that compiling is obtained;
Detection unit, for according to the function information, detecting application journey corresponding with the function information Application program in sequence with the presence or absence of resources occupation rate more than pre-set ratio;
Clearing cell, for detecting the presence of application of the resources occupation rate more than the pre-set ratio During program, inessential process is chosen from the process being currently running, and remove the inessential process.
8. device as claimed in claim 7, it is characterised in that the monitoring unit, specifically includes:
Address acquisition subelement, for according to information to be monitored to the inclined of the relatively preset global variable of dependent variable Shifting amount, obtains the address of the variable;And
Monitoring subelement, for utilizing the PHP trace routines, monitors the address of the variable in institute State the information in the implementation procedure of operation.
9. device as claimed in claim 7, it is characterised in that described device also includes:
Judging unit, for tracking the PHP interpreters pin using the PHP trace routines described Before function information in the implementation procedure of the operation obtained to process compiling, by reading shared drive, Judge whether the corresponding pilot switch of the process is opened;
The monitoring unit, specifically for when the corresponding pilot switch of the process is opened, using described PHP trace routines track the function information in the implementation procedure of the operation;
Then described device also includes:
Writing unit, for the function information to be write into the shared drive, by command-line tool from institute State and read the function information in shared drive.
10. device as claimed in claim 9, it is characterised in that said write unit, specifically for The function information is write into the corresponding Memory Mapping File of process described in the shared drive.
CN201510984720.0A 2015-12-24 2015-12-24 A kind of method and device of process cleaning Pending CN106897050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510984720.0A CN106897050A (en) 2015-12-24 2015-12-24 A kind of method and device of process cleaning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510984720.0A CN106897050A (en) 2015-12-24 2015-12-24 A kind of method and device of process cleaning

Publications (1)

Publication Number Publication Date
CN106897050A true CN106897050A (en) 2017-06-27

Family

ID=59190795

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510984720.0A Pending CN106897050A (en) 2015-12-24 2015-12-24 A kind of method and device of process cleaning

Country Status (1)

Country Link
CN (1) CN106897050A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861878A (en) * 2017-11-22 2018-03-30 泰康保险集团股份有限公司 The method, apparatus and equipment of java application performance issue positioning

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946486A (en) * 2012-11-20 2013-02-27 惠州Tcl移动通信有限公司 Background application automatic clearing method based on mobile phone and mobile phone
CN103024538A (en) * 2012-11-12 2013-04-03 北京奇虎科技有限公司 Memory management method and system
CN103092700A (en) * 2013-02-01 2013-05-08 华为终端有限公司 Internal memory cleaning method and cleaning device and terminal device
CN103345397A (en) * 2013-07-11 2013-10-09 北京奇虎科技有限公司 Method and device for cleaning processes of mobile terminal
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
CN103024538A (en) * 2012-11-12 2013-04-03 北京奇虎科技有限公司 Memory management method and system
CN102946486A (en) * 2012-11-20 2013-02-27 惠州Tcl移动通信有限公司 Background application automatic clearing method based on mobile phone and mobile phone
CN103092700A (en) * 2013-02-01 2013-05-08 华为终端有限公司 Internal memory cleaning method and cleaning device and terminal device
CN103345397A (en) * 2013-07-11 2013-10-09 北京奇虎科技有限公司 Method and device for cleaning processes of mobile terminal
CN104536870A (en) * 2014-12-31 2015-04-22 北京奇虎科技有限公司 Process monitoring method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
山外青山: ""phptrace统计功能"", 《HTTP:UDN.YYUAP.COM/THREAD-42551-1-1.HTML》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861878A (en) * 2017-11-22 2018-03-30 泰康保险集团股份有限公司 The method, apparatus and equipment of java application performance issue positioning

Similar Documents

Publication Publication Date Title
US9594754B2 (en) Purity analysis using white list/black list analysis
Qi et al. Darwin: An approach to debugging evolving programs
Taneja et al. eXpress: guided path exploration for efficient regression test generation
Nguyen et al. Studying the impact of dependency network measures on software quality
KR20190041912A (en) System for detecting security vulnerability based on binary, method and program thereof
WO2014074166A1 (en) Selecting functions for memoization analysis
CN104536870B (en) A kind of process monitoring method and device
US20120246186A1 (en) Dynamic query-based debug point mapper
CN105164642B (en) The operating system of contract is supported
Le Segmented symbolic analysis
Chen et al. Test generation for embedded executables via concolic execution in a real environment
US20160077950A1 (en) Methods, circuits, apparatus, systems and associated software modules for evaluating code behavior
Christakis et al. Bounded abstract interpretation
CN106897050A (en) A kind of method and device of process cleaning
CN106897051A (en) A kind of method and device of process cleaning
Hu et al. File parsing vulnerability detection with symbolic execution
Gonzalez-Herrera et al. ScapeGoat: Spotting abnormal resource usage in component-based reconfigurable software systems
CN111176980A (en) Data analysis method, device and system with separated debugging environment and running environment
EP2972880A1 (en) Kernel functionality checker
CN106897083A (en) A kind of method and device of security sweep
Kashif et al. INSTEP: A static instrumentation framework for preserving extra-functional properties
Ehlers Self-adaptive performance monitoring for component-based software systems
Zhang et al. Ffuzz: Towards full system high coverage fuzz testing on binary executables
Meng et al. Interactive WCET prediction with warning for timeout risk
Viticchié et al. Remotely assessing integrity of software applications by monitoring invariants: Present limitations and future directions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170627

RJ01 Rejection of invention patent application after publication