openocd: drop iteration downsampling for keep_alive()
The function keep_alive() is optimized and return immediately if has nothing to do. There is no need to overly-complicate the code with extra counters or time computation plus the relative checks to reduce the number of calls to keep_alive(). Drop such extra code. Change-Id: I4574a3f154b5779f44105936c74af8fca1d2c49c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9064 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Lucien Buchmann <lucien.buchmann@dufour.aero>
This commit is contained in:
@@ -3216,8 +3216,6 @@ COMMAND_HANDLER(handle_wait_halt_command)
|
||||
/* wait for target state to change. The trick here is to have a low
|
||||
* latency for short waits and not to suck up all the CPU time
|
||||
* on longer waits.
|
||||
*
|
||||
* After 500ms, keep_alive() is invoked
|
||||
*/
|
||||
int target_wait_state(struct target *target, enum target_state state, unsigned int ms)
|
||||
{
|
||||
@@ -3239,11 +3237,9 @@ int target_wait_state(struct target *target, enum target_state state, unsigned i
|
||||
nvp_value2name(nvp_target_state, state)->name);
|
||||
}
|
||||
|
||||
if (cur - then > 500) {
|
||||
keep_alive();
|
||||
if (openocd_is_shutdown_pending())
|
||||
return ERROR_SERVER_INTERRUPTED;
|
||||
}
|
||||
keep_alive();
|
||||
if (openocd_is_shutdown_pending())
|
||||
return ERROR_SERVER_INTERRUPTED;
|
||||
|
||||
if ((cur-then) > ms) {
|
||||
LOG_ERROR("timed out while waiting for target %s",
|
||||
|
||||
Reference in New Issue
Block a user