Summary of the invention
The present invention proposes a kind of method improving microwave apparatus control efficiency, solve the increase along with microwave circuit parts in prior art, the stand-by period reaching in stable condition needs during testing software is arranged gets more and more, and greatly reduces the problem of the testing efficiency of microwave apparatus.
Technical scheme of the present invention is achieved in that
Improve a method for microwave apparatus control efficiency, create a latency management thread, and build two and arrange wait function, one is insert stand-by period Wait function, and another performs stand-by period WaitOver function;
Each of instrument controls in thread, set up the microwave circuit unit of instrument, need to insert the place of waiting for and call Wait function, when all microwave circuit unit, all setting completed or only after last microwave circuit unit surplus, call WaitOver function and insert the stand-by period, and etc. stand-by period of all this control thread execute to return again and exit.
Alternatively, described latency management thread comprises the following steps:
After receiving the moment parameter and thread handle that Wait function imports into, read from the stand-by period buffer memory that this thread handle associates according to thread handle and complete the moment the earliest, the moment parameter of preserving with oneself compares, and more late or larger moment parameter is preserved;
When the moment parameter receiving WaitOver function and import into, and complete moment parameter relatively after, this process stops performing, and till the stand-by period reaches the wait moment value the latest in the time queue of thread handle association always, then sends event notice WaitOver function and returns and exit.
Alternatively, the execution of described Wait function comprises the following steps:
First, current precise time point is obtained;
Then, after current precise time point being added the time needing to wait for, then obtain the thread handle of current thread, pass to latency management thread;
Next, latency management thread is multiple wait time delay queues of mark from thread handle, completing the earliest of reading and saving waits for that moment and this time point contrast, wait for that the moment is early than this time point if completed the earliest, substitute to complete the earliest with this time point and wait for the moment, stored in this thread handle for mark queue in, otherwise with this time point that function imports into substitute this thread handle mark complete the earliest wait for the moment;
Wait function executes, and returns immediately, do not wait for after having transmitted parameter.
Alternatively, the execution of described WaitOver function comprises the following steps:
First, current precise time point is obtained;
Then, obtain the moment value needing to be deferred to after current precise time point being added the time needing to wait for, then obtain the thread handle of current thread, these two parameters are passed to latency management thread;
Next, latency management thread is multiple wait time delay queues of mark from thread handle, completing the earliest of reading and saving waits for that moment value and this time point contrast, wait for that the moment is early than this time point if completed the earliest, then wait until after WaitOver wait moment of importing into, exited by WaitOver by event notice.
The invention has the beneficial effects as follows:
(1) design the stand-by period multiplexing, microwave apparatus Survey Software can greatly be reduced stand-by period in microwave circuit unit process is set, especially when microwave component is many, thus greatly improve the testing efficiency of microwave apparatus;
(2) testing efficiency improves significantly, realizes with low cost, is convenient to promote.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The present invention carries out queue combination the stabilization time that each microwave circuit parts set up rear needs, and all stand-by period are carried out multiplexing, and optimization of ranking, thus finally realize the minimizing of Measuring Time and measure the raising of efficiency.
Below in conjunction with accompanying drawing, the method that the present invention improves microwave apparatus control efficiency is described in detail:
Method of the present invention is managed and computing the stand-by period of inserting by latency management thread, and completes the process of the stand-by period that all microwave circuit unit need.Each of instrument controls in thread, set up the microwave circuit unit of instrument, need to insert the place of waiting for and call Wait function, when all microwave circuit unit, all setting completed or only after last microwave circuit unit surplus, call WaitOver function and insert the stand-by period, and etc. stand-by period of all this control thread execute to return again and exit.
As shown in Figure 1, latency management thread realizes principle and comprises the following steps:
After receiving the moment parameter and thread handle that Wait imports into, read from the stand-by period buffer memory that this thread handle associates according to thread handle and complete the moment the earliest, the moment parameter of preserving with oneself compares, and more late or larger moment parameter is preserved;
When the moment parameter receiving WaitOver function and import into, and complete moment parameter relatively after, just need this process to stop performing, till the stand-by period reaches the wait moment value the latest in the time queue of thread handle association always, then send event notice WaitOver function and return and exit.
Receive the stand-by period length not needed wait time management thread wait that Wait function sends, only have the time value sended over as WaiOver just finally to complete and perform wait.
Method of the present invention comprises two and arranges wait function, one is insert stand-by period Wait (double eDelayLength) function, another performs stand-by period WaitOver (double eDelayLength) function, wherein Wait function is used for the insertion wait of all microwave circuit parts except last, WaitOver function be used for last microwave circuit parts set up the rear insertion stand-by period, and until all stand-by period to returning again.
The principle that realizes of Wait function performance comprises the following steps:
First, current precise time point is obtained;
Then, after current precise time point being added the time needing to wait for, then obtain the thread handle of current thread, pass to latency management thread;
Next, latency management thread is multiple wait time delay queues of mark from thread handle, completing the earliest of reading and saving waits for that moment and this time point contrast, wait for that the moment is early than this time point if completed the earliest, substitute to complete the earliest with this time point and wait for the moment, stored in this thread handle for mark queue in, otherwise with this time point that function imports into substitute this thread handle mark complete the earliest wait for the moment;
Wait function executes, and returns immediately, do not wait for after having transmitted parameter.
The principle that realizes of WaitOver function performance comprises the following steps:
First, current precise time point is obtained;
Then, obtain the moment value needing to be deferred to after current precise time point being added the time needing to wait for, then obtain the thread handle of current thread, these two parameters are passed to latency management thread;
Next, latency management thread is multiple wait time delay queues of mark from thread handle, completing the earliest of reading and saving waits for that moment value and this time point contrast, wait for that the moment is early than this time point if completed the earliest, after then waiting for the stand-by period that WaitOver imports into, namely exited by WaitOver by event notice.
WaitOver function needs actual wait time enough to complete moment value the earliest to arrive.
In order to illustrate in greater detail technical scheme of the present invention, provide a specific embodiment below:
As shown in Figure 2, in certain model microwave signal analyser, total total input switch selection, YTF tuned filter, the many loops of synthesis local oscillator, multiple-pole switch wave filter, other microwave circuit unit etc., in the conventional mode, after setting up a microwave circuit unit, all to call Sleep function to wait for, after adopting the present invention, all places of originally calling Sleep wait all change Wait function call into, after executing all hardware setting, or last hardware cell needs the place of call waiting to change WaitOver into after setting completed.
Before the test starting instrument, a series of microwave circuit hardware cells of instrument internal are set, first input switch are set and select, wait for 500 milliseconds, then input YTF tuned filter is set, wait for 800 milliseconds, local oscillator synthesis loop is set again, wait for 900 milliseconds, then multiple-pole switch wave filter is set, wait for 500 milliseconds, other circuit unit is finally set, call after WaitOver waits for 500 milliseconds, complete the setting of instrument, instrument starts return measurement result data.
The time management thread moment started when performing is 10432ms (from starting shooting time of counting), and the execution time that arranges of each microwave component is 1ms, parameters in series and execution result as shown in table 1:
The classic method execution time adds the order stand-by period needs 3205ms altogether, and adopting after the present invention that the execution time adds the stand-by period is 11233-10432=801ms, and the time only needs original 25%, and efficiency rises to original nearly four times.
The present invention is multiplexing by the design stand-by period, can greatly reduce microwave apparatus Survey Software and arrange stand-by period in microwave circuit unit process, especially when microwave component is many, thus greatly improve the testing efficiency of microwave apparatus; Testing efficiency improves significantly, realizes with low cost, is convenient to promote.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.