CN112987904A - Heartbeat control method and device - Google Patents

Heartbeat control method and device Download PDF

Info

Publication number
CN112987904A
CN112987904A CN201911309223.5A CN201911309223A CN112987904A CN 112987904 A CN112987904 A CN 112987904A CN 201911309223 A CN201911309223 A CN 201911309223A CN 112987904 A CN112987904 A CN 112987904A
Authority
CN
China
Prior art keywords
task
main
new
heartbeat
overtime
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
CN201911309223.5A
Other languages
Chinese (zh)
Other versions
CN112987904B (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.)
Chengdu TD Tech Ltd
Original Assignee
Chengdu TD Tech 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 Chengdu TD Tech Ltd filed Critical Chengdu TD Tech Ltd
Priority to CN201911309223.5A priority Critical patent/CN112987904B/en
Publication of CN112987904A publication Critical patent/CN112987904A/en
Application granted granted Critical
Publication of CN112987904B publication Critical patent/CN112987904B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • G06F1/3228Monitoring task completion, e.g. by use of idle timers, stop commands or wait commands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a heartbeat control method and a heartbeat control device, wherein the method comprises the following steps: when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one task in the master control period TmainSet as the TasknewHeart cycle T ofnewWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskIf there are at least two tasks and the current master timer is overtime, the overtime processing is executedAfter the process, executing a control parameter updating process; if said G istaskIf there are at least two tasks and the master control timer is not overtime, the control parameter updating process is directly executed. By adopting the invention, the execution of all heartbeat tasks in the terminal is uniformly controlled by one master control timer, so that the heartbeat power consumption of the terminal can be effectively reduced.

Description

Heartbeat control method and device
Technical Field
The present invention relates to communications technologies, and in particular, to a heartbeat control method and apparatus.
Background
In order to maintain long connection with a server, an application program in an existing private network terminal sends a heartbeat packet to the server at regular intervals like a heartbeat packet to detect whether the connection is normal or not, and informs the server that an application client is still alive. The specific method comprises the following steps:
the client sends a short data packet (i.e. a heartbeat packet) to the server at regular time in a Timer event, then starts a low-level thread, continuously detects the response of the server in the thread, and if the response of the server is not received in a certain time, the client is considered to be disconnected.
The inventor discovers that in the process of implementing the invention: the existing heartbeat control scheme has the problem of large terminal power consumption, and the specific reason analysis is as follows:
the existing heartbeat control scheme takes a single application as a heartbeat control main body, each application sets a heartbeat period according to the heartbeat control requirement of the application, and a terminal where the application is located is triggered to send a heartbeat packet regularly based on the heartbeat period by using a Timer event. Therefore, when a plurality of applications which need to be in long connection with the server are installed in the terminal, a plurality of Timer events with corresponding quantity are set in the terminal, a processor (CPU) of the terminal needs to be awakened when a heartbeat cycle corresponding to each Timer event arrives, and the awakening of the CPU by each Timer event is independently carried out, so that the CPU of the terminal can be frequently awakened, and further, the heartbeat power consumption of the terminal is very high.
Disclosure of Invention
In view of the above, the present invention provides a heartbeat control method and apparatus, which can effectively reduce the heartbeat power consumption of a terminal.
In order to achieve the above purpose, the embodiment of the present invention provides a technical solution:
a heartbeat control method, comprising:
when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one task in the master control period TmainSet as the TasknewHeart cycle T ofnewWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskIf there are at least two tasks and the current master timer is overtime, then after executing the overtime processing process, executing the control parameter updating process; if said G istaskIf there are at least two tasks and the master control timer is not overtime, the control parameter updating process is directly executed;
when the master control timer is overtime, executing the overtime processing process;
the timeout processing procedure comprises the following steps: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskUpdating the counting times of each task overtime;
the control parameter updating process includes: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
Preferably, the setting the TasknewThe number of counts of (a) includes:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
Preferably, said is according to said GtaskOf each taskThe counting times and the finding out the task needing to execute the heartbeat event at present comprise the following steps:
subjecting the G totaskAnd determining the task with the middle counting number of 1 as the task which needs to execute the heartbeat event currently.
Preferably, said pair of said GtaskThe updating of the count number of each task overtime includes:
for the GtaskIf the counted number of the task is 1, updating the counted number of the task to the heart cycle of the task and the TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
Preferably, the determining whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskThe corresponding updating of the counting times of the middle task comprises the following steps:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainRounding the ratio; otherwise, the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
A heartbeat control device is arranged in a terminal and comprises: a processor to:
when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one Task in the Task list, the Task is executednewHeart cycle T ofnewSet as master control period TmainWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskWhen there are at least two tasks and the current master control timer is overtime, the execution is overtimeAfter the processing process, executing a control parameter updating process; if said G istaskIf there are at least two tasks and the current master control timer is not overtime, the control parameter updating process is directly executed;
when the master control timer is overtime, executing the overtime processing process;
the timeout processing procedure comprises the following steps: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskUpdating the counting times of each task overtime;
the control parameter updating process includes: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
Preferably, the processor is specifically configured to: setting the TasknewThe number of counts of (a) includes:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
Preferably, the processor is specifically configured to: according to the GtaskThe step of finding out the task which needs to execute the heartbeat event at present comprises the following steps:
subjecting the G totaskAnd determining the task with the middle counting number of 1 as the task which needs to execute the heartbeat event currently.
Preferably, the processor is specifically configured to: for the GtaskThe updating of the overtime of the counting number of each task comprises the following steps:
for the GtaskIf the counted number of the task is 1, updating the counted number of the task to the heart cycle of the task and the TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
Preferably, the processor is specifically configured to: judging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskThe corresponding updating is carried out on the counting times of the middle task, and the updating comprises the following steps:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainRounding the ratio; otherwise, the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
The present application also discloses a non-transitory computer readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the heartbeat control method as described above.
The application also discloses an electronic device comprising the non-volatile computer-readable storage medium as described above, and the processor having access to the non-volatile computer-readable storage medium.
In summary, the heartbeat control method and apparatus provided in the embodiments of the present invention uniformly control the execution of all heartbeat events in the terminal by only one master timer, and effectively reduce the number of times that the CPU is awakened while ensuring that the heartbeat event of each task can be triggered in time, so that the heartbeat power consumption of the terminal can be reduced, and the problem of relatively large heartbeat power consumption caused by the independent control of the execution of the heartbeat event by each application is effectively avoided.
Drawings
FIG. 1 is a schematic flow chart of a method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a schematic method flow diagram of an embodiment of the present invention, and as shown in fig. 1, a heartbeat control method implemented in the embodiment mainly includes:
step 101, when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is executednewAdding to the current heartbeat task set GtaskIn (1).
In this step, when an application requiring heartbeat control is newly added to the terminal, a heartbeat Task of the application needs to be executednewAdding to the current heartbeat task set G in the terminaltaskSo as to thereafter set G based on the heartbeat tasktaskAnd uniformly controlling the heartbeat events needing to be executed in the terminal.
Step 102, judging the GtaskIf there is only one task, if yes, execute step 103; otherwise, step 104 is performed.
In this step, the heartbeat TasknewAdding to the Heartbeat task set GtaskThen, if the G istaskWhether or not there is only Task innewThis Task then needs to be executed in step 103, using TasknewOtherwise, the step 104 is executed to perform the operation on the existing control parameters (including the heartbeat period T)newThe count number of heartbeat tasks) to ensure that the control parameters can cover the heartbeat control requirements of all heartbeat tasks.
Step 103, master control period TmainSet as the TasknewHeart cycle T ofnewWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); step 107 is performed.
In this step, the Task is setnewThe specific method of counting the number of times of (2) is as follows:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
Specifically, since T is nownewAnd TmainAre identical, therefore, here TasknewIs actually set to 1.
It should be noted that, in the embodiment of the present invention, for each application with a heartbeat control requirement, a count number needs to be configured for its corresponding task, and then, the count number is updated correspondingly every time the master timer times out, so as to control triggering of a corresponding heartbeat event based on the count number.
104, judging that the current master control timer is overtime, and if yes, executing a step 105; otherwise, step 106 is performed.
In this step, in order to ensure the on-time execution of the heartbeat event of the existing task in consideration of the fact that the master timer is started at this time, if the master timer is overtime, the step 105 of executing the overtime processing procedure first needs to be performed, and then the step 106 of executing the step 106 of updating the control parameters according to the heartbeat cycle of the newly added task is performed, otherwise, the step 106 of directly executing the step 106 of updating the control parameters according to the heartbeat cycle of the newly added task is performed.
Step 105, executing a timeout processing procedure, including: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskThe counted number of each task in the group is updated overtime.
In this step, in the process of executing timeout processing, the G needs to be processedtaskIs updated over time to ensure that G is said to followtaskEach task in (a) is able to execute a respective heartbeat event in time when the respective heartbeat cycle arrives.
Preferably, in this step, the following method can be adopted according to the GtaskThe number of counts of each task in the database is used for finding out the task which needs to execute the heartbeat event at present:
subjecting the G totaskThe task with the middle counting number of 1 is determined as the task which needs to execute the heartbeat event currentlyAnd (5) performing tasks.
Here, if the counted number of times of the task is 1, it is described that the heartbeat event execution time of the corresponding task is currently reached, and therefore, the heartbeat event of the task needs to be executed.
Preferably, in this step, the following method can be adopted for GtaskThe count number of each task is updated overtime:
for the GtaskIf the counted number of the task is 1, updating the counted number of the task to the heart cycle of the task and the current TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
Step 106, executing a control parameter updating process, including: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
Preferably, the execution control parameter updating process may be implemented by the following method:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainThe rounding value of the ratio.
If said T isnewGreater than or equal to TmainThen the Task is executednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
In the above updating process, if T is the same as TnewLess than said TmainThen the T is addedmainIs updated to the TnewThus, T can be mademainIs always the GtaskThe minimum value of the heartbeat periods of all the tasks in the terminal, and the timing duration of the master timer in the terminal is TmainDeterministic, so as to ensure that the heartbeat events of all tasks can be satisfiedAnd timely execution is performed.
In addition, in the updating process, for one task, the heartbeat cycle of the task and the T are usedmainAnd taking the rounded result of the ratio as the counting number of the task. Therefore, by the method, a plurality of tasks with different heartbeat cycles (for example, several tasks with close heartbeat cycles) can have the same counting times, and the tasks can trigger the execution of the heartbeat event at the same time, so that compared with the existing method that each application needs to trigger the heartbeat event respectively, the method can effectively reduce the awakening times of the CPU.
And 107, when the master control timer is overtime, executing the overtime processing process.
In the method, when the master control timer in the terminal is overtime, the task which needs to execute the heartbeat event at present is triggered in a unified manner, so that the execution of a plurality of heartbeat events can be triggered when the CPU is awakened once, the number of times of awakening the CPU is effectively reduced while the heartbeat event of each task can be timely triggered, the heartbeat power consumption of the terminal can be further reduced, and the problem of larger heartbeat power consumption caused by the independent control of the execution of the heartbeat event by each application is effectively avoided.
Corresponding to the above method embodiment, the present application provides a heartbeat control device, which is disposed in a terminal, and includes: a processor to:
when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one Task in the Task list, the Task is executednewHeart cycle T ofnewSet as master control period TmainWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskIf there are at least two tasks and the master timer is overtime, then after executing the overtime process, executing the control parametersA new process; if said G istaskIf there are at least two tasks and the current master control timer is not overtime, the control parameter updating process is directly executed;
when the master control timer is overtime, executing the overtime processing process;
the timeout processing procedure comprises the following steps: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskUpdating the counting times of each task overtime;
the control parameter updating process includes: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
Preferably, the processor is specifically configured to: setting the TasknewThe number of counts of (a) includes:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
Preferably, the processor is specifically configured to: according to the GtaskThe step of finding out the task which needs to execute the heartbeat event at present comprises the following steps:
subjecting the G totaskAnd determining the task with the middle counting number of 1 as the task which needs to execute the heartbeat event currently.
Preferably, the processor is specifically configured to: for the GtaskThe updating of the overtime of the counting number of each task comprises the following steps:
for the GtaskIf the counted number of the task is 1, updating the counted number of the task to the heart cycle of the task and the TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
Preferably, the first and second liquid crystal films are made of a polymer,the processor is specifically configured to: judging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskThe corresponding updating is carried out on the counting times of the middle task, and the updating comprises the following steps:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainRounding the ratio; otherwise, the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
The present application also discloses a non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the heartbeat control method embodiments as described above.
The application also discloses an electronic device comprising the non-volatile computer-readable storage medium as described above, and the processor having access to the non-volatile computer-readable storage medium.
In summary, the above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A heartbeat control method, comprising:
when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one task in the master control period TmainSet as the TasknewHeart cycle T ofnewWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskIf there are at least two tasks and the current master timer is overtime, then after executing the overtime processing process, executing the control parameter updating process; if said G istaskIf there are at least two tasks and the master control timer is not overtime, the control parameter updating process is directly executed;
when the master control timer is overtime, executing the overtime processing process;
the timeout processing procedure comprises the following steps: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskUpdating the counting times of each task overtime;
the control parameter updating process includes: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
2. The method of claim 1, wherein the setting the TasknewThe number of counts of (a) includes:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
3. The method of claim 1, wherein said G is a function of saidtaskThe step of finding out the task which needs to execute the heartbeat event at present comprises the following steps:
subjecting the G totaskAnd determining the task with the middle counting number of 1 as the task which needs to execute the heartbeat event currently.
4. The method of claim 1, wherein said pair of said GtaskThe updating of the count number of each task overtime includes:
for the GtaskIf the counted number of the task is 1, updating the counted number of the task to the heart cycle of the task and the TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
5. The method of claim 1, wherein the determining whether the T needs to be updatedmainAccording to the judgment result, for the TmainAnd said GtaskThe corresponding updating of the counting times of the middle task comprises the following steps:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainRounding the ratio; otherwise, the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
6. A heartbeat control device, set up in a terminal, includes: a processor to:
when an application needing heartbeat control is newly added in a terminal, a heartbeat Task of the application is usednewAdding to the current heartbeat task set GtaskPerforming the following steps; if said G istaskOnly one Task in the Task list, the Task is executednewHeart cycle T ofnewSet as master control period TmainWith said TmainStarting a master control timer for timing time length according to the TnewAnd said TmainSetting the TasknewThe number of counts of (c); if said G istaskIf there are at least two tasks and the current master timer is overtime, then after executing the overtime processing process, executing the control parameter updating process; if said G istaskIn which there are at least two tasks and the master control is currently presentIf the timer is not overtime, the control parameter updating process is directly executed;
when the master control timer is overtime, executing the overtime processing process;
the timeout processing procedure comprises the following steps: with the current said TmainRestarting the master control timer for a timing duration; according to the GtaskFinding out the task which needs to execute the heartbeat event at present and executing the corresponding heartbeat event according to the counting times of each task; for the GtaskUpdating the counting times of each task overtime;
the control parameter updating process includes: according to the TnewAnd said TmainJudging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskAnd correspondingly updating the counting times of the middle tasks.
7. The apparatus of claim 6, wherein the processor is specifically configured to: setting the TasknewThe number of counts of (a) includes:
the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
8. The apparatus of claim 6, wherein the processor is specifically configured to: according to the GtaskThe step of finding out the task which needs to execute the heartbeat event at present comprises the following steps:
subjecting the G totaskAnd determining the task with the middle counting number of 1 as the task which needs to execute the heartbeat event currently.
9. The apparatus of claim 6, wherein the processor is specifically configured to: for the GtaskThe updating of the overtime of the counting number of each task comprises the following steps:
for the GtaskIf the counted number of the task is 1, the task is executedIs updated to the heart cycle of the task and the TmainAnd (4) rounding the ratio, otherwise, subtracting 1 from the counting number of the task.
10. The apparatus of claim 6, wherein the processor is specifically configured to: judging whether the T needs to be updated or notmainAccording to the judgment result, for the TmainAnd said GtaskThe corresponding updating is carried out on the counting times of the middle task, and the updating comprises the following steps:
if said T isnewLess than said TmainThen the T is addedmainIs updated to the TnewAnd for said GtaskThe counting times of the task are set as the heartbeat period and the T of the taskmainRounding the ratio; otherwise, the Task is processednewIs set as the TnewAnd said TmainThe rounding value of the ratio.
11. A non-transitory computer readable storage medium storing instructions which, when executed by a processor, cause the processor to perform the steps of the heartbeat control method of any of claims 1 to 5.
12. An electronic device comprising the non-volatile computer-readable storage medium of claim 11, and the processor having access to the non-volatile computer-readable storage medium.
CN201911309223.5A 2019-12-18 2019-12-18 Heartbeat control method and device Active CN112987904B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911309223.5A CN112987904B (en) 2019-12-18 2019-12-18 Heartbeat control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911309223.5A CN112987904B (en) 2019-12-18 2019-12-18 Heartbeat control method and device

Publications (2)

Publication Number Publication Date
CN112987904A true CN112987904A (en) 2021-06-18
CN112987904B CN112987904B (en) 2022-11-11

Family

ID=76343888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911309223.5A Active CN112987904B (en) 2019-12-18 2019-12-18 Heartbeat control method and device

Country Status (1)

Country Link
CN (1) CN112987904B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726595A (en) * 2021-08-06 2021-11-30 视联动力信息技术股份有限公司 Detection method and device of timeout client, electronic equipment and storage medium
CN117294750A (en) * 2023-11-27 2023-12-26 杭州涂鸦信息技术有限公司 Method and device for adjusting MQTT heartbeat frequency

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040153749A1 (en) * 2002-12-02 2004-08-05 Schwarm Stephen C. Redundant multi-processor and logical processor configuration for a file server
US20060176167A1 (en) * 2005-01-25 2006-08-10 Laser Shield Systems, Inc. Apparatus, system, and method for alarm systems
CN103118188A (en) * 2013-01-25 2013-05-22 华为终端有限公司 Application heartbeat cycle adjusting method and device, and terminal
CN103782634A (en) * 2012-08-31 2014-05-07 华为终端有限公司 Control method and device for awaking intelligent terminal
WO2015006773A1 (en) * 2013-07-12 2015-01-15 Seven Networks, Inc. Transport protocol layer optimization for managing signaling and power consumption
CN104348522A (en) * 2013-07-23 2015-02-11 普天信息技术研究院有限公司 Method suitable for heartbeat keeping of low-power consumption Bluetooth device
US20170046237A1 (en) * 2015-08-11 2017-02-16 International Business Machines Corporation Passive detection of live systems during controller failover in distributed environments
CN106548618A (en) * 2015-09-18 2017-03-29 徐工集团工程机械股份有限公司 For the methods, devices and systems of remote control pairing
CN107360362A (en) * 2017-06-16 2017-11-17 深圳市共进电子股份有限公司 Portable network video camera and wireless router operation method
CN108900349A (en) * 2018-07-11 2018-11-27 烽火通信科技股份有限公司 A kind of high-frequency model management method and system suitable for EOC all-in-one machine

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040153749A1 (en) * 2002-12-02 2004-08-05 Schwarm Stephen C. Redundant multi-processor and logical processor configuration for a file server
US20060176167A1 (en) * 2005-01-25 2006-08-10 Laser Shield Systems, Inc. Apparatus, system, and method for alarm systems
CN103782634A (en) * 2012-08-31 2014-05-07 华为终端有限公司 Control method and device for awaking intelligent terminal
CN103118188A (en) * 2013-01-25 2013-05-22 华为终端有限公司 Application heartbeat cycle adjusting method and device, and terminal
WO2015006773A1 (en) * 2013-07-12 2015-01-15 Seven Networks, Inc. Transport protocol layer optimization for managing signaling and power consumption
CN104348522A (en) * 2013-07-23 2015-02-11 普天信息技术研究院有限公司 Method suitable for heartbeat keeping of low-power consumption Bluetooth device
US20170046237A1 (en) * 2015-08-11 2017-02-16 International Business Machines Corporation Passive detection of live systems during controller failover in distributed environments
CN106548618A (en) * 2015-09-18 2017-03-29 徐工集团工程机械股份有限公司 For the methods, devices and systems of remote control pairing
CN107360362A (en) * 2017-06-16 2017-11-17 深圳市共进电子股份有限公司 Portable network video camera and wireless router operation method
CN108900349A (en) * 2018-07-11 2018-11-27 烽火通信科技股份有限公司 A kind of high-frequency model management method and system suitable for EOC all-in-one machine

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
XIGUI WANG等: ""WLCleaner: Reducing Energy Waste Caused by WakeLock Bugs at Runtime"", 《IEEE》 *
关国栋等: ""基于心跳超时机制的Hadoop实时容错技术"", 《计算机应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726595A (en) * 2021-08-06 2021-11-30 视联动力信息技术股份有限公司 Detection method and device of timeout client, electronic equipment and storage medium
CN113726595B (en) * 2021-08-06 2024-03-19 视联动力信息技术股份有限公司 Detection method and device of timeout client, electronic equipment and storage medium
CN117294750A (en) * 2023-11-27 2023-12-26 杭州涂鸦信息技术有限公司 Method and device for adjusting MQTT heartbeat frequency
CN117294750B (en) * 2023-11-27 2024-03-01 杭州涂鸦信息技术有限公司 Method and device for adjusting MQTT heartbeat frequency

Also Published As

Publication number Publication date
CN112987904B (en) 2022-11-11

Similar Documents

Publication Publication Date Title
KR101799418B1 (en) Application heartbeat period adjusting method and apparatus, and terminal
WO2015131679A1 (en) Task process processing method and device
US10091307B2 (en) Application management method and terminal
CN112987904B (en) Heartbeat control method and device
CN109582486B (en) Watchdog monitoring method, system and device and storage medium
CN107491346A (en) A kind of task processing method of application, apparatus and system
CN112817772B (en) Data communication method, device, equipment and storage medium
CN111625322B (en) Data processing method, system and equipment
WO2022095862A1 (en) Thread priority adjusting method, terminal, and computer readable storage medium
CN112463367A (en) Method and system for optimizing performance of storage system, electronic equipment and storage medium
CN109889406B (en) Method, apparatus, device and storage medium for managing network connection
CN113542256B (en) Method, device, equipment and storage medium for updating login credentials in client
CN108845872B (en) Method for implementing software timer for embedded system
CN112650566B (en) Timed task processing method and device, computer equipment and storage medium
CN102129475B (en) A kind of conflict avoiding method and system of resolution system resource-constrained
JP6189545B2 (en) Network application parallel scheduling to reduce power consumption
CN115421859B (en) Dynamic loading method and device for configuration file, computer equipment and storage medium
US20190340034A1 (en) Device and method for processing jobs
US20220229484A1 (en) Power management setting configuration
CN111796949A (en) Communication task processing method, device, equipment and storage medium
CN107728769B (en) Background application management method and device and computer readable storage medium
US9740259B2 (en) Method for managing software application computing resources
CN110688165A (en) Application wake-up lock management method and device, terminal, storage medium and electronic device
CN114691343B (en) Polling task execution method and device, computer equipment and readable storage medium
CN114003367B (en) Risk monitoring method, device, equipment and storage medium

Legal Events

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