mirror of https://github.com/schoebel/mars
client: don't run timeout code too often for performance
This commit is contained in:
parent
be54077864
commit
e38814e320
|
@ -767,6 +767,14 @@ void _do_timeout(struct client_output *output, struct list_head *anchor, int *ro
|
|||
get_real_lamport(&timeout_stamp);
|
||||
timeout_stamp.tv_sec -= io_timeout;
|
||||
|
||||
/* Don't run more than once per second */
|
||||
if (!force &&
|
||||
lamport_time_compare(&timeout_stamp, &brick->last_timeout_stamp) <= 0)
|
||||
return;
|
||||
|
||||
memcpy(&brick->last_timeout_stamp, &timeout_stamp, sizeof(brick->last_timeout_stamp));
|
||||
brick->last_timeout_stamp.tv_sec += 1;
|
||||
|
||||
mutex_lock(&output->mutex);
|
||||
for (tmp = anchor->prev, prev = tmp->prev; tmp != anchor; tmp = prev, prev = tmp->prev) {
|
||||
struct client_mref_aspect *mref_a;
|
||||
|
|
|
@ -54,14 +54,14 @@ struct client_brick {
|
|||
bool allow_permuting_writes;
|
||||
bool separate_reads;
|
||||
// readonly from outside
|
||||
int connection_state; // 0 = switched off, 1 = not connected, 2 = connected
|
||||
/* internal */
|
||||
int connection_state; // 0 = switched off, 1 = connected
|
||||
atomic_t sender_count;
|
||||
atomic_t receiver_count;
|
||||
int socket_count;
|
||||
atomic_t fly_count;
|
||||
atomic_t timeout_count;
|
||||
struct lamport_time hang_stamp; /* submit stamp of eldest request */
|
||||
struct lamport_time last_timeout_stamp;
|
||||
};
|
||||
|
||||
struct client_input {
|
||||
|
|
Loading…
Reference in New Issue