summaryrefslogtreecommitdiffstats
path: root/src/server/globals.h
diff options
context:
space:
mode:
authorSimon Rettberg2017-10-25 15:32:02 +0200
committerSimon Rettberg2017-10-25 15:32:02 +0200
commita812c8ea51834482fcf1bc58a147a37886f58285 (patch)
tree2516df9af960b0a2572e287b66c6270b9a37c6dd /src/server/globals.h
parent[SERVER] Improve altserver handling and selection (diff)
downloaddnbd3-a812c8ea51834482fcf1bc58a147a37886f58285.tar.gz
dnbd3-a812c8ea51834482fcf1bc58a147a37886f58285.tar.xz
dnbd3-a812c8ea51834482fcf1bc58a147a37886f58285.zip
[SERVER] Improve handling of byte stats counters
Less writes to variables, more up-to-date values for uplinks.
Diffstat (limited to 'src/server/globals.h')
-rw-r--r--src/server/globals.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/globals.h b/src/server/globals.h
index 798f4ee..2dbabd5 100644
--- a/src/server/globals.h
+++ b/src/server/globals.h
@@ -68,6 +68,7 @@ struct _dnbd3_connection
int nextReplicationIndex; // Which index in the cache map we should start looking for incomplete blocks at
uint64_t replicationHandle; // Handle of pending replication request
uint64_t bytesReceived; // Number of bytes received by the connection.
+ uint64_t lastBytesReceived; // Number of bytes received last time we updated the global counter.
int queueLen; // length of queue
dnbd3_queued_request_t queue[SERVER_MAX_UPLINK_QUEUE];
};
@@ -123,11 +124,11 @@ struct _dnbd3_image
struct _dnbd3_client
{
#define HOSTNAMELEN (48)
- uint64_t bytesSent; // Byte counter for this client. Use statsLock when accessing
+ uint64_t bytesSent; // Byte counter for this client. Use statsLock when accessing.
+ uint64_t lastBytesSent; // Byte counter from when we last added to global counter. Use statsLock when accessing.
dnbd3_image_t *image;
- size_t tmpBytesSent; // Temporary byte counter that gets added to the global counter periodically. Use statsLock when accessing
int sock;
- bool isServer; // true if a server in proxy mode, false if real client
+ bool isServer; // true if a server in proxy mode, false if real client
dnbd3_host_t host;
char hostName[HOSTNAMELEN];
pthread_mutex_t sendMutex;