Function report |
Source Code:init\calibrate.c |
Create Date:2022-07-28 13:55:16 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:calibrate_delay_direct
Proto:static unsigned long calibrate_delay_direct(void)
Type:unsigned long
Parameter:Nothing
| 41 | good_timer_sum = 0 |
| 42 | good_timer_count = 0 |
| 44 | max = -1 |
| 45 | min = -1 |
| 48 | If read_current_timer( & pre_start) < 0 Then Return 0 |
| 70 | When i < MAX_DIRECT_CALIBRATION_RETRIES cycle |
| 71 | pre_start = 0 |
| 72 | read_current_timer( & start) |
| 73 | start_jiffies = jiffies |
| 74 | When time_before_eq(jiffies, start_jiffies + 1) cycle |
| 76 | read_current_timer( & start) |
| 78 | read_current_timer( & post_start) |
| 80 | pre_end = 0 |
| 81 | end = post_start |
| 85 | read_current_timer( & end) |
| 87 | read_current_timer( & post_end) |
| 103 | If start < post_end && pre_start != 0 && pre_end != 0 && timer_rate_max - timer_rate_min < timer_rate_max >> 3 Then |
| 105 | good_timer_count++ |
| 106 | good_timer_sum += timer_rate_max |
| 107 | measured_times[i] = timer_rate_max |
| 108 | If max < 0 || timer_rate_max > measured_times[max] Then max = i |
| 110 | If min < 0 || timer_rate_max < measured_times[min] Then min = i |
| 112 | Else measured_times[i] = 0 |
| 121 | When good_timer_count > 1 cycle |
| 126 | estimate = good_timer_sum / good_timer_count |
| 130 | If measured_times[max] - measured_times[min] < maxdiff Then Return estimate |
| 134 | good_timer_sum = 0 |
| 135 | good_timer_count = 0 |
| 136 | If measured_times[max] - estimate < estimate - measured_times[min] Then |
| 141 | measured_times[min] = 0 |
| 143 | Else |
| 147 | measured_times[max] = 0 |
| 151 | When i < MAX_DIRECT_CALIBRATION_RETRIES cycle |
| 152 | If measured_times[i] == 0 Then Continue |
| 154 | good_timer_count++ |
| 155 | good_timer_sum += measured_times[i] |
| 156 | If measured_times[i] < measured_times[min] Then min = i |
| 158 | If measured_times[i] > measured_times[max] Then max = i |
| 167 | Return 0 |
| Name | Describe |
|---|---|
| calibrate_delay |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |