Summary of the invention
The purpose of the embodiment of the invention provides a kind of method, device and digital terminal of adjusting the touch-screen sampling interval, is used for solving taking the high problem of CPU usage when prior art is pushed touch-screen for a long time.
For addressing the above problem, the embodiment of the invention provides a kind of method of adjusting the touch-screen sampling interval, comprising:
Calculate CPU usage;
Adjust the sampling interval of touch-screen according to described CPU usage.
Wherein, also comprise before the described calculating CPU usage:
When beginning to push described touch-screen, the incident of pushing is carried out timing.
Wherein, the described CPU usage of described calculating also comprises:
Read the correlation parameter of described digital terminal CPU usage respectively at first Preset Time and second Preset Time, described correlation parameter is used to calculate described CPU usage.
Wherein, describedly when beginning to push described touch-screen, the incident of pushing is carried out timing and also comprises:
When beginning to push described touch-screen, be that unit carries out timing to compressing time with initial sampling interval.
The embodiment of the invention also provides a kind of device of adjusting the touch-screen sampling interval, wherein, comprising:
Computing module is used to calculate CPU usage;
Adjusting module is used for the sampling interval according to described CPU usage adjustment touch-screen.
Wherein, also comprise:
Timing module carries out timing to the incident of pushing when beginning to push described touch-screen.
Wherein, also comprise:
Read module is used for reading at first Preset Time and second Preset Time correlation parameter of described CPU usage.
Wherein, described timing module also is used for:
When beginning to push described touch-screen, be that unit carries out timing to the incident of pushing with initial sampling interval.
The embodiment of the invention also provides a kind of above-mentioned any digital terminal of adjusting the device of touch-screen sampling interval that adopts.
In the embodiment of the invention, by prolonging the sampling interval of touch-screen, take too much CPU usage to reduce the touch-screen sampling, reduce that touch-screen causes playing or the break period and the interruption times of video playback because of pushing for a long time, do not reduce the reaction effect of touch-screen again, play at digital terminal, video playback takies CPU usage hour, use less sampling interval that the incident of pushing of touch-screen is sampled, both guaranteed the smoothness of recreation or video playback etc., guarantee the reaction effect of touch-screen again, improved user's experience.
Embodiment
Below by drawings and Examples, technical scheme of the present invention is done detailed description further.
The embodiment of the invention is adjusted the method specific embodiment one of touch-screen sampling interval
Fig. 1 adjusts the process flow diagram of the method specific embodiment one of touch-screen sampling interval for the embodiment of the invention.As shown in Figure 1, the job step of the method for embodiment of the invention adjustment touch-screen sampling interval specifically comprises as follows:
Step 101, calculating CPU usage.
In embodiments of the present invention, be that example is introduced technical scheme with digital terminal with touch-screen, for example mobile phone, notebook computer or MP4 etc.View and admire video at the use digital terminal; when communicating by letter or playing; above-mentioned digital terminal business can take the bigger utilization rate of CPU of digital terminal usually; carry out pressing operation to touch-screen this moment; touch-screen then begins with initial sampling interval the incident of pushing to be sampled; sampling to touch-screen takies certain CPU usage equally; in actual applications; initial sampling interval can be set at 1ms; when beginning to push touch-screen, the incident of pushing is sampled; and read the correlation parameter of digital terminal CPU usage respectively at first Preset Time and second Preset Time; first Preset Time and second Preset Time can be set at 20ms and 100ms respectively; the correlation parameter of CPU usage comprises user's attitude; system's attitude and Idle state; represent that respectively CPU is in the time that user's attitude is carried out; the time that time that system kernel is carried out and idle systems process are carried out, CPU usage is meant in the embodiment of the invention: CPU carries out total execution time of time/CPU of nonsystematic idle process.
In the present embodiment, with initial sampling interval 1ms the incident of pushing is adopted, so also first Preset Time and second Preset Time can be set at the 20th sampling time and the 100th sampling time respectively, promptly when sampling and the 100th time the incident of pushing being sampled for the 20th time, read the correlation parameter of CPU usage, correlation parameter according to the CPU usage that reads for twice, calculate the digital terminal CPU usage, enter step 102 then.
Step 102, adjust the sampling interval of touch-screen according to CPU usage.
After calculating CPU usage, adjust the sampling interval of touch-screen according to preset rules, preset rules is included in CPU usage when high, prolong the sampling interval of touch-screen, when CPU usage is low, the sampling interval of dwindling touch-screen, in embodiments of the present invention, the relation of CPU usage and sampling interval is as shown in table 1
| CPU usage (%) |
0~29 |
30~59 |
60~89 |
90~100 |
| Sampling interval (ms) |
1 |
2 |
3 |
4 |
Table 1
As can be known from Table 1, when CPU usage 0~29% the time, sampling interval is initial sampling interval 1ms, when CPU usage 30~59% the time, sampling interval is adjusted into 2ms, when CPU usage 60~89% the time, sampling interval is adjusted into 3ms, when CPU usage 90~100% the time, sampling interval is adjusted into 4ms, after adjusting end, when touch-screen is sampled to the incident of pushing once more, sample with adjusted sampling interval.
In the embodiment of the invention, touch-screen can be various digital terminals such as computer, mobile phone or MP4.
In the embodiment of the invention, by read the correlation parameter of CPU usage at first Preset Time and second Preset Time, calculate CPU usage, adjust the sampling interval of touch-screen then according to CPU usage, play at digital terminal with touch-screen, when video playback etc. take bigger professional of CPU usage, by prolonging the sampling interval of touch-screen, take too much CPU usage to reduce the touch-screen sampling, reduce that touch-screen causes playing or the break period and the interruption times of video playback because of pushing for a long time, do not reduce the reaction effect of touch-screen again, play at digital terminal, video playback takies CPU usage hour, use less sampling interval that the incident of pushing of touch-screen is sampled, both guaranteed the smoothness of recreation or video playback etc., guarantee the reaction effect of touch-screen again, improved user's experience.
The embodiment of the invention is adjusted the method specific embodiment two of touch-screen sampling interval
Fig. 2 adjusts the process flow diagram of the method specific embodiment two of touch-screen sampling interval for the embodiment of the invention.As shown in Figure 2, the course of work of the method for embodiment of the invention adjustment touch-screen sampling interval comprises the steps:
Step 201, touch-screen detect the incident of whether pushing.
If touch-screen does not detect the incident of pushing, then touch-screen is in the acquiescence sample states, and this moment, the incident of pushing can not sampled, if touch-screen detects the incident of pushing, then entered step 202.
Step 202, the incident of pushing is sampled.
In embodiments of the present invention, the incident of pushing of touch-screen is at first sampled with the initial sampling interval of acquiescence, calculate the initial frequency n at interval that adopts in pushing event procedure, n is since 0, and is every through a sampling interval, and the numerical value of n increases by 1.
Step 203, judgement are pushed incident and whether are reached first Preset Time.
In embodiments of the present invention, first Preset Time is to be that the number of times that unit samples is determined with initial sampling interval, because initial sampling interval is 1ms, first Preset Time is 20ms, so, when sampling number to 20 time, promptly think to reach first Preset Time, when the judgement incident of pushing reaches first Preset Time, enter step 204, when the judgement incident of pushing does not reach first Preset Time or surpasses first Preset Time, then proceed the sampling meter, and enter step 205.
Step 204, read the correlation parameter of CPU usage.
After reading the correlation parameter of CPU usage, continue the incident of pushing is sampled according to step 202.
Step 205, judgement are pushed incident and whether are reached second Preset Time.
In embodiments of the present invention, second Preset Time is set at 100ms, is frequency n that unit samples when reaching 100 times with initial sampling interval then, and the incident of pushing reaches second Preset Time.When the judgement incident of pushing does not reach second Preset Time, then continue the incident of pushing is sampled, when the judgement incident of pushing reaches second Preset Time, then enter step 206.
Step 206, read the correlation parameter of CPU usage.
Step 207, calculating CPU usage.
The sampling interval of step 208, adjustment touch-screen.
According to CPU usage and the CPU usage as shown in table 1 and the relation of sampling interval, adjust sampling interval, with adjusted sampling interval the incident of pushing is sampled then; When CPU usage was low, touch-screen used less sampling interval, made touch-screen keep high reaction sensitivity, and when CPU usage was higher, the sampling interval of proper extension touch-screen took CPU usage to reduce to pushing the incident sampling.
In embodiments of the present invention, calculate the CPU usage of digital terminal according to the correlation parameter of CPU usage, adjust the sampling interval of touch-screen according to CPU usage, when the CPU usage of digital terminal is big, dynamically prolong the sampling interval of touch-screen, take too much CPU usage to reduce the touch-screen sampling, reduce because of pushing for a long time that touch-screen causes playing or the break period and the interruption times of business such as video playback, do not reduce the reaction effect of touch-screen again, in the CPU usage of digital terminal hour, use less sampling interval to sample to pushing touch-screen, both guaranteed that the smoothness of business such as recreation or video playback carried out, guarantee the reaction effect of touch-screen again, improved user's experience.
The embodiment of the invention is adjusted the device specific embodiment one of touch-screen sampling interval
Fig. 3 adjusts the structural representation of the device specific embodiment one of touch-screen sampling interval for the embodiment of the invention.As shown in Figure 3, the device that the embodiment of the invention is adjusted the touch-screen sampling interval comprises: computing module 301 and adjusting module 302, and wherein, computing module 301 is used to calculate CPU usage; Adjusting module 302 is used for adjusting according to CPU usage the sampling interval of touch-screen.
The embodiment of the invention calculates CPU usage by computing module, adjust the sampling interval of touch-screen again according to CPU usage by adjusting module, in the sampling interval of CPU usage than the long touch-screen of long time delay, take too much CPU usage when the incident of pushing of touch-screen being sampled with minimizing, hour shorten the sampling interval of touch-screen in CPU usage, further improve the reaction effect of touch-screen, by sampling interval according to the whole touch-screen of CPU usage adjustment, both reduced because the incident of pushing causes interruption times and the break period of digital terminal when CPU usage is higher, and can guarantee the reaction sensitivity of touch-screen again.
The embodiment of the invention is adjusted the device specific embodiment two of touch-screen sampling interval
Fig. 4 adjusts the structural representation of the device specific embodiment two of touch-screen sampling interval for the embodiment of the invention.As shown in Figure 4, the device that the embodiment of the invention is adjusted the touch-screen sampling interval can also comprise timing module 303 and read module 304, wherein, timing module 303 is used for when beginning to push touch-screen the incident of pushing being carried out timing, also can be to be that unit comes timing to the mode of pushing the incident metering with the sampling interval, read module 304 is used for reading at first Preset Time and second Preset Time correlation parameter of described digital terminal CPU usage, and the correlation parameter of this CPU usage is used to calculate CPU usage.
The embodiment of the invention is sampled to the incident of pushing, timing module carries out timing to the sampling of pushing sample event or is that the mode that unit carries out metering is come timing with the sampling interval, read module reads the correlation parameter of CPU usage to obtain CPU usage when first Preset Time of timing module timing and second Preset Time, adjust the sampling interval of touch-screen then according to CPU usage, in the sampling interval of CPU usage than the long touch-screen of long time delay, take more CPU usage when the incident of pushing of touch-screen being sampled with minimizing, hour shorten the sampling interval of touch-screen in CPU usage, reaction effect with further raising touch-screen, the embodiment of the invention is by the sampling interval according to the whole touch-screen of CPU usage adjustment, both reduced because the incident of pushing causes interruption times and the break period of digital terminal when CPU usage is higher, and can guarantee the reaction sensitivity of touch-screen again.
Embodiment of the invention digital terminal specific embodiment
Fig. 5 is the structural representation of embodiment of the invention digital terminal specific embodiment.As shown in Figure 5, embodiment of the invention digital terminal comprises touch-screen 20, adjust the device 30 and the CPU of touch-screen sampling interval, touch-screen 20 carries out the incident of pushing is sampled and notified CPU when being pressed, touch-screen 20 is used for receiving when pushing at senses touch screen samples to the incident of pushing, when beginning, serve as that the acquiescence sample unit is sampled to the incident of pushing with initial sampling interval usually, the device 30 of adjusting the touch-screen sampling interval can adopt the embodiment of the invention to adjust the device specific embodiment one of touch-screen sampling interval or the structure of specific embodiment two, adopt the structure of the device specific embodiment of adjusting the touch-screen sampling interval in the embodiment of the invention, CPU is the processor of handling various signals and instruction.
Described terminal can be mobile digital terminals such as mobile phone, MP4, also can be digital terminals such as computer.
The embodiment of the invention is in the sampling interval of CPU usage than the long touch-screen of long time delay, take more CPU usage when the incident of pushing of touch-screen being sampled with minimizing, hour shorten the sampling interval of touch-screen in CPU usage, reaction effect with further raising touch-screen, the embodiment of the invention is by the sampling interval according to the whole touch-screen of CPU usage adjustment, both reduced because the incident of pushing causes interruption times and the break period of digital terminal when CPU usage is higher, and can guarantee the reaction sensitivity of touch-screen again.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of programmed instruction, aforesaid program can be stored in the computer read/write memory medium, this program is carried out the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the scope of various embodiments of the present invention technical scheme.