CN105893221B - The alarm method and device of terminal operating duration - Google Patents

The alarm method and device of terminal operating duration Download PDF

Info

Publication number
CN105893221B
CN105893221B CN201610207472.3A CN201610207472A CN105893221B CN 105893221 B CN105893221 B CN 105893221B CN 201610207472 A CN201610207472 A CN 201610207472A CN 105893221 B CN105893221 B CN 105893221B
Authority
CN
China
Prior art keywords
terminal
operating duration
terminal operating
journal file
warning information
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.)
Expired - Fee Related
Application number
CN201610207472.3A
Other languages
Chinese (zh)
Other versions
CN105893221A (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 CN201610207472.3A priority Critical patent/CN105893221B/en
Publication of CN105893221A publication Critical patent/CN105893221A/en
Application granted granted Critical
Publication of CN105893221B publication Critical patent/CN105893221B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

The embodiment of the invention discloses a kind of alarm methods of terminal operating duration, comprising: the journal file of reading terminals;The terminal available machine time is obtained by parsing the journal file;Terminal operating duration is detected according to the terminal available machine time, when the terminal operating duration detected belongs to preset threshold interval, corresponding warning information is triggered and triggers corresponding warning information.In addition, the embodiment of the present invention also accordingly discloses a kind of alarm device of terminal operating duration.Using the present invention, the effective rate of utilization of system resource can be improved, increase terminal cruise duration.

Description

The alarm method and device of terminal operating duration
Technical field
The present invention relates to field of computer technology more particularly to a kind of alarm methods and device of terminal operating duration.
Background technique
In the prior art based on the terminal of android system, during the operation after terminal unlatching, with user The increase of the time used and the increase of the number of applications used, the application program of terminal operating can be more and more; User during use also can be by certain closing application programs, but not all application program in running background It will be closed by the user, so that the application program of running background is more and more, the load of system operation increases, and be easy to cause Caton Phenomena such as.Further, the background program of running background in the process of running, it is also desirable to consume electricity and the shifting of terminal Dynamic data traffic, the consumption for resulting in terminal electricity and mobile data flow in the incognizant situation of user are excessive.
That is, the terminal based on android system is during use with terminal operating in the prior art The increase of time has that the effective rate of utilization of system resource is low, terminal is short cruise duration.
Summary of the invention
Based on this, to solve the terminal based on android system in traditional technology during use with terminal The time of operation increases the technical problem that there are the effective rates of utilization of system resource is low, terminal cruise duration is short, and spy proposes A kind of alarm method of terminal operating duration.
A kind of alarm method of terminal operating duration, comprising:
The journal file of reading terminals;
The terminal available machine time is obtained by parsing the journal file;
Terminal operating duration is detected according to the terminal available machine time, is belonged in the terminal operating duration detected pre- If threshold interval when, trigger corresponding warning information.
Optionally, in one of the embodiments, the journal file of the reading terminals the step of further include: by described The journal file of the shell interface input dmesg instruction reading terminals linux kernel of terminal.
Optionally, in one of the embodiments, the journal file of the reading terminals the step of further include: by described The journal file of the shell interface input logcat instruction reading terminals android system of terminal.
Optionally, the preset threshold interval has at least one in one of the embodiments, and each preset threshold Value section is corresponding with corresponding warning information;It is described to belong to preset threshold interval in the terminal operating duration detected When, the step of triggering corresponding warning information further include: threshold interval belonging to the terminal operating duration is searched, described in acquisition The corresponding warning information of the threshold interval found simultaneously triggers.
Optionally, described in one of the embodiments, that terminal operating duration is detected according to the terminal available machine time After step further include: judge whether the terminal operating duration is greater than preset threshold value, if so, restarting the terminal.
In addition, to solve the terminal based on android system in traditional technology during use as terminal is transported The capable time increases the technical problem that there are the effective rates of utilization of system resource is low, terminal cruise duration is short, and spy proposes one The alarm device of kind terminal operating duration.
A kind of alarm device of terminal operating duration, comprising:
Journal file read module, the journal file for reading terminals;
The terminal available machine time obtains module, for obtaining the terminal available machine time by parsing the journal file;
Warning information trigger module, for detecting terminal operating duration according to the terminal available machine time, in the detection To terminal operating duration belong to preset threshold interval when, trigger corresponding warning information.
Optionally, the journal file read module is also used to through the terminal in one of the embodiments, Shell interface inputs the journal file of dmesg instruction reading terminals linux kernel.
Optionally, the journal file read module is also used to through the terminal in one of the embodiments, Shell interface inputs the journal file of logcat instruction reading terminals android system.
Optionally, the preset threshold interval has at least one in one of the embodiments, and each preset threshold Value section is corresponding with corresponding warning information;The warning information trigger module is also used to search belonging to the terminal operating duration Threshold interval, the corresponding warning information of threshold interval found described in acquisition simultaneously triggers.
Optionally, described device further includes restarting module in one of the embodiments, for judging the terminal operating Whether duration is greater than preset threshold value, when the terminal operating duration is greater than the preset threshold value, restarts the terminal.
Implement the embodiment of the present invention, will have the following beneficial effects:
After alarm method and device using above-mentioned terminal operating duration, terminal can by linux kernel or At the beginning of the journal file of android system obtains terminal, so that terminal operating duration is obtained, then according to terminal operating Threshold interval belonging to duration shows corresponding warning information, so that when user can quickly understand current terminal operating Between, so that user be prompted to restart terminal, improve the cruising ability of terminal.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Wherein:
Fig. 1 is a kind of flow diagram of the alarm method of terminal operating duration in one embodiment;
Fig. 2 is a kind of structural schematic diagram of the alarm device of terminal operating duration in one embodiment;
Fig. 3 is the structural representation that the computer equipment of alarm method of aforementioned terminals operation duration is run in one embodiment Figure.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
For solve traditional technology in the terminal based on android system during use with terminal operating when Between increase the technical problem that there are the effective rates of utilization of system resource is low, terminal cruise duration is short, in the present embodiment, spy mentions A kind of alarm method of terminal operating duration is gone out, the realization of this method can be dependent on computer program, which can It runs on the computer system based on von Neumann system, which can be answering for the system optimization class of terminal With program, for example, mobile phone house keeper, the programs such as equipment optimization great master.The computer system can be the above-mentioned computer program of operation The terminal device such as smart phone, tablet computer, palm PC, laptop or PC.
Specifically, as shown in Figure 1, the alarm method of above-mentioned terminal operating duration includes the following steps:
Step S102: the journal file of reading terminals.
Terminal is powered from booting later i.e. can load operating system or embedded system.The operating system or embedded system In start-up loading, i.e., it can generate the entire link of journal file (log) minute book subsystem operation.
For example, after power-up, mobile phone is powered user in the application scenarios of Android phone, it then can first start one A linux kernel (operating system of bottom), then creates a process in linux kernel, which then runs Android The virtual machine of system.Therefore, linux kernel is when mobile phone starts, i.e. generation journal file, and by linux kernel operational process The instruction of middle execution or the operation note of progress are in journal file.Also, linux kernel is in record log, each instruction Or operation can all be attached to this instruction or operate timestamp when executing.The journal file of linux kernel has been written into/dev/ In kmsg file.
The starting of android system starts with the process initiation for starting Android virtual machine in linux kernel. Android system on startup, can also generate corresponding journal file, but journal file record is that android system exists The operation note of the instruction or progress that are executed in life cycle.Equally, android system is in record log, record each Instruction or operation also can all be attached to timestamp when this instruction or operation execution.But android system journal file is not write Enter into/dev/kmsg file, but be written in/dev/log file in.
Since Android phone is in booting, it always will start linux kernel and recorded in Linux in/dev/kmsg file The log of core also almost records the log of android system in/dev/log file at the same time.It therefore, both can be by Linux The log of kernel, can also be by android system as the target for being used to extract the available machine time selected by the embodiment of the present invention Log as selected by the embodiment of the present invention for extracting the target of available machine time.
Therefore, it if using the journal file of linux kernel as reference, can be inputted by the shell interface of terminal The journal file of dmesg instruction reading terminals linux kernel;If using the journal file of android system as reference, lead to Cross the journal file of the shell interface input logcat instruction reading terminals android system of terminal.
Step S104: the terminal available machine time is obtained by parsing journal file.
As previously mentioned, containing linux kernel in journal file or instruction that android system executes in life cycle Or operation note and the corresponding timestamp of progress.Therefore, it by searching for the enabled instruction for including in journal file or can open Dynamic operation is obtaining corresponding timestamp, the terminal available machine time can be obtained.For example, can be according to Liunx kernel or Android The log of system illustrates that document obtains indicating the keyword of enabled instruction or start-up operation, the journal file then read in parsing When, corresponding log recording item is found according to keyword, then obtains the corresponding timestamp of log recording item found, i.e., The terminal available machine time can be obtained.
Step S106: terminal operating duration is detected according to the terminal available machine time, is belonged in the terminal operating duration detected When preset threshold interval, corresponding warning information is triggered.
After obtaining the terminal available machine time, by the detection terminal current time of running, then the two is subtracted each other, and can be obtained Terminal operating duration.
In the present embodiment, preset threshold interval has at least one, and each preset threshold interval is corresponding with accordingly Warning information.
When the terminal operating duration detected belongs to preset threshold interval, the step of triggering corresponding warning information, is also Include:
Threshold interval belonging to the terminal operating duration is searched, the corresponding alarm of threshold interval found described in acquisition Information simultaneously triggers.
That is, preset threshold interval may include 0 to 1 hour, and 1 hour to 10 hours, 10 hours to 24 hours, 24 hours or more.Above-mentioned 4 threshold intervals respectively correspond the warning information of green, yellow, orange and red four colors.When detecting terminal When operation duration is 30 minutes, the mark of green can be shown in the notification bar of mobile phone, indicate current system booting soon;Work as inspection When measuring a length of 2 hours when terminal operating, then the mark of yellow can be shown in the notification bar of mobile phone;When detecting terminal operating At Shi Changwei 12 hours, then orange mark can be shown in the notification bar of mobile phone;It detects when terminal operating a length of 30 hours When, then red mark can be shown in the notification bar of mobile phone.User can see whether need according to the color of mobile phone notification bar Mobile phone is restarted to keep smooth operating status.
Further, after the terminal operating duration of detection arrived, also can determine whether terminal operating duration whether be greater than or Equal to preset threshold value, if so, restarting terminal.
In example as above, threshold value settable 48 hours, when terminal operating duration reaches 48 hours, terminal can be restarted automatically.
In addition, to solve the terminal based on android system in traditional technology during use as terminal is transported The capable time increases the technical problem that there are the effective rates of utilization of system resource is low, terminal cruise duration is short, implements at one In example, as shown in Fig. 2, special propose a kind of alarm device of terminal operating duration, including journal file read module 102, end The available machine time is held to obtain module 104 and warning information trigger module 106, in which:
Journal file read module 102, the journal file for reading terminals;
The terminal available machine time obtains module 104, for obtaining the terminal available machine time by parsing journal file;
Warning information trigger module 106, for detecting terminal operating duration according to the terminal available machine time, at the end detected When end operation duration belongs to preset threshold interval, corresponding warning information is triggered.
Optionally, in one embodiment, above-mentioned journal file read module 102 is also used to connect by the shell of terminal The journal file of mouth input dmesg instruction reading terminals linux kernel.
Optionally, in one embodiment, above-mentioned journal file read module 102 is also used to connect by the shell of terminal The journal file of mouth input logcat instruction reading terminals android system.
Optionally, in one embodiment, preset threshold interval has at least one, and each preset threshold interval pair There should be corresponding warning information;Warning information trigger module 106 is also used to search threshold interval belonging to terminal operating duration, obtains It takes the corresponding warning information of the threshold interval found and triggers.
Optionally, in one embodiment, as shown in Fig. 2, above-mentioned apparatus further includes restarting module 108, for judging end Whether end operation duration is greater than preset threshold value, when terminal operating duration is greater than preset threshold value, restarts terminal.
Implement the embodiment of the present invention, will have the following beneficial effects:
After alarm method and device using above-mentioned terminal operating duration, terminal can by linux kernel or At the beginning of the journal file of android system obtains terminal, so that terminal operating duration is obtained, then according to terminal operating Threshold interval belonging to duration shows corresponding warning information, so that when user can quickly understand current terminal operating Between, so that user be prompted to restart terminal, improve the cruising ability of terminal.
In one embodiment, as shown in figure 3, Fig. 3 illustrates a kind of alarm method for running above-mentioned terminal operating duration The computer system based on von Neumann system terminal.The computer system can be smart phone, tablet computer, palm The terminal devices such as computer, laptop or PC.Specifically, may include that the external input connected by system bus connects Mouth 1001, processor 1002, memory 1003 and output interface 1004.Wherein, outer input interface 1001 optionally can be at least Including network interface 10012.Memory 1003 may include external memory 10032 (such as hard disk, CD or floppy disk etc.) and memory Reservoir 10034.Output interface 1004 can include at least the equipment such as display screen 10042.
In the present embodiment, the operation of this method is based on computer program, and the program file of the computer program is stored in In the external memory 10032 of the aforementioned computer system based on von Neumann system, it is loaded into built-in storage at runtime It in 10034, is then compiled as being transferred in processor 1002 after machine code executing, so that being based on von Neumann system Computer system in form journal file read module 102 in logic, the terminal available machine time obtains module 104, alarm letter It ceases trigger module 106 and restarts module 108.And in the alarm method implementation procedure of above-mentioned terminal operating duration, input Parameter passes through outer input interface 1001 and receives, and is transferred in memory 1003 and caches, and is then input to processor 1002 In handled, the result data of processing or be cached in memory 1003 is subsequently handled, or is passed to output and is connect Mouth 1004 is exported.
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly It encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.

Claims (10)

1. a kind of alarm method of terminal operating duration is applied in the terminal, which is characterized in that the described method includes:
The journal file of the terminal is read during the terminal operating;
The terminal available machine time is obtained by parsing the journal file;
Terminal operating duration is detected according to the terminal available machine time, is belonged in the terminal operating duration detected preset When threshold interval, corresponding warning information is triggered, and the warning information is shown in the notification bar of the terminal.
2. the alarm method of terminal operating duration according to claim 1, which is characterized in that the log of the reading terminals The step of file further include:
The journal file that dmesg instructs reading terminals linux kernel is inputted by the shell interface of the terminal.
3. the alarm method of terminal operating duration according to claim 1, which is characterized in that the log of the reading terminals The step of file further include:
The journal file that logcat instructs reading terminals android system is inputted by the shell interface of the terminal.
4. the alarm method of terminal operating duration according to any one of claims 1 to 3, which is characterized in that described preset Threshold interval has at least one, and each preset threshold interval is corresponding with corresponding warning information;
It is described when the terminal operating duration detected belongs to preset threshold interval, trigger the step of corresponding warning information Suddenly further include:
Threshold interval belonging to the terminal operating duration is searched, the corresponding warning information of threshold interval found described in acquisition And it triggers.
5. the alarm method of terminal operating duration according to claim 1, which is characterized in that described to be opened according to the terminal The machine time was detected after the step of terminal operating duration further include:
Judge whether the terminal operating duration is greater than preset threshold value, if so, restarting the terminal.
6. a kind of alarm device of terminal operating duration, it is applied in the terminal, which is characterized in that described device includes:
Journal file read module, for reading the journal file of the terminal during terminal operating;
The terminal available machine time obtains module, for obtaining the terminal available machine time by parsing the journal file;
Warning information trigger module is detected for detecting terminal operating duration according to terminal available machine time described When terminal operating duration belongs to preset threshold interval, corresponding warning information is triggered, and open up in the notification bar of the terminal Show the warning information.
7. the alarm device of terminal operating duration according to claim 6, which is characterized in that the journal file reads mould Block is also used to input the journal file that dmesg instructs reading terminals linux kernel by the shell interface of the terminal.
8. the alarm device of terminal operating duration according to claim 6, which is characterized in that the journal file reads mould Block is also used to input the journal file that logcat instructs reading terminals android system by the shell interface of the terminal.
9. according to the alarm device of any terminal operating duration of claim 6 to 8, which is characterized in that described preset Threshold interval has at least one, and each preset threshold interval is corresponding with corresponding warning information;
The warning information trigger module is also used to search threshold interval belonging to the terminal operating duration, obtains the lookup To the corresponding warning information of threshold interval and trigger.
10. the alarm device of terminal operating duration according to claim 6, which is characterized in that described device further includes weight Module is opened, for judging whether the terminal operating duration is greater than preset threshold value, is greater than in the terminal operating duration described When preset threshold value, the terminal is restarted.
CN201610207472.3A 2016-04-01 2016-04-01 The alarm method and device of terminal operating duration Expired - Fee Related CN105893221B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610207472.3A CN105893221B (en) 2016-04-01 2016-04-01 The alarm method and device of terminal operating duration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610207472.3A CN105893221B (en) 2016-04-01 2016-04-01 The alarm method and device of terminal operating duration

Publications (2)

Publication Number Publication Date
CN105893221A CN105893221A (en) 2016-08-24
CN105893221B true CN105893221B (en) 2019-03-15

Family

ID=57012638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610207472.3A Expired - Fee Related CN105893221B (en) 2016-04-01 2016-04-01 The alarm method and device of terminal operating duration

Country Status (1)

Country Link
CN (1) CN105893221B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107682088A (en) * 2017-09-07 2018-02-09 安徽皖通邮电股份有限公司 A kind of method of recording light module runtime
CN111381888A (en) * 2018-12-27 2020-07-07 腾讯科技(深圳)有限公司 Electronic terminal use control method and device and storage medium
CN112000405A (en) * 2020-07-29 2020-11-27 深圳市智微智能软件开发有限公司 Method, equipment and storage medium for conveniently acquiring system logs
CN114330769A (en) * 2021-12-24 2022-04-12 深圳优地科技有限公司 Robot fault early warning method and device, robot and server

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102427491A (en) * 2011-10-08 2012-04-25 捷开通讯科技(上海)有限公司 Device and method for automatically reminding user to restart electronic device
CN103559116A (en) * 2013-10-30 2014-02-05 深圳市金立通信设备有限公司 Method for reminding time and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9037924B2 (en) * 2012-07-26 2015-05-19 Hewlett-Packard Development Company, L.P. Managing operation performance
CN104080004A (en) * 2014-06-30 2014-10-01 广州视源电子科技股份有限公司 Method and system for remotely controlling child locking function of smart television

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102427491A (en) * 2011-10-08 2012-04-25 捷开通讯科技(上海)有限公司 Device and method for automatically reminding user to restart electronic device
CN103559116A (en) * 2013-10-30 2014-02-05 深圳市金立通信设备有限公司 Method for reminding time and terminal

Also Published As

Publication number Publication date
CN105893221A (en) 2016-08-24

Similar Documents

Publication Publication Date Title
CN105893221B (en) The alarm method and device of terminal operating duration
CN101887393B (en) Equipment fault reproduction method and system based on para-virtualization technique
CN101916201B (en) Android-based mobile terminal cold-boot method and device
CN105024879A (en) Virtual machine fault detection and recovery system and virtual machine detection, recovery and starting method
CN109542744A (en) Detect method, apparatus, storage medium and the terminal of terminal booting abnormal problem
CN104866416B (en) The method and apparatus for realizing application program capacity analysis
CN104503828A (en) Process management method and terminal
CN104063288A (en) Process management method and device
CN102750202A (en) Data protection method and device
CN105468531B (en) Vulnerability mining method and device and electronic equipment
CN110321674A (en) A kind of anti-tune method for testing, intelligent terminal and storage medium based on shell script
CN114461341A (en) Method, device and medium for preventing brain crack of cloud platform virtual machine
CN103995717A (en) Method for upgrading software in embedded device
CN115659340B (en) Counterfeit applet identification method and device, storage medium and electronic equipment
CN108491483B (en) Method and device for remotely monitoring running state of program
CN106886477A (en) Threshold setting method and device are monitored in a kind of cloud system
CN109922014A (en) A kind of cold and hot starting judgment method of interchanger and system
CN109634782A (en) A kind of detection method of system robustness, device, storage medium and terminal
CN111966599B (en) Virtualization platform reliability testing method, system, terminal and storage medium
CN114722927A (en) Collapse clustering method and device, electronic equipment and storage medium
CN113900893A (en) Log obtaining method and related equipment thereof
CN108132803A (en) Timing keep-alive and awakening method, system, terminal and medium based on mobile terminal
CN110262856B (en) Application program data acquisition method, device, terminal and storage medium
CN107742080B (en) Vulnerability mining method and device for virtualized environment
CN111625302A (en) Function time consumption tracking method, device and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190315