CN106598714B - Alarm optimization management method and system - Google Patents

Alarm optimization management method and system Download PDF

Info

Publication number
CN106598714B
CN106598714B CN201611086853.7A CN201611086853A CN106598714B CN 106598714 B CN106598714 B CN 106598714B CN 201611086853 A CN201611086853 A CN 201611086853A CN 106598714 B CN106598714 B CN 106598714B
Authority
CN
China
Prior art keywords
timer set
alarm
arrival time
module
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611086853.7A
Other languages
Chinese (zh)
Other versions
CN106598714A (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.)
Huzhou Yinglie Intellectual Property Operation Co ltd
Original Assignee
Taizhou Jiji Intellectual Property Operation Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taizhou Jiji Intellectual Property Operation Co ltd filed Critical Taizhou Jiji Intellectual Property Operation Co ltd
Priority to CN201611086853.7A priority Critical patent/CN106598714B/en
Publication of CN106598714A publication Critical patent/CN106598714A/en
Application granted granted Critical
Publication of CN106598714B publication Critical patent/CN106598714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4825Interrupt from clock, e.g. time of day

Abstract

The invention discloses an Alarm optimization management method, which comprises the following steps: when an Alarm needs to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation; recording the identifier of the timer set, and deleting the matched Alarm in the timer set; obtaining a new initial arrival time value and a new latest arrival time value of the timer set according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, judging whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, and if so, ending the operation; otherwise, remaining alarms in the timer sets are reserved, the timer sets are deleted, and the remaining alarms are added to the timer sets in the timer set list. According to the invention, the system efficiency is greatly improved after the Alarm management operation is deleted.

Description

Alarm optimization management method and system
Technical Field
The invention relates to the technical field of computer networks, in particular to an Alarm optimization management method and system.
Background
In the Android system, the alarmmmanagerservice is responsible for setting and managing the alarms (timers) of all applications. The AlarmManagerService defines an ArrayList < Batch > mArlarmBatches array for managing Alarm, and each Batch (timer set) defines an ArrayList < Alarm > arms array, and each Batch is composed of a plurality of Alarm. When the application cancels the Alarm or the Alarm manager service judges that the Alarm is invalid, the Alarm is deleted from the Batch list, and at the moment, the Batch array needs to be reconstructed, so that the Alarm can be more effectively reconstructed into a proper Batch list. The current practice is to remove all the alarms from the Batch list, remove the already constructed Batch list, then reconstruct a new Batch list, and add the alarms to the Batch list again. When there are many Alarm and many Alarm cancel operations, the operations are laborious and time consuming, and the Alarm manager service operates in the system process, which affects the efficiency of the system.
Disclosure of Invention
The invention provides an Alarm optimization management method and system, which are used for solving the problems in the prior art and can efficiently construct a new Batch list instead of completely reversing the problems to influence the system efficiency.
The invention discloses an Alarm optimization management method, which comprises the following steps:
s100, when there is an Alarm to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation;
s200, recording the identifier of the timer set, and deleting the matched Alarm in the timer set;
s300, according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, obtaining a new initial arrival time value and a new latest arrival time value of the timer set, judging whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, and if so, ending the operation; otherwise, entering step S400;
s400, reserving the rest Alarm in the timer set, deleting the timer set, and adding the rest Alarm to each timer set in the timer set list.
When performing the alias deletion, all the aliams in the Batch (equivalent to the timer set) are matched by the identifier of the alias first, and if the match is not the same, it indicates that the alias does not exist, and the operation ends. Once a match is made, the Batch Index (corresponding to the timer set identification) in which the Alarm is located is recorded, and the corresponding Alarm is deleted from the Batch. And then determining whether the start (start-to-time) value of the Batch needs to be adjusted according to the start-to-time and the latest arrival time of the rest of the Alarm, if the adjustment is not needed, not needing to reconstruct the Batch list and re-add the Alarm, if the start value needs to be adjusted, reserving all rest of the Alarm under the Batch, deleting the Batch from the Batch list, and then adding the previously reserved Alarm into the Batch list. Therefore, at most, only the Alarm in the Batch needs to be added, instead of reconstructing the whole Batch list and adding all the Alarm again, the efficiency is improved greatly.
Further, the step S300 includes the steps of:
s310, acquiring all start time values and latest arrival time values of Alarm left by the timer set;
s320, taking the maximum starting time value of the rest Alarm as a new starting time value of the timer set, and taking the minimum latest arrival time value of the rest Alarm as a new latest arrival time value of the timer set;
s330 determines whether the new start time value of the timer set is consistent with the original start time value of the timer set? If yes, go to step S500; otherwise, the process proceeds to step S400.
Further, the step S400 includes the steps of:
s410, constructing a list of identifiers of a timer set to be adjusted, and adding the identifiers of the timer set to the list of identifiers of the timer set to be adjusted;
s420, deleting the same timer set identifier in the timer set identifier list to be adjusted;
s430, according to the list of the timer set identifiers to be adjusted, finding a corresponding timer set according to the timer set identifiers;
s440, reserving all Alarm in the timer set and deleting the timer set;
s450 adds all remaining alarms to the timer set of the timer set list.
And constructing a to-be-adjusted Batch Index list (which is equivalent to the to-be-adjusted timer set identification list), recording the Bath Index of the Batch with the changed start value in the Batch Index list after deleting the Alarm, then finding the corresponding Batch according to the list, reserving the inside Alarm, deleting the Batch, and then adding the reserved Alarm into each Batch of the Batch list.
Further, the step S450 includes the steps of:
s451, according to an adding rule of Alarm, judging whether the Alarm can be added to the existing timer set of the timer set list, if so, entering the step S452; otherwise, go to step S453;
s452 adding the Alarm to the set of timers;
s453, establishing a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm, and adding the Alarm to the new timer set, wherein the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; adding the new timer set to the timer set list.
Adding the reserved Alarm to each Batch of the Batch list, wherein one can be added to the existing Batch according to the adding rule of the Alarm, and the other cannot be added to the existing Batch, at this time, we need to reconstruct a Batch according to the starting time and the latest arrival time of the Alarm, the Batch is listed in the Batch list, and the Alarm is also added to the reconstructed Batch.
Further, the adding rule of the Alarm is as follows: and when the starting arrival time value of the Alarm is smaller than the latest arrival time value of the timer set, and the latest arrival time value of the Alarm is larger than the starting arrival time value of the timer set, adding the Alarm to the timer set.
Further, the method also comprises the following steps:
s450, acquiring the starting arrival time value of each timer set, and setting the starting arrival time of the timer set with the first arrival of the starting arrival time to the bottom layer drive.
The invention also provides an Alarm optimization management system, which comprises a traversal searching module, a control judging module, a deleting module, an obtaining module and an adding module; the control judgment module is respectively connected with the traversal search module, the deletion module, the acquisition module and the addition module; wherein:
when an Alarm needs to be deleted, the traversal searching module traverses the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, and the control judging module judges whether the Alarm is matched with the Alarm to be deleted;
if there is an Alarm matched with an Alarm to be deleted, the control judgment module records the label of the timer set, deletes the matched Alarm in the timer set through the deletion module, the acquisition module acquires a new initial arrival time value and a new latest arrival time value of the timer set according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, the control judgment module judges whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, if so, the control judgment module ends the operation, otherwise, the control judgment module retains the remaining Alarm in the timer set, deletes the timer set through the deletion module, and then adds the remaining Alarm into each timer set in the timer set list through the addition module;
and if no Alarm is matched with the Alarm to be deleted, the control judgment module judges to end the operation.
Further, the system also comprises a construction module connected with the control judgment module, wherein:
the control judging module reserves the rest of the alarms in the timer set, deletes the timer set through the deleting module, and adds the rest of the alarms into each timer set in the timer set list through the adding module, wherein the adding module comprises:
the construction module constructs a timer set identification list to be adjusted under the control of the control judgment module, and adds the identification of the timer set into the timer set identification list to be adjusted;
the deleting module deletes the same timer set identification in the timer set identification list to be adjusted;
the traversal searching module searches a corresponding timer set according to the timer set identification list to be adjusted and the timer set identification;
the control judgment module reserves all Alarm in the timer set and deletes the timer set through the deletion module;
the adding module adds all remaining alarms to a timer set of the timer set list.
Further, the adding module adds all remaining alarms to the timer set of the timer set list, including:
the control judging module judges whether the Alarm can be added into the existing timer set of the timer set list according to an adding rule of the Alarm, if so, the adding module adds the Alarm into the timer set; otherwise, the construction module establishes a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm acquired by the acquisition module, the adding module adds the Alarm to the new timer set, the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; the adding module adds the new timer set to the timer set list.
Further, still including setting up the module, set up the module with control module links to each other, wherein:
the acquisition module acquires the initial arrival time value of each timer set, and the setting module sets the initial arrival time of the timer set with the initial arrival time reaching first to the bottom layer drive under the control of the control judgment module.
According to the invention, when the Alarm is deleted, whether the timer set needs to be adjusted or not is determined according to whether the time value from the beginning to the time of the timer set changes or not, if the time value does not need to be adjusted, the subsequent operation does not need to be carried out, if the time value needs to be adjusted, a timer set identification list to be adjusted is constructed, the timer set identification is added into the list, then the corresponding timer set is searched according to the timer set identification list to be adjusted, the remaining Alarm in the list is reserved, the timer set is deleted, and the reserved Alarm is added again. Therefore, the timer set list does not need to be completely backed up, and the system efficiency is optimized.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart of an embodiment of an Alarm optimization management method of the present invention;
FIG. 2 is a flowchart illustrating an Alarm optimization management method according to another embodiment of the present invention; (ii) a
FIG. 3 is a flowchart illustrating another embodiment of an Alarm optimization management method according to the present invention; (ii) a
FIG. 4 is a flowchart of constructing a to-be-adjusted timer set identifier list and adding all reserved Alarm;
FIG. 5 is a flow chart of the construction of the Batch Index list corresponding to Alarm;
FIG. 6 is a flow chart of adding Alarm again according to the Batch Index list;
fig. 7 is a block diagram of an embodiment of an Alarm optimization management system according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention discloses an Alarm optimization management method, which comprises the following steps of:
s100, when there is an Alarm to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation;
s200, recording the identifier of the timer set, and deleting the matched Alarm in the timer set;
s300, according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, obtaining a new initial arrival time value and a new latest arrival time value of the timer set, judging whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, and if so, ending the operation; otherwise, entering step S400;
s400, reserving the rest Alarm in the timer set, deleting the timer set, and adding the rest Alarm to each timer set in the timer set list.
Many applications in the system use many timers, most of which have less strict requirements on accuracy, for example, an application may connect a network once every a period of time, and as for whether this time is acceptable for a five-minute or ten-minute application, when setting such timers, the application sets the initial arrival time when (e.g., five minutes) and the latest arrival time maxWhen (e.g., ten minutes) of Alarm, and the underlying system, in order to save power, i.e., to avoid too much power consumption by waking up the system by time-neighboring Alarm, puts such Alarm with intersection into a timer set, calculates the start (initial arrival time) and end (latest arrival time) values of the timer set, and when the start arrives, i.e., all the Alarm under the timer set are considered to arrive, all the Alarm can be applied according to its own situation.
The system has a timer set list, each timer set has an Alarm list, when the Alarm is deleted, all the alarms in the timer sets are matched through the identification of the alarms, if the alarms are not matched, the alarms do not exist, and the operation is finished. And once the match is obtained, recording the identifier of the timer set where the Alarm is located, and deleting the corresponding Alarm from the timer set. And then determining whether a start (start-to-time) value of the timer set needs to be adjusted according to the start-to-time and the latest arrival time of the remaining alarms, if the start-to-time and the latest arrival time of the timer set do not need to be adjusted, then not needing to reconstruct a subsequent timer set list and re-add the alarms, and ending the operation, if the start value needs to be adjusted, then reserving all the remaining alarms under the timer set, deleting the timer set from the timer set list, and then adding the previously reserved alarms into the timer set list. Therefore, at most, only the alarms in the adjusted timer set need to be added, instead of reconstructing the whole timer set list and then adding all the alarms again, and the efficiency needs to be improved greatly relatively.
A second embodiment of the method of the present invention, as shown in fig. 2, is based on the above embodiment, and details the process of step S300, specifically, the embodiment includes the steps of:
s100, when there is an Alarm to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation;
s200, recording the identifier of the timer set, and deleting the matched Alarm in the timer set;
s310, acquiring all start time values and latest arrival time values of Alarm left by the timer set;
s320, taking the maximum starting time value of the rest Alarm as a new starting time value of the timer set, and taking the minimum latest arrival time value of the rest Alarm as a new latest arrival time value of the timer set;
s330 determines whether the new start time value of the timer set is consistent with the original start time value of the timer set? If yes, go to step S500; otherwise, the process proceeds to step S400.
S400, reserving the rest Alarm in the timer set, deleting the timer set, and adding the rest Alarm to each timer set in the timer set list.
When deleting the Alarm, adjusting rules of a start value and an end value of the timer set: the largest value of the remaining initial arrival time when of all the alarms is the new start value of the timer set, and the smallest value of the remaining maxWhen of the latest arrival time maxWhen of all the alarms is the new end value of the timer set. For example, if the start value of one timer set is 10; end value is 50; if the maximum of the remaining ranges is 10 after the first range is deleted, and the minimum of maxWhen is 50, that is, the start value and the end value of the timer set do not need to be adjusted; if the second alias is deleted, the maximum of the remaining aliams is 20, and the minimum of maxWhen is 60, then the start value of the timer set is adjusted to 20, and the end value is still 50.
A third embodiment of the method of the invention, as shown in fig. 3, comprises the steps of:
s100, when there is an Alarm to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation;
s200, recording the identifier of the timer set, and deleting the matched Alarm in the timer set;
s300, according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, obtaining a new initial arrival time value and a new latest arrival time value of the timer set, judging whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, and if so, ending the operation; otherwise, entering step S400;
s410, constructing a list of identifiers of a timer set to be adjusted, and adding the identifiers of the timer set to the list of identifiers of the timer set to be adjusted;
s420, deleting the same timer set identifier in the timer set identifier list to be adjusted;
s430, according to the list of the timer set identifiers to be adjusted, finding a corresponding timer set according to the timer set identifiers;
s440, reserving all Alarm in the timer set and deleting the timer set;
s450 adds all remaining alarms to the timer set of the timer set list.
Deleting the timer set and the condition for adding the reserved Alarm again after deleting the Alarm: the timer set needs to be deleted and the reserved Alarm needs to be added again only if the start (start-to-time) value of the timer set changes. If only the end (latest time of arrival) value changes, it is not needed.
In this embodiment, by establishing an identifier list of a timer set to be adjusted, an identifier of the timer set from which the Alarm is deleted and the start value is changed is added to the identifier list of the timer set to be adjusted. Then, according to the list of the timer sets to be adjusted, finding out the corresponding timer set, retaining all the alarms in the corresponding timer set, and then deleting the timer set. And adding all remaining alarms to each timer set in the timer set list. Therefore, all the timer set lists do not need to be overturned again, only a part of the selected timer sets are required to be deleted and added, and the selected timer sets are identified in the timer set identification list to be adjusted, so that the subsequent searching and operation are facilitated, and the working efficiency is greatly improved.
Preferably, on the basis of the above embodiment, the step S450 is detailed, and as shown in fig. 4, the step S400 includes the steps of:
s410, constructing a list of identifiers of a timer set to be adjusted, and adding the identifiers of the timer set to the list of identifiers of the timer set to be adjusted;
s420, deleting the same timer set identifier in the timer set identifier list to be adjusted;
s430, according to the list of the timer set identifiers to be adjusted, finding a corresponding timer set according to the timer set identifiers;
s440, reserving all Alarm in the timer set and deleting the timer set;
s451, according to an adding rule of Alarm, judging whether the Alarm can be added to the existing timer set of the timer set list, if so, entering the step S452; otherwise, go to step S453;
s452 adding the Alarm to the set of timers;
s453, establishing a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm, and adding the Alarm to the new timer set, wherein the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; adding the new timer set to the timer set list.
Reconstructing a timer set list according to all remaining alarms, if the alarms do not conform to an adding rule for adding the timer set, reestablishing a timer set, including the alarms into the timer set, wherein the starting time and the latest time of the timer set are consistent with the alarms, and the timer set is also listed in the timer set list; if the adding rule is met, the Alarm is added to the timer set, and the new start time-to-time and the latest time-to-time in the timer set are updated.
Preferably, the adding rule of Alarm is as follows: and when the starting arrival time value of the Alarm is smaller than the latest arrival time value of the timer set, and the latest arrival time value of the Alarm is larger than the starting arrival time value of the timer set, adding the Alarm to the timer set.
Preferably, on the basis of any of the above embodiments, the following steps can be added:
s450, acquiring the starting arrival time value of each timer set, and setting the starting arrival time of the timer set with the first arrival of the starting arrival time to the bottom layer drive.
Because the management of the Alarm in the present invention involves the addition and deletion of the Alarm in the timer set, and along with the addition and deletion of the Alarm, the start arrival time (hereinafter, start) and the latest arrival time (hereinafter, end) values in the corresponding timer set (hereinafter, simply called Batch) also change correspondingly, and the following illustrates the calculation process of the start value and the end value of the timer set when adding or deleting:
many applications in the system use many timers, most of which have less strict requirements on accuracy, for example, an application connects a network once every a period of time, and as for whether this time is acceptable for a five-minute or ten-minute application, when setting such timers, the application sets the initial arrival time when (e.g., five minutes) and the latest arrival time maxWhen (e.g., ten minutes) of Alarm, and in order to save power, i.e., to avoid too much power consumption by waking up systems with time-adjacent Alarm, the underlying system puts such Alarm with intersection into a Batch, calculates the start and end values of the Batch, sets the start value of the Batch into the underlying driving system, and when the start arrives, it is considered that all the Alarm under the Batch are arrived, and all the Alarm can be applied according to their own conditions.
Rule to determine to which Batch Alarm fits can be added: the initial arrival time when of Alarm is less than the end value of Batch, while the latest arrival time maxWhen of Alarm is greater than the start value of Batch.
After Alarm is added to Batch, the start and end values of Batch adjust the rule: if the starting time duration when of the Alarm is greater than the start value of the Batch, the new start value of the Batch is the starting time duration when of the Alarm; if the latest arrival time maxWhen of Alarm is less than the end value of Batch, the new end value of Batch is the latest arrival time maxWhen of the Alarm.
Examples are as follows:
the application sets the first Alarm: the initial arrival time when1 is 10 minutes, the latest arrival time maxWhen1 is 50 minutes, and the system meets the requirement from 10 to 50;
since this is the first Alarm, the start value of Batch is when1(10) and the end value is maxWhen1(50)
The application sets a second Alarm: the initial arrival time when2 is 5 minutes, the latest arrival time maxWhen2 is 40 minutes, and the system meets the requirement from the interval of 5 to 40 to the arrival time;
at this time the start-up time whin 2(5) < end (50) of Batch, while maxWhen2(40) > start (10) of Batch, the Alarm may be added to Batch while adjusting the start and end values of Batch: since the start time when2(5) is not greater than the start (10) of the Batch, the start value of the Batch does not need to be adjusted, and since the latest arrival time maxWhen2(40) is less than the end (50) of the Batch, the end value of the Batch is adjusted to maxWhen2(40), the start of the Batch is still 10, and the end value is 40
The application sets the third Alarm: the initial arrival time when3 is 20 minutes, the latest arrival time maxWhen3 is 60 minutes, and the system meets the requirement from the interval of 20 to 60;
at this time the start-up time whin 3(20) < end (40) of Batch, while maxWhen3(60) > start (10) of Batch, the Alarm may be added to Batch while adjusting the start and end values of Batch: since the start time when3(20) is greater than the start time 10 of the Batch, the start value of the Batch is adjusted to when3(20), and the latest arrival time maxWhen3(60) is not less than the end 40 of the Batch, the end value of the Batch does not need to be adjusted, and at this time, the start time of the Batch is still 20 and the end value is 40.
The application sets the fourth Alarm: the initial arrival time when4 is 25 minutes, the latest arrival time maxWhen4 is 35 minutes, and the system meets the requirement from the interval of 25 to 35;
at this point the start-up time whin 4(25) < end (40) of Batch, while maxWhen4(35) > start (20) of Batch, the Alarm may be added to Batch while adjusting the start and end values of Batch: since the start-time when4(25) is greater than the start (20) of the Batch, the start value of the Batch is adjusted to when4(25), and the latest arrival time maxWhen4(35) is less than the end (40) of the Batch, the end value of the Batch is adjusted to maxWhen4(35), where the start of the Batch is 25 and the end value is 35
Through the above example, in practice, the system integrates four alarms into one Batch, and the start values of the Batch are all in the valid intervals of the four alarms, so that only the start value of the Batch needs to be set to the bottom drive, and after the start value of the Batch arrives, that is, the four alarms are all considered to arrive at the time, the application with the alarms can perform relevant application processing.
When deleting the Alarm, the start value and the end value of the Batch adjust the rule: the largest value of the remaining initial arrival time when of all the alarms is the new start value of the Batch, and the smallest value of the remaining maxWhen of the latest arrival time maxWhen of all the alarms is the new end value of the Batch.
Still the above example:
if the first Alarm is deleted, the maximum of the when of the remaining three Alarms is 25, and the minimum of maxWhen is 35, i.e. the start value and the end value of Batch do not need to be adjusted;
if the second Alarm is deleted, the maximum of when in the remaining three Alarms is 25, and the minimum of maxWhen is 35, i.e. the start value and the end value of Batch do not need to be adjusted;
if the fourth Alarm is deleted, the maximum of the wyen of the remaining three Alarms is 20, and the minimum of maxWhen is 40, the start value of Batch is adjusted to 20, and the end value is adjusted to 40. Returning to the state before the fourth Alarm is added.
In the last embodiment of the method of the present invention, when performing the Alarm deletion, all the alarms in the Batch are matched by the identifier of the Alarm, and if the match is not found, it indicates that the Alarm does not exist, and the operation ends. Once a match is made, the Batch Index (timer set identification) in which the Alarm is located is recorded, and the corresponding Alarm is deleted from the Batch. And then determining whether the start value of the Batch needs to be adjusted according to the start time and the latest arrival time of the rest of the Alarm, if not, not needing to reconstruct the Batch list and re-add the Alarm, if the start value needs to be adjusted, reserving all rest of the Alarm under the Batch, deleting the Batch from the Batch list, and then adding the previously reserved Alarm into the Batch list. Therefore, at most, only one Alarm in the Batch needs to be added, the whole Batch list is not reconstructed, and all Alarms are added again, so that the efficiency is improved greatly. The present embodiment includes two parts: and constructing a Batch Index list corresponding to the Alarm, and adding the Alarm again according to the Batch Index list.
A first part: constructing a Batch Index list corresponding to Alarm, comprising:
when the application deletes the Alarm which is also due, an interface function removeLocked provided by the alarmManagerService is called, and the removeLocked provides three sets of parameter definitions:
public void removeLocked(PendingIntent operation)
public void removeLocked(String packageName)
public void removeLocked(int userHandle)
there are two important member definitions in the data structure of Alarm:
public PendingIntent operation;
public int uid;
PendingIntent is the sent Intent when Alarm expires, and Alarm to delete can be found by matching PendingIntent in the Alarm data structure in the Batch list. The packageName is the package name of the application where the Alarm is located, and the package name where the Alarm is located can be obtained through the member function getTargetPackage of PendingIntent. The userHandle is the uid of the application where the Alarm is located, and the Alarm to be deleted can be matched by directly matching the member uid of the Alarm in the Batch list. When the parameter is the package name or uid of the application, all the items to be deleted under the corresponding application are identified, so the Batch Index to be recorded must be a list array, and thus the Batch corresponding to all the items to be deleted can be recorded, which is convenient for reconstructing the Batch list. The flow chart is as shown in fig. 5, the system has a Batch list, an Alarm list is below each Batch, the Batch list is firstly traversed, for each Batch in the list, the following Alarm list needs to be traversed to determine whether there is an Alarm to be deleted in the Batch list, if there is an Alarm to be deleted in the Batch list and the Start value of the Batch is adjusted at the same time (the maximum starting time of the remaining Alarm is the new Start value of the Batch, the minimum latest time of the remaining Alarm is the new end value of the Batch, when the new Start value is inconsistent with the original Start value, adjustment is needed), the Index corresponding to the Batch is recorded, and if there is no matched Alarm, the Batch is continuously traversed until the complete Batch list is traversed. Finally, record all Batch indexes that need reprocessing. The last recorded list of Batch indexes needs to delete the same Batch Index through traversal so as to avoid repeated operations when a new Batch is built subsequently.
It should be noted that, when the parameter of removelolocked in the flowchart is PendingIntent or uid, the PendingIntent or uid member is directly obtained from the Alarm structure for matching. When the parameter is the application package name, acquiring PendingIntent from the Alarm structure, calling a getTargetPack function in the PendingIntent to acquire the package name of the application of the Alarm, and then matching.
A second part: add Alarm again according to the Batch Index list:
when the Alarm delete is completed, all the corresponding batchs needing to be adjusted are added into the Batch Index list. The Batch list needs to be adjusted next. The operation of adjusting Batch enters the rebatch alarmsLocked function of AlarmManagerService. The specific flow is shown in fig. 6:
first, a list of the Batch Index where the Alarm is deleted and the start value of the Batch has changed needs to be traversed, the corresponding Batch instance is fetched according to the Batch Index, the remaining Alarm is retained, and the Batch is deleted. The setImpl function of AlarmManagerService is called later to add the saved Alarm to the Batch list again. When all the operations of the corresponding Batch in the Batch Index list are completed, a rescheduleKernel AlarmmsLocked function of AlarmManagerService is called to set the start value of the latest Batch to the bottom drive.
The invention has the advantages that: whether the Batch needs to be adjusted is determined by whether the start value of the Batch is changed, the Batch list does not need to be completely rewound, and the system efficiency is optimized.
Based on the same technical concept, the embodiment of the invention also provides an Alarm optimization management system, and the system can execute the method embodiment. A system provided by an embodiment of the invention is shown in fig. 7. The first embodiment of the system comprises a traversal searching module 20, a control judging module 10, a deleting module 30, an obtaining module 40 and an adding module 50; the control judgment module 10 is respectively connected with the traversal search module 20, the deletion module 30, the acquisition module 40 and the addition module 50; wherein:
when an Alarm needs to be deleted, the traversal searching module 20 traverses the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, and the control judging module 10 judges whether the Alarm is matched with the Alarm to be deleted;
if there is an Alarm matching with the Alarm to be deleted, the control judgment module 10 records the label of the timer set, deleting the matched alarms in the timer set through the deleting module 30, obtaining a new start arrival time value and a new latest arrival time value of the timer set by the obtaining module 40 according to the start arrival time value and the latest arrival time value of the remaining alarms in the timer set, the control judgment module 10 judges whether the new start arrival time value of the timer set is consistent with the original start arrival time value, if yes, ending the operation, otherwise, the control and judgment module 10 reserves remaining alarms in the timer set, deleting the timer sets through the deleting module 30, and adding the remaining alarms to each timer set in a timer set list through the adding module 50;
if there is no match between the Alarm and the Alarm to be deleted, the control determining module 10 determines to end the operation.
In the embodiment of the management system, when the Alarm is deleted, whether the timer set needs to be adjusted is determined according to whether the time from the beginning to the time of the timer set changes, and after the timer set needing to be adjusted is screened out, the subsequent reconstruction of the timer set is executed.
Preferably, on the basis of the above embodiment, the present invention further comprises a constructing module 60 connected to the control determining module 10, wherein:
the control determining module 10 reserves the remaining alarms in the timer set, deletes the timer set through the deleting module 30, and adds the remaining alarms to each timer set in the timer set list through the adding module 50, including:
the constructing module 60 constructs a list of identifiers of the timer set to be adjusted under the control of the control judging module 10, and adds the identifiers of the timer set to the list of identifiers of the timer set to be adjusted;
the deleting module 30 deletes the same timer set identifier in the timer set identifier list to be adjusted;
the traversal searching module 20 searches a corresponding timer set according to the timer set identifier list and the timer set identifier;
the control judgment module 10 reserves all alarms in the timer set, and deletes the timer set through the deletion module 30;
the adding module 50 adds all remaining alarms to the timer set of the timer set list.
And optimizing the reconstruction of the timer set list by constructing and deleting the timer set identification list to be adjusted corresponding to the Alarm.
Preferably, on the basis of the above embodiment, the adding module 50 adds all remaining alarms to the timer set of the timer set list, including:
the control determining module 10 determines, according to an adding rule of Alarm, whether the Alarm can be added to an existing timer set of the timer set list, and if so, the adding module 50 adds the Alarm to the timer set; otherwise, the constructing module 60 establishes a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm acquired by the acquiring module 40, the adding module 50 adds the Alarm to the new timer set, the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; the adding module 50 adds the new timer set to the timer set list.
Preferably, on the basis of any of the above embodiments, a setting module 70 is further included, and the setting module 70 is connected to the control module, wherein:
the obtaining module 40 obtains the start arrival time value of each timer set, and the setting module 70 sets the start arrival time of the timer set whose start arrival time arrives first to the bottom layer driver under the control of the control judging module 10.
In this embodiment, the start-to-time value of the latest timer set is set to the bottom layer driver, and even if the system is powered off, when the start-to-time of the timer set reaches, the system is still woken up to execute the corresponding application.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (7)

1. An Alarm optimization management method is characterized by comprising the following steps:
s100, when there is an Alarm to be deleted, traversing the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, judging whether the Alarm is matched with the Alarm to be deleted, if so, entering the step S200, and otherwise, ending the operation;
s200, recording the identifier of the timer set, and deleting the matched Alarm in the timer set;
s300, according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, obtaining a new initial arrival time value and a new latest arrival time value of the timer set, judging whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, and if so, ending the operation; otherwise, entering step S400;
s400, reserving the rest Alarm in the timer set, deleting the timer set, and adding the rest Alarm to each timer set in a timer set list;
the step S300 includes the steps of:
s310, acquiring all start time values and latest arrival time values of Alarm left by the timer set;
s320, taking the maximum starting time value of the rest Alarm as the new starting time value of the timer set, and taking the minimum latest arrival time value of the rest Alarm as the new latest arrival time value of the timer set;
s330, judging whether the new starting time value of the timer set is consistent with the original starting time value of the timer set, if so, adjusting is not needed; otherwise, go to step S400;
the step S400 includes the steps of:
s410, constructing a list of identifiers of a timer set to be adjusted, and adding the identifiers of the timer set to the list of identifiers of the timer set to be adjusted;
s420, deleting the same timer set identifier in the timer set identifier list to be adjusted;
s430, according to the list of the timer set identifiers to be adjusted, finding a corresponding timer set according to the timer set identifiers;
s440, reserving all Alarm in the timer set and deleting the timer set;
s450 adds all remaining alarms to the timer set of the timer set list.
2. The method for optimally managing Alarm according to claim 1, wherein the step S450 comprises the steps of:
s451, according to an adding rule of Alarm, judging whether the Alarm can be added to the existing timer set of the timer set list, if so, entering the step S452; otherwise, go to step S453;
s452 adding the Alarm to the set of timers;
s453, establishing a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm, and adding the Alarm to the new timer set, wherein the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; adding the new timer set to the timer set list.
3. The method for optimally managing Alarm according to claim 2, wherein the adding rule of the Alarm is as follows: and when the starting arrival time value of the Alarm is smaller than the latest arrival time value of the timer set, and the latest arrival time value of the Alarm is larger than the starting arrival time value of the timer set, adding the Alarm to the timer set.
4. The method for optimally managing Alarm according to claim 1, further comprising the steps of:
s450, acquiring the starting arrival time value of each timer set, and setting the starting arrival time of the timer set with the first arrival of the starting arrival time to the bottom layer drive.
5. An Alarm optimization management system is characterized by comprising a traversal search module, a control judgment module, a deletion module, an acquisition module and an addition module; the control judgment module is respectively connected with the traversal search module, the deletion module, the acquisition module and the addition module; wherein:
when an Alarm needs to be deleted, the traversal searching module traverses the Alarm list of each timer set in the timer set list according to the identifier of the Alarm, and the control judging module judges whether the Alarm is matched with the Alarm to be deleted;
if there is an Alarm matched with an Alarm to be deleted, the control judgment module records the label of the timer set, deletes the matched Alarm in the timer set through the deletion module, the acquisition module acquires a new initial arrival time value and a new latest arrival time value of the timer set according to the initial arrival time value and the latest arrival time value of the remaining Alarm in the timer set, the control judgment module judges whether the new initial arrival time value of the timer set is consistent with the original initial arrival time value, if so, the control judgment module ends the operation, otherwise, the control judgment module retains the remaining Alarm in the timer set, deletes the timer set through the deletion module, and then adds the remaining Alarm into each timer set in the timer set list through the addition module;
if no Alarm is matched with the Alarm to be deleted, the control judgment module judges to end the operation;
the system also comprises a construction module connected with the control judgment module, wherein:
the control judging module reserves the rest of the alarms in the timer set, deletes the timer set through the deleting module, and adds the rest of the alarms into each timer set in the timer set list through the adding module, wherein the adding module comprises:
the construction module constructs a timer set identification list to be adjusted under the control of the control judgment module, and adds the identification of the timer set into the timer set identification list to be adjusted;
the deleting module deletes the same timer set identification in the timer set identification list to be adjusted;
the traversal searching module searches a corresponding timer set according to the timer set identification list to be adjusted and the timer set identification;
the control judgment module reserves all Alarm in the timer set and deletes the timer set through the deletion module;
the adding module adds all remaining alarms to a timer set of the timer set list.
6. The Alarm optimization management system of claim 5, wherein the adding module adds all the reserved alarms to the timer set of the timer set list comprises:
the control judging module judges whether the Alarm can be added into the existing timer set of the timer set list according to an adding rule of the Alarm, if so, the adding module adds the Alarm into the timer set; otherwise, the construction module establishes a new timer set according to the initial arrival time value and the latest arrival time value of the Alarm acquired by the acquisition module, the adding module adds the Alarm to the new timer set, the initial arrival time of the new timer set is the initial arrival time of the Alarm, and the latest arrival time of the new timer set is the latest arrival time of the Alarm; the adding module adds the new timer set to the timer set list.
7. The Alarm optimization management system of claim 5, further comprising a setting module, the setting module connected to the control module, wherein:
the acquisition module acquires the initial arrival time value of each timer set, and the setting module sets the initial arrival time of the timer set with the initial arrival time reaching first to the bottom layer drive under the control of the control judgment module.
CN201611086853.7A 2016-11-30 2016-11-30 Alarm optimization management method and system Active CN106598714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611086853.7A CN106598714B (en) 2016-11-30 2016-11-30 Alarm optimization management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611086853.7A CN106598714B (en) 2016-11-30 2016-11-30 Alarm optimization management method and system

Publications (2)

Publication Number Publication Date
CN106598714A CN106598714A (en) 2017-04-26
CN106598714B true CN106598714B (en) 2021-05-07

Family

ID=58594541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611086853.7A Active CN106598714B (en) 2016-11-30 2016-11-30 Alarm optimization management method and system

Country Status (1)

Country Link
CN (1) CN106598714B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3333250A (en) * 1963-08-13 1967-07-25 Gen Electric Buffering system for data communication
CN102394809A (en) * 2011-10-13 2012-03-28 中国人民解放军国防科学技术大学 Multithreading parallel processing method of border gateway protocol

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218033B (en) * 2013-03-28 2015-11-25 小米科技有限责任公司 A kind of method and device waking hardware device up
CN104714620B (en) * 2013-12-12 2019-02-15 中兴通讯股份有限公司 A kind of method and device adjusting intelligent terminal wakeup frequency
CN105354044B (en) * 2014-08-21 2018-11-13 阿里巴巴集团控股有限公司 A kind of application awakening method and device
CN105517132A (en) * 2015-11-30 2016-04-20 青岛海信移动通信技术股份有限公司 Method and device for managing alarms
CN106055074A (en) * 2016-05-31 2016-10-26 广东欧珀移动通信有限公司 Method and device for processing application program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3333250A (en) * 1963-08-13 1967-07-25 Gen Electric Buffering system for data communication
CN102394809A (en) * 2011-10-13 2012-03-28 中国人民解放军国防科学技术大学 Multithreading parallel processing method of border gateway protocol

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
The research and design of a kind of anti-sleeping student alarm clock with exercise and English learning functions;Yanmei Wang,Kaijin Qiu,Qunchao Yu;《2014 IEEE 5th International Conference on Software Engineering and Service Science》;20141023;全文 *
基于Android平台定时任务的设计与实现;陈立佳;《电子测试》;20161031;全文 *

Also Published As

Publication number Publication date
CN106598714A (en) 2017-04-26

Similar Documents

Publication Publication Date Title
CN111125268B (en) Network alarm analysis model creation method, alarm analysis method and device
CN105808633B (en) Data archiving method and system
US20170220636A1 (en) Real-time saved-query updates for a large graph
US8756343B2 (en) Data management method and node apparatus
US20160110649A1 (en) Application Program Recommending Method, And Terminal
CN109725926B (en) Method and device for managing baseline and data processing method
US8612474B2 (en) System and method for supporting logical sensor network
US20180268029A1 (en) Metafutures-based Graphed Data Lookup
RU2014133161A (en) METHOD AND DEVICE FOR MANAGING A DATABASE SYSTEM LOCKING OPERATION
CN110490319B (en) Distributed deep reinforcement learning method based on fusion neural network parameters
CN110275889B (en) Feature processing method and device suitable for machine learning
CN106598714B (en) Alarm optimization management method and system
CN104424246A (en) Data storage system and method
CN103812912B (en) A kind of method and device of maintenance organization structural information
CN114997414B (en) Data processing method, device, electronic equipment and storage medium
CN108664499B (en) Data storage method, device and equipment
CN106528849B (en) Complete history record-oriented graph query overhead method
CN106936911B (en) Lightweight distributed computing platform and computing resource management and control method thereof
CN110727729A (en) Method and device for realizing intelligent operation
CN106202293B (en) A kind of update method and device of emergency event corpus
CN109271354A (en) A kind of journal file handle update method and system
CN110856040B (en) Method and device for processing monitoring data in client
CN110968640B (en) Oil well data processing method and device and oil well control system
CN111931009A (en) Method and device for determining maximum operation path of batch operation
CN116382666B (en) Project execution method and system based on artificial intelligence model

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201030

Address after: 318015 no.2-3167, zone a, Nonggang City, no.2388, Donghuan Avenue, Hongjia street, Jiaojiang District, Taizhou City, Zhejiang Province

Applicant after: Taizhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Applicant before: Phicomm (Shanghai) Co.,Ltd.

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230104

Address after: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: 318015 no.2-3167, area a, nonggangcheng, 2388 Donghuan Avenue, Hongjia street, Jiaojiang District, Taizhou City, Zhejiang Province

Patentee before: Taizhou Jiji Intellectual Property Operation Co.,Ltd.