CN101060679A - Event insertion method - Google Patents

Event insertion method Download PDF

Info

Publication number
CN101060679A
CN101060679A CNA2007101107468A CN200710110746A CN101060679A CN 101060679 A CN101060679 A CN 101060679A CN A2007101107468 A CNA2007101107468 A CN A2007101107468A CN 200710110746 A CN200710110746 A CN 200710110746A CN 101060679 A CN101060679 A CN 101060679A
Authority
CN
China
Prior art keywords
incident
time
event
chained list
insertion position
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CNA2007101107468A
Other languages
Chinese (zh)
Inventor
龚尤岗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CNA2007101107468A priority Critical patent/CN101060679A/en
Publication of CN101060679A publication Critical patent/CN101060679A/en
Priority to PCT/CN2007/003850 priority patent/WO2008148271A1/en
Pending legal-status Critical Current

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The provided affair inserting method comprises: S102, deciding the head of head affair and tail affair in link for objective affair; S104, according to objective affair time and former head and tail time, determining the inserting position in link; and S106, inserting the affair. This invention is fast and can ensure treat all interruption.

Description

Event insertion method
Technical field
The present invention relates to the communications field, relate more specifically to a kind of event insertion method.
Background technology
In present mobile phones design, as the accurate timing device of whole system, the incident of all accurate timings is all by realizing to the TPU registered events in event handling unit (Time Processing Unit is called for short TPU).
In general terminal, all require minimum 128 incidents, be divided into waiting event and issue incident, the memory space that takies is bigger.In portable terminal, since limited storage space, the mode that the memory space that needs for processing events has adopted static allocation, dynamically used.Used two pointer chain management with a slice event space then, wherein, the list of thing that the chain management has been used; The idle list of thing of chain management.When new incident need be inserted, at first from idle chain, obtain an event space, insert the event information that needs, then according to temporal information, the insertion incident is to using in the event chain.Otherwise, discharging an event space if desired, order is just opposite.
This method is very ingenious for the use in space, has both guaranteed the memory space of incident, can not propose constraint to the use of other memory headrooms again.Owing to avoided the memory space copy function in the sequencer procedure, so insert and the speed of search also can be said to be than comparatively fast.
After the event registration, need sort according to the sequencing of incident.In existing design, if once register a lot of incidents, the searching times of software processes becomes a lot, and the processing time becomes quite long.Under opposite extreme situations, insert 128 incidents simultaneously, and the position that each incident is inserted all needs maximum searching times, the searching times that then needs is 128*127/2=8128 time.So TPU has taken a large amount of CPU (CentralProcessing Unit is called for short CPU) processing time.
In addition, the interrupt resources of CPU is limited, distributes an interruption can not for each incident, and for economizing on resources, all TPU interrupt events use an identical interruption.This just may cause and interrupt crowding, and for fear of the Interrupt Process conflict, can adopt following two kinds of processing policies:
One, hardware uses several incidents that a register record takes place recently.Distinguish the current event distribution situation by software,, surpassed the disposal ability of CPU, then search for the nearest position of satisfying the event handling ability, adjust the insertion incident entry-into-force time, the insertion incident if new events insertion point incident is too tight.
Two, increase extra random access memory (Random Access Memory is called for short RAM) resource, the pop down when being used for interrupt nesting is handled.For the interrupt event that has little time to handle, be pressed in the stack and preserve, handle the incident of front after, the incident of from stack, take out to need handling again.
But these two kinds of processing methods all have its inevitable weakness.The weakness of first kind of processing policy is that it can not directly be realized by single-track link table, if adopt doubly linked list, then can realize on the function, but operand is too big, can't finish on affined terminal processes of processing time.The weakness of second kind of processing policy is, simple to operate although its speed is fast, it is too big to take hardware resource, on the supreme terminal of power consumption, realizes such function, and the loss power consumption loses more than gain.
Summary of the invention
One or more problems in view of the above the invention provides a kind of event insertion method.
According to a kind of event insertion method of the present invention, may further comprise the steps: S102, judgement will be inserted the incident in the incident chained list of incident and the time of tail event; S104 according to the relation between the time of time of a time that is inserted into incident and an incident and tail event, determines the insertion position of the incident that is inserted in the incident chained list; And S106, the incident that will be inserted into is inserted in the determined insertion position.
Wherein, in step S104, the time that is inserted into incident early than time of an incident or be later than under the situation of time of tail event, determine that the insertion position of the incident that is inserted in the incident chained list is before an incident or after tail event.
Wherein, the time that is inserted into incident under the situation between the time of time of an incident and tail event, step S104 may further comprise the steps: S1042, judge that whether time difference between an incident and the tail event is less than particular value; S1044 under the situation of the time difference between an incident and the tail event less than particular value, determines that the position of an incident in the incident chained list is the insertion position of pending incident in the incident chained list, otherwise carries out step S1046; S1046 judges whether the time of the intermediate event between an incident and the tail event is later than the time of the incident of being inserted into; And S1048, be later than in the time of intermediate event under the situation of time of the incident of being inserted into, time of an incident is become time of intermediate event, otherwise time of tail event is become time of intermediate event, return step S1042 then.
Wherein, come the presentation of events time with the incident sequence number.The incident sequence number is represented with the subscript of incident array of pointers.
According to another kind of event insertion method of the present invention, may further comprise the steps: S302, determine that treatment system handles required minimum time to the incident of given number; S304 is inserted into event number in the incident chained list after the incident according to insertion, determines the insertion position of the incident that is inserted in the incident chained list; And S306, the incident that will be inserted into is inserted in the determined insertion position.
Wherein, in step S304, under the situation of event number in the incident chained list after insertion is inserted into incident, determine that the pre-insertion position of the incident that is inserted into is its final insertion position in the incident chained list less than given number.
Wherein, under the situation of event number in the incident chained list after insertion is inserted into incident greater than given number, step S304 may further comprise the steps: whether S3042, judge insert time interval between the incident of the given number that closes in the incident chained list after the incident that is inserted into greater than minimum time; S3044 under the situation of time interval greater than minimum time between the incident of contiguous given number, determines that the pre-insertion position of the incident that is inserted into is its final insertion position in list of thing, otherwise carries out step S3046; S3046 judges that whether the incident that is inserted into is near border behind the frame; S3048 being inserted under the situation of incident near border behind the frame, adjusts the pre-insertion position that is inserted into incident forward, otherwise the pre-insertion position that will be inserted into incident adjusts backward, returns step S3042 then.
Wherein, the stepping that the pre-insertion position that is inserted into incident is adjusted is a minimum time.The given number that step S302 determines is 4.
In sum, the present invention utilizes some searching methods fast, has finished search location fast; And make judgement by event time is distributed, the new insertion event time that does not satisfy the insertion condition is adjusted, thereby guaranteed to interrupt accessing processing.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, and illustrative examples of the present invention and explanation thereof are used to explain the present invention, do not constitute improper qualification of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart according to the event insertion method of the embodiment of the invention;
Fig. 2 is the detail flowchart of the step S104 of method shown in Figure 1;
Fig. 3 is the flow chart of event insertion method according to another embodiment of the present invention; And
Fig. 4 is the detail flowchart of the step S304 of method shown in Figure 3.
Embodiment
In the present invention, utilized the characteristic of pointer and array, and combined the characteristic of this special object of TPU incident,, utilized some searching methods fast, finished search location fast by increasing an array of pointers of pointing to the TPU event type; And make judgement by using array of pointers that event time is distributed, and the new insertion event time that does not satisfy the insertion condition is adjusted, guaranteed to interrupt accessing processing.
The subscript of array is a kind of position mark that can be used to calculate, and directly adopts each element in incident array and the incident array, and sorted order is as required deposited, and can calculate the position that needs insertion fast.But, because the element of each incident is many, directly use the incident array, insertion of incident each time and deletion all can relate to lot of data and move operation.By the CPU expense that search is saved, offset by the operation of the data-moving of back, even surmount.Therefore, directly use array to replace the mode of chained list infeasible.
Not directly use the reason of incident array to be that moving of data needs a large amount of operations.Recall forward, the reason that the operational ton of moving is big is again because the element of incident is too many again.
The characteristics of pointer are exactly the address of a conservation object, during access object, according to the type of object, determine each element of object.The size of pointer variable and the size of object are irrelevant, and be only relevant with the address bus bit wide of current C PU, therefore adopts the incident array of pointers to substitute the incident array and finish ordering, a large amount of operation that just can avoid data-moving to bring.
Below with reference to Fig. 1 and Fig. 2, the event insertion method according to the embodiment of the invention is described.As shown in Figure 1, this event insertion method may further comprise the steps:
S102, according to the position of current processing events, still back field incident of field incident before judgement should be inserted is determined the incident in the incident chained list of the incident of will inserting and the time and the sequence number of tail event thus;
S104 according to the relation between the time of time of a time that is inserted into incident and an incident and tail event, determines the insertion position of the incident that is inserted in the incident chained list.
S106, the incident that will be inserted into is inserted in the determined insertion position.
Wherein, in step S104, the time that is inserted into incident early than or be later than under the situation of time of the incident of an incident and tail event, the incident sequence number of being inserted into is got before the incident sequence number or after the tail event sequence number, the insertion position of determining the incident that is inserted into is before an incident or after the tail event.
Wherein, the time that is inserted into incident under the situation between the time of time of an incident and tail event, step S104 may further comprise the steps (as shown in Figure 2):
S1042, the time difference between a judgement incident and the tail event, whether perhaps whether an incident sequence number and tail event sequence number be adjacent less than 1chip.
S1044 under the situation of the time difference between an incident and the tail event less than particular value, determines that the position of an incident in the incident chained list is the insertion position of pending incident in the incident chained list, otherwise carries out step S1046;
S1046 gets the intermediate event of sequence number for the middle sequence number of an incident sequence number and tail event sequence number, takes out time corresponding according to middle sequence number, and judges whether the time of intermediate event is later than the time of the incident of being inserted into.
S1048 under the situation of the time of intermediate event early than the time that is inserted into incident, is adjusted into middle sequence number with the tail event sequence number, otherwise an incident sequence number is adjusted into middle sequence number, returns step S1042 then.
Wherein, come the presentation of events time with the incident sequence number.The incident sequence number is represented with the subscript of incident array of pointers.
Below with reference to Fig. 3 and Fig. 4, event insertion method according to another embodiment of the present invention is described.As shown in Figure 3, this event insertion method may further comprise the steps:
S302 carries out initialization condition and determines, promptly definite treatment system is handled required minimum time to 4 (given number) incidents.
S304 is inserted into event number in the incident chained list after the incident according to insertion, determines the insertion position of the incident that is inserted in the incident chained list.
S306, the incident that will be inserted into is inserted in the determined insertion position.
Wherein, in step S304, the event number in the incident chained list after insertion is inserted into incident determines that less than under 4 the situation the pre-insertion position of the incident that is inserted into is its final insertion position in the incident chained list.
Wherein, the event number in the incident chained list after insertion is inserted into incident is greater than under 4 the situation, and step S304 may further comprise the steps (as shown in Figure 4):
S3042 judge to insert the minimum time whether time interval between any 4 incidents of closing in the incident chained list after the incident that is inserted into is determined greater than initial condition.
S3044 under the situation of time interval greater than minimum time between the incident of contiguous given number, determines that the pre-insertion position of the incident that is inserted into is its final insertion position in list of thing, otherwise carries out step S3046;
S3046 judges that whether the incident that is inserted into is near border behind the frame;
S3048 adjusts the time forward in current location, and adjusting stepping is the minimum spacing parameter that is provided with in the first step.And determine current pre-insertion position sequence number, otherwise adjust the time in current location backward, adjusting stepping is the minimum spacing parameter that is provided with in the first step.And determine current pre-insertion position sequence number, return step S3042 then.
Wherein, owing in present system, can handle 4 interrupt events simultaneously,, treatment system is decided to be 4 times that incident is required of processing so being handled required minimum time to the incident of given number.That is to say that if current system is idle attitude, the same time arrives 4 interrupt events, what system can handle comes.But surpass 4 interrupt events, then required these incidents that certain processing spacing will be arranged, otherwise, losing of incident will be caused.This just needs to carry out time distribution judgement to being inserted into incident, and the reason of adjusting.
That is to say, when the distribution of time is judged, still can use array of pointers to operate.At first need to find the position of insertion, then the several incident entry-into-force time around the insertion position is judged, thereby determined whether and to insert in current location.If the current location time of satisfying is inserted condition, then can insert; If do not satisfy the insertion condition, then incident insertion position and incident entry-into-force time are adjusted, again event distribution is judged; Circulate repeatedly up to finding suitable incident insertion point and till the incident entry-into-force time.Wherein, the judgment condition of event distribution needs to guarantee that all incidents can both find suitable insertion point.Wherein, insert event distribution to judge that need the periodicity of consideration incident, the generating period of incident is a frame.Joining end to end of incident forms a time ring.
From as can be seen above, after the improvement, adopt the binary search method, the number of times that opposite extreme situations need be searched for is (2*1+2*2+4*3+8*4+16*5+32*6+64*7)=770 time, has improved more than 10 times than original processing method.
The above is embodiments of the invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within the claim scope of the present invention.

Claims (10)

1. an event insertion method is characterized in that, may further comprise the steps:
S102, judgement will be inserted the incident in the incident chained list of incident and the time of tail event;
S104 according to the relation between the time of time of time that is inserted into incident and described incident and described tail event, determines the described insertion position of incident in described incident chained list that be inserted into; And
S106 inserts the described incident that is inserted in the determined insertion position.
2. event insertion method according to claim 1, it is characterized in that, in described step S104, the described time that is inserted into incident early than time of described incident or be later than under the situation of time of described tail event, determine that the described insertion position of incident in described incident chained list that be inserted into is before described the incident or after described tail event.
3. event insertion method according to claim 1 is characterized in that, the described time that is inserted into incident under the situation between the time of time of described incident and described tail event, described step S104 may further comprise the steps:
S1042 judges that whether time difference between described incident and the described tail event is less than particular value;
S1044, under the situation of time difference between described incident and the described tail event less than described particular value, determine that the position of described incident in described incident chained list is the insertion position of described pending incident in described incident chained list, otherwise carry out step S1046;
S1046 judges whether the time of the intermediate event between described incident and the described tail event is later than the described time that is inserted into incident; And
S1048, be later than in the time of described intermediate event under the situation of the described time that is inserted into incident, time of described incident is become time of described intermediate event, otherwise time of described tail event is become time of described intermediate event, return step S1042 then.
4. according to each described event insertion method in the claim 1 to 3, it is characterized in that, come the presentation of events time with the incident sequence number.
5. event insertion method according to claim 4 is characterized in that, described incident sequence number is the subscript of incident array of pointers.
6. an event insertion method is characterized in that, may further comprise the steps:
S302 determines that treatment system handles required minimum time to the incident of given number;
S304 is inserted into event number in the incident chained list after the incident according to insertion, determines the described insertion position of incident in described incident chained list that be inserted into; And
S306 inserts the described incident that is inserted in the determined insertion position.
7. event insertion method according to claim 6, it is characterized in that, in described step S304, under the situation of event number in inserting described incident chained list after being inserted into incident, determine that the described pre-insertion position that is inserted into incident is its final insertion position in described incident chained list less than described given number.
8. event insertion method according to claim 6 is characterized in that, under the situation of event number greater than described given number in the incident chained list after inserting described being inserted into, described step S304 may further comprise the steps:
Whether S3042 judge inserts time interval between the incident of the described given number that closes in the described incident chained list that is inserted into after the incident greater than described minimum time;
S3044 under the situation of time interval greater than described minimum time between the incident of contiguous described given number, determines that the described pre-insertion position that is inserted into incident is its final insertion position in described list of thing, otherwise carries out step S3046;
S3046 judges that whether the described incident that is inserted into is near border behind the frame;
S3048 is inserted under the situation of incident near border behind the described frame described, the described pre-insertion position that is inserted into incident is adjusted forward, otherwise the described pre-insertion position that is inserted into incident is adjusted backward, returns step S3042 then.
9. event insertion method according to claim 8 is characterized in that, the stepping that the described pre-insertion position that is inserted into incident is adjusted is described minimum time.
10. according to each described event insertion method in the claim 6 to 9, it is characterized in that described given number is 4.
CNA2007101107468A 2007-06-06 2007-06-06 Event insertion method Pending CN101060679A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CNA2007101107468A CN101060679A (en) 2007-06-06 2007-06-06 Event insertion method
PCT/CN2007/003850 WO2008148271A1 (en) 2007-06-06 2007-12-27 Event inserting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2007101107468A CN101060679A (en) 2007-06-06 2007-06-06 Event insertion method

Publications (1)

Publication Number Publication Date
CN101060679A true CN101060679A (en) 2007-10-24

Family

ID=38866517

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2007101107468A Pending CN101060679A (en) 2007-06-06 2007-06-06 Event insertion method

Country Status (2)

Country Link
CN (1) CN101060679A (en)
WO (1) WO2008148271A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102014162A (en) * 2010-11-30 2011-04-13 中国科学院软件研究所 Data transmission monitoring method in operation of distributed system
CN102340416A (en) * 2011-07-08 2012-02-01 东软集团股份有限公司 Time slice-based method and device for event statistics
CN103391586A (en) * 2012-05-10 2013-11-13 中兴通讯股份有限公司 GSM measuring method and device
CN108093386A (en) * 2017-12-29 2018-05-29 青岛海信电器股份有限公司 The method of bluetooth controller and its processing connection event, bluetooth equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1275423C (en) * 2002-02-28 2006-09-13 中兴通讯股份有限公司 Timing method of timer in embedded real-time operation system
CN100426784C (en) * 2004-06-25 2008-10-15 腾讯科技(深圳)有限公司 Solution of network shake
CN1936765A (en) * 2005-09-30 2007-03-28 康佳集团股份有限公司 Scheduling method of timer chain meter

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102014162A (en) * 2010-11-30 2011-04-13 中国科学院软件研究所 Data transmission monitoring method in operation of distributed system
CN102014162B (en) * 2010-11-30 2013-06-05 中国科学院软件研究所 Data transmission monitoring method in operation of distributed system
CN102340416A (en) * 2011-07-08 2012-02-01 东软集团股份有限公司 Time slice-based method and device for event statistics
CN102340416B (en) * 2011-07-08 2014-03-19 东软集团股份有限公司 Time slice-based method and device for event statistics
CN103391586A (en) * 2012-05-10 2013-11-13 中兴通讯股份有限公司 GSM measuring method and device
CN103391586B (en) * 2012-05-10 2016-08-31 深圳市中兴微电子技术有限公司 GSM measuring method and device
CN108093386A (en) * 2017-12-29 2018-05-29 青岛海信电器股份有限公司 The method of bluetooth controller and its processing connection event, bluetooth equipment
CN108093386B (en) * 2017-12-29 2020-11-03 海信视像科技股份有限公司 Bluetooth controller, method for processing connection event by using same and Bluetooth device

Also Published As

Publication number Publication date
WO2008148271A1 (en) 2008-12-11

Similar Documents

Publication Publication Date Title
Wang et al. An efficient design and implementation of LSM-tree based key-value store on open-channel SSD
CN101763437B (en) Method and device for realizing high-speed buffer storage
CN1179284C (en) Target management container and its managing method
CN1271524C (en) Static internal storage management method
CN101035110A (en) Service transferring method, system and unit
CN1866217A (en) System and method for determining optimum distribution of source server in target server
CN103455433B (en) EMS memory management process and system
CN1650260A (en) Memory region based data pre-fetching
US9836516B2 (en) Parallel scanners for log based replication
CN1928873A (en) System and method for database access for implementing load sharing
CN103425435B (en) Disk storage method and disk storage system
WO2017092596A1 (en) Write request processing methodand mobile terminal
US20210117378A1 (en) Method, device and computer program product for shrinking storage space
US7111289B2 (en) Method for implementing dual link list structure to enable fast link-list pointer updates
CN101060679A (en) Event insertion method
CN101290590A (en) Embedded operating system task switching method and unit
CN1851671A (en) Method for saving global varible internal memory space
CN113486026A (en) Data processing method, device, equipment and medium
CN100347705C (en) Method for file merge
CN1118825C (en) Method and apparatus for initializing semiconductor memory
CN1595910A (en) A data packet receiving interface component of network processor and storage management method thereof
CN1878420A (en) Method for holding resource consistency between wireless network controller and base station
CN1881895A (en) Apparatus operation method in network management system
CN1567249A (en) Internal memory managerial approach for computer system
CN105740166B (en) Cache reading and reading processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Open date: 20071024