Add read buffer to bitbang, improving performance.
Previously for every bit scanned OpenOCD would write the bit, wait for that bit to be scanned, and then read the result. This involves at least 2 context switches. Most of the time the next bit scanned does not depend on the last bit we read, so with a buffer we now write a bunch of bits to be scanned all at once, and then we wait for them all to be scanned and have a result. This reduces the time for one testcase where OpenOCD connects to a simulator from 12.30s to 5.35s! Running all our tests went from 13m13s to 3m55s. Change-Id: Ie9fcea043ac1d7877a521125334ed47d4b3e1615 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4312 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
committed by
Freddie Chopin
parent
2428722a23
commit
64f1f7b1c1
@@ -199,6 +199,17 @@ static inline int close_socket(int sock)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void socket_block(int fd)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
unsigned long nonblock = 0;
|
||||
ioctlsocket(fd, FIONBIO, &nonblock);
|
||||
#else
|
||||
int oldopts = fcntl(fd, F_GETFL, 0);
|
||||
fcntl(fd, F_SETFL, oldopts & ~O_NONBLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void socket_nonblock(int fd)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
Reference in New Issue
Block a user