CN104881323A - Method and system for preventing mobile terminal from crashing - Google Patents

Method and system for preventing mobile terminal from crashing Download PDF

Info

Publication number
CN104881323A
CN104881323A CN201510303835.9A CN201510303835A CN104881323A CN 104881323 A CN104881323 A CN 104881323A CN 201510303835 A CN201510303835 A CN 201510303835A CN 104881323 A CN104881323 A CN 104881323A
Authority
CN
China
Prior art keywords
cpu resource
application program
resource value
value
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510303835.9A
Other languages
Chinese (zh)
Other versions
CN104881323B (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201510303835.9A priority Critical patent/CN104881323B/en
Publication of CN104881323A publication Critical patent/CN104881323A/en
Application granted granted Critical
Publication of CN104881323B publication Critical patent/CN104881323B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a system for preventing a mobile terminal from crashing. The method comprises the following steps of (1) acquiring CPU (central processing unit) resource occupation values of application programs of the mobile terminal one by one when the application programs run for the first time and calculating the sum Xm of the CPU resource occupation values of all the application programs when the application programs run for the first time; (2) recording the CPU resource occupation values X1-Xn of the application programs n times recently when running application programs are detected one by one and calculating an average value Ym of the CPU resource occupation values of the application programs n times recently; and (3) judging whether Xm is greater than or equal to N*Ym, continuing detecting the application programs if Xm is greater than or equal to N*Ym and finishing the application programs if Xm is not greater than or equal to N*Ym. Moreover, n and N are preset constant values. The sum Xm of the CPU resource occupation values of all the application programs is calculated, the values of the application programs which run several times recently are acquired one by one, the average value of the CPU resource occupation values of the application programs which run several times recently is calculated, the value of Xm and the value of Ym are compared, if Xm is not greater than or equal to N*Ym, the application programs are finished automatically, crashing of the mobile phone can be prevented, and user experiences are improved.

Description

A kind of method and system avoiding mobile terminal to crash
Technical field
The present invention relates to deadlock Programmable detection technology, particularly relate to a kind of method and system avoiding mobile terminal to crash.
Background technology
Application program, refer to the computer program for completing a certain or multinomial particular job, it operates in user model, can carry out alternately, having visual user interface with user.Application program is divided into two parts again usually: it is different from the concept of application software for graphical user interface (GUI) and engine (Engien).Application software refers to the object classification used, and can be the set of single program or other slave component, such as Microsoft Office, OpenOffice.Application program refers to single executable file or single program, such as Word, Photoshop.Both carefully can not be distinguished in daily.General visual range sequence is an ingredient of software.
In general, mobile terminal hardware be do not allow very much perishable.The possibility that internal memory goes wrong is also little, and the reason of Memory Allocation failure fault is a lot, and the version of Out of Memory, system function does not mate etc. all may have impact.Therefore, this distribution is unsuccessfully more common in operating system and is used for a long time, has installed multiple application program, after have changed a large amount of systematic parameters and system file.
In the special intelligent Web epoch, mobile terminal is universal in people's hand, and mobile terminal crashes or certain program endless loop, and people understand duplicate removal and open mobile phone, and restarts mobile phone and need to waste a large amount of time, affects Consumer's Experience.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, a kind of method and system avoiding mobile terminal to crash are provided, automatically close the program that may cause system in case of system halt, avoid system in case of system halt, improve Consumer's Experience.
In order to achieve the above object, the technical solution used in the present invention is:
Avoid the method that mobile terminal crashes, comprise the steps:
Step 1. obtains one by one when application program for mobile terminal runs for the first time and takies cpu resource value, calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Step 2. detects application program when running one by one, and record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value;
Step 3. judges whether to meet Xm >=N*Ym, and N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.
Further, step 1 specifically comprises:
Step 101. arranges a trace routine, runs application program for mobile terminal one by one, obtains the cpu resource value taken when application program is run;
Step 102. calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Step 103. will take cpu resource value summation Xm and write in initial register.
Further, step 1 also comprises:
Step 104. trace routine detects in real time installs or unloading with or without application program;
Step 105. adjustment takies the value of cpu resource value summation Xm, in write initial register.
Further, step 105 specifically comprises:
When there being application program to install, trace routine runs new application program of installing, obtain the cpu resource value taken when application program is run, and on the upper basis taking cpu resource value summation Xm once writing initial register, increase the cpu resource value taken when new application program of installing is run, in write initial register;
When there being application program to unload, trace routine obtains the cpu resource value taken when this application program is run, and the cpu resource value taken when deducting the application program operation of unloading on the upper basis taking cpu resource value summation Xm once writing initial register, in write initial register.
Further, step 3 specifically comprises:
Step 301. obtains the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-sets a positive integer N, and formula Xm >=N*Y is set up;
Step 302. judges the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, whether meets Xm >=N*Ym, is, continues to detect, otherwise terminates this application program.
Further, described N, for pre-seting, adjusts as the case may be.
The present invention also discloses a kind of system avoiding mobile terminal to crash, and comprising:
Acquisition module, takies cpu resource value for obtaining one by one when application program for mobile terminal runs for the first time, calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Detection module, for detect one by one application program run time, record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value;
Judge module, meets Xm >=N*Ym for judging whether, N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.
Further, acquisition module comprises:
Module being set, for arranging a trace routine, running application program for mobile terminal one by one, obtain the cpu resource value taken when application program is run;
Computing module, takies cpu resource value summation Xm for calculating when all application programs are run for the first time;
Preserve module, write in initial register for cpu resource value summation Xm will be taken.
Further, acquisition module also comprises:
Upgrade detection module, detect in real time for trace routine and install or unloading with or without application program;
Adjusting module, for adjusting the value taking cpu resource value summation Xm, in write initial register.
Further, judge module comprises:
Module being set, for obtaining the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-seting a positive integer N, formula Xm >=N*Y is set up;
Whether execution module, for judging the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, meeting Xm >=N*Ym, being, continues to detect, otherwise terminate this application program.
Compared with prior art, the invention has the beneficial effects as follows: take cpu resource value summation Xm by calculating all application programs, value several times recently when running by obtaining application program one by one, calculate mean value several times recently, compare the relation of the value of Xm and Ym again, if Xm >=NYm terminates this process automatically, can prevent mobile terminal from crashing in advance, improve Consumer's Experience.
Accompanying drawing explanation
Fig. 1 is method flow diagram of the present invention;
fig. 2 is specific embodiments of the invention process flow diagram.
Embodiment
Purport of the present invention is to overcome the deficiencies in the prior art, a kind of method and system avoiding mobile terminal to crash are provided, system is understood oneself and is detected cpu resource value Xm, and calculate the mean value Ym of nearest n time, such as, n can be the reference number of times of 5 times or other users needs, compare the relation of the value of Xm and Ym again, if Xm >=N*Ym terminates this process automatically, can prevent mobile phone from crashing in advance, improve Consumer's Experience.Be described in detail, to be interpretated more in-depth technical characteristic of the present invention and advantage with reference to accompanying drawing below in conjunction with embodiment.
As shown in Figure 1, a kind of method avoiding mobile terminal to crash, comprises following four steps to method flow diagram of the present invention.
Step 1 of the present invention is as follows: obtain one by one when application program for mobile terminal runs for the first time and take cpu resource value, calculate when all application programs are run for the first time and take cpu resource value summation Xm.Generally, user installation is many especially in the program of mobile terminal system, such as game, amusement, chat etc., also has the program that carries of system, obtains all systems and adds up and take cpu resource value summation Xm.
As preferred embodiment of the present invention, step 1 of the present invention specifically comprises:
Step 101. arranges a trace routine, runs application program for mobile terminal one by one, obtains the cpu resource value taken when application program is run; Such as a testing software can be installed herein, open application program one by one by testing software, obtain each application program and take cpu resource value, and each application program is taken cpu resource value record save;
Step 102. calculates when all application programs are run for the first time and takies cpu resource value summation Xm; Calculated when all application programs are run for the first time by test procedure and take cpu resource value summation Xm, calculating comprehensive Xm is herein difference between resource value in order to add up Xm and CPU; If Xm is greater than cpu resource value summation, then get the resource value that Xm is CPU; If Xm is less than cpu resource value summation, then get the value of Xm;
Step 103. will take cpu resource value summation Xm and write in initial register, after obtaining above Xm value, for subsequent use in write initial register.
In actual motion, mobile terminal changes along with the demand of user, can constantly install or unloading application program, and as can be seen here, the value of Xm is constantly change and adjustment in fact, and thus, the step 1 of method of the present invention also comprises:
Step 104. trace routine detects in real time installs or unloading with or without application program; An entertainment software has such as newly been installed, or a unloading video software etc.;
Step 105. adjustment takies the value of cpu resource value summation Xm, in write initial register.Concrete adjustment comprises:
When there being application program to install, trace routine runs new application program of installing, obtain the cpu resource value taken when application program is run, and on the upper basis taking cpu resource value summation Xm once writing initial register, increase the cpu resource value taken when new application program of installing is run, in write initial register;
When there being application program to unload, trace routine obtains the cpu resource value taken when this application program is run, and the cpu resource value taken when deducting the application program operation of unloading on the upper basis taking cpu resource value summation Xm once writing initial register, in write initial register.
Step 2 of the present invention is as follows: detect application program one by one when running, record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value.Such as, system can arrange nearest 5 times and take cpu resource value X1 ~ X5, so mean value Ym=(X1+X2+X3+X4+X5)/5, the value of certain n can adjust according to actual conditions, if application program takies cpu resource value stabilization, so n can be set to get mean value several times less, if application program takies cpu resource value instability, so n needs to be set to the mean value got several times more, and the mean value reference value of acquisition is larger like this.
Step 3 of the present invention is as follows: judge whether to meet Xm >=N*Ym, and N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.Described N, for pre-seting, adjusts as the case may be.N can be set by the user, also can by systemic presupposition value.
As preferred embodiment of the present invention, step 3 of the present invention specifically comprises:
Step 301. obtains the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-sets a positive integer N, and formula Xm >=N*Y is set up; In order to arrange the threshold values that prevents system in case of system halt when arranging formula Xm >=N*Y, when this formula is set up, the probability that system occurs to crash is smaller, when this formula is false, then there is the likelihood ratio of deadlock comparatively greatly in system, and at this time system needs take measures shutdown system or other treatment measures;
Step 302. judges the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, whether meets Xm >=N*Ym, is, continues to detect, otherwise terminates this application program.Such as, n=5, so Ym=(X1+X2+X3+X4+X5)/5, if meet Xm >=N*Ym, illustrate and this time run this application program without deadlock risk, if do not meet Xm >=N*Ym, there is deadlock risk, now terminate this application program.
As shown in Figure 2, concrete implementation step is as follows for specific embodiments of the invention:
A. installation testing software or detection application; User installation detects application, and inputs N value, and N value is positive integer, is greater than several times on average takies cpu resource value Xm for judgement, and user can modify according to maloperation below this value, and detection is run in backstage always;
B., when first time opens application, what obtain each application one by one initially takies cpu resource value; When system opens application, trace routine also records Xm, records the nearest X1-X5 run for 5 times
C. write in initial register;
D. calculating all application initial resource occupation value Xm after completing;
When e. calculating the operation of a certain application program, nearest the mean value Ym taking cpu resource for 5 times, Ym=(X1+X2+X3+X4+X5)/5;
F. judge whether Xm >=N*Ym meets, and is, returns step e, otherwise perform step g;
G. return zero and send the instruction terminating this application program to CPU, CPU, terminate this program.
The present invention also discloses a kind of system avoiding mobile terminal to crash, and comprising:
Acquisition module, takies cpu resource value for obtaining one by one when application program for mobile terminal runs for the first time, calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Detection module, for detect one by one application program run time, record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value;
Judge module, meets Xm >=N*Ym for judging whether, N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.
Further, acquisition module comprises:
Module being set, for arranging a trace routine, running application program for mobile terminal one by one, obtain the cpu resource value taken when application program is run;
Computing module, takies cpu resource value summation Xm for calculating when all application programs are run for the first time;
Preserve module, write in initial register for cpu resource value summation Xm will be taken.
Further, acquisition module also comprises:
Upgrade detection module, detect in real time for trace routine and install or unloading with or without application program;
Adjusting module, for adjusting the value taking cpu resource value summation Xm, in write initial register.
Further, judge module comprises:
Module being set, for obtaining the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-seting a positive integer N, formula Xm >=N*Y is set up;
Whether execution module, for judging the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, meeting Xm >=N*Ym, being, continues to detect, otherwise terminate this application program.
Carry out clear, complete description by the technical scheme in above embodiment to the present invention, obviously described embodiment is the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.

Claims (10)

1. the method avoiding mobile terminal to crash, comprises the steps:
Step 1. obtains one by one when application program for mobile terminal runs for the first time and takies cpu resource value, calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Step 2. detects application program when running one by one, and record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value;
Step 3. judges whether to meet Xm >=N*Ym, and N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.
2. the method avoiding mobile terminal to crash according to claim 1, it is characterized in that, step 1 specifically comprises:
Step 101. arranges a trace routine, runs application program for mobile terminal one by one, obtains the cpu resource value taken when application program is run;
Step 102. calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Step 103. will take cpu resource value summation Xm and write in initial register.
3. the method avoiding mobile terminal to crash according to claim 2, it is characterized in that, step 1 also comprises:
Step 104. trace routine detects in real time installs or unloading with or without application program;
Step 105. adjustment takies the value of cpu resource value summation Xm, in write initial register.
4. the method avoiding mobile terminal to crash according to claim 3, it is characterized in that, step 105 specifically comprises:
When there being application program to install, trace routine runs new application program of installing, obtain the cpu resource value taken when application program is run, and on the upper basis taking cpu resource value summation Xm once writing initial register, increase the cpu resource value taken when new application program of installing is run, in write initial register;
When there being application program to unload, trace routine obtains the cpu resource value taken when this application program is run, and the cpu resource value taken when deducting the application program operation of unloading on the upper basis taking cpu resource value summation Xm once writing initial register, in write initial register.
5. the method avoiding mobile terminal to crash according to claim 1, it is characterized in that, step 3 specifically comprises:
Step 301. obtains the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-sets a positive integer N, and formula Xm >=N*Y is set up;
Step 302. judges the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, whether meets Xm >=N*Ym, is, continues to detect, otherwise terminates this application program.
6. the method avoiding mobile terminal to crash according to claim 5, is characterized in that, described N, for pre-seting, adjusts as the case may be.
7. the system avoiding mobile terminal to crash, comprising:
Acquisition module, takies cpu resource value for obtaining one by one when application program for mobile terminal runs for the first time, calculates when all application programs are run for the first time and takies cpu resource value summation Xm;
Detection module, for detect one by one application program run time, record and take cpu resource value X1 ~ Xn for n time recently, calculate the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time, n is for pre-seting definite value;
Judge module, meets Xm >=N*Ym for judging whether, N is predetermined fixed value, is, continues to detect, otherwise terminates this application program.
8. the system avoiding mobile terminal to crash according to claim 7, it is characterized in that, acquisition module comprises:
Module being set, for arranging a trace routine, running application program for mobile terminal one by one, obtain the cpu resource value taken when application program is run;
Computing module, takies cpu resource value summation Xm for calculating when all application programs are run for the first time;
Preserve module, write in initial register for cpu resource value summation Xm will be taken.
9. the method avoiding mobile terminal to crash according to claim 8, it is characterized in that, acquisition module also comprises:
Upgrade detection module, detect in real time for trace routine and install or unloading with or without application program;
Adjusting module, for adjusting the value taking cpu resource value summation Xm, in write initial register.
10. the method avoiding mobile terminal to crash according to claim 7, it is characterized in that, judge module comprises:
Module being set, for obtaining the maximal value Y taking cpu resource value when all application programs are run for the first time, pre-seting a positive integer N, formula Xm >=N*Y is set up;
Whether execution module, for judging the nearest mean value Ym taking cpu resource value X1 ~ Xn for n time of application program, meeting Xm >=N*Ym, being, continues to detect, otherwise terminate this application program.
CN201510303835.9A 2015-06-05 2015-06-05 A kind of method and system for avoiding mobile terminal from crashing Active CN104881323B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510303835.9A CN104881323B (en) 2015-06-05 2015-06-05 A kind of method and system for avoiding mobile terminal from crashing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510303835.9A CN104881323B (en) 2015-06-05 2015-06-05 A kind of method and system for avoiding mobile terminal from crashing

Publications (2)

Publication Number Publication Date
CN104881323A true CN104881323A (en) 2015-09-02
CN104881323B CN104881323B (en) 2018-03-30

Family

ID=53948829

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510303835.9A Active CN104881323B (en) 2015-06-05 2015-06-05 A kind of method and system for avoiding mobile terminal from crashing

Country Status (1)

Country Link
CN (1) CN104881323B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108874546A (en) * 2018-06-26 2018-11-23 郑州云海信息技术有限公司 A kind of system and method that linux optimization resource uses

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102306095A (en) * 2011-07-21 2012-01-04 宇龙计算机通信科技(深圳)有限公司 Application management method and terminal
US8230429B2 (en) * 2008-05-30 2012-07-24 International Business Machines Corporation Detecting a deadlock condition by monitoring firmware inactivity during the system IPL process
CN103927230A (en) * 2014-03-25 2014-07-16 优视科技有限公司 Memory usage feedback method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8230429B2 (en) * 2008-05-30 2012-07-24 International Business Machines Corporation Detecting a deadlock condition by monitoring firmware inactivity during the system IPL process
CN102306095A (en) * 2011-07-21 2012-01-04 宇龙计算机通信科技(深圳)有限公司 Application management method and terminal
CN103927230A (en) * 2014-03-25 2014-07-16 优视科技有限公司 Memory usage feedback method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108874546A (en) * 2018-06-26 2018-11-23 郑州云海信息技术有限公司 A kind of system and method that linux optimization resource uses
CN108874546B (en) * 2018-06-26 2021-09-28 郑州云海信息技术有限公司 Linux system and method for optimizing resource use

Also Published As

Publication number Publication date
CN104881323B (en) 2018-03-30

Similar Documents

Publication Publication Date Title
US11226804B2 (en) Staged rollout framework for feature release
AU2011299337B2 (en) Controlled automatic healing of data-center services
CN106407052B (en) A kind of method and device detecting disk
CN110730136B (en) Method, device, server and storage medium for realizing flow control
US8756600B2 (en) Judging apparatus, method, and recording medium of program for estimating the effect of deployment of an application in a virtual machine environment
CN105760230B (en) A kind of method and device of adjust automatically cloud host operation
CN109408328A (en) A kind of monitoring method, device and the equipment of hard disk health status
CN107273182B (en) Method and system for dynamically expanding virtual machine resources
CN110795284B (en) Data recovery method, device and equipment and readable storage medium
CN106940671B (en) Method, device and system for monitoring running of task threads in cluster
CN102646066B (en) Method and device for obtaining starting-up time
CN105302611A (en) Method and system for starting computer system under Linux
US9727406B2 (en) Mitigating crashes of an application server executing a monitoring agent
WO2013107694A4 (en) In situ processor re-characterization
CN109375956B (en) Method for restarting operating system, logic device and control device
CN106951321B (en) Method and device for managing CPU (Central processing Unit) resources of virtual machine
US20130151696A1 (en) Trigger method of computational procedure for virtual maching migration and application program for the same
CN106293805A (en) The method and device that program loads
CN111983412A (en) Monitoring system, monitoring method, monitoring terminal and storage medium
CN103309764A (en) Method and device for protection of fault-tolerant mechanism of virtual machine
CN104881323A (en) Method and system for preventing mobile terminal from crashing
US20160124765A1 (en) Resource allocation apparatus, method, and storage medium
CN107018039B (en) Method and device for testing performance bottleneck of server cluster
CN104199768A (en) Multi-core processor setting method and device
CN117149482A (en) Method and device for detecting thread state, electronic equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.