summaryrefslogtreecommitdiff
path: root/logger.h
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2016-06-12 11:15:00 -0700
committerdormando <dormando@rydia.net>2016-06-16 17:14:34 -0700
commita4f8b982fa7cd404a007991e99e2f7d53cdef0dc (patch)
tree5607bce497f5788d1420df489536126e040c2a68 /logger.h
parentd5f7f89ad53b749ae22e896dc76d16ff980c7528 (diff)
downloadmemcached-a4f8b982fa7cd404a007991e99e2f7d53cdef0dc.tar.gz
use one bipbuffer per watcher. remove iovec code.
after the previous commit's exercise, this greatly simplifies the writing process. The buffers are large but can be tuned with performance testing. Lines are now rendered into scratch space, and if event flags (eflags) match for a watcher, copy the bytes into that watcher's specific buffer. In most realistic cases, watchers will be watching different streams of information. While this does require a minimum of one memcpy instead of directly writing into the bipbuf as before, it removes all of the loops and management of iovecs required for filtering events on the write-to-socket end.
Diffstat (limited to 'logger.h')
-rw-r--r--logger.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/logger.h b/logger.h
index 6cad6ca..c55186e 100644
--- a/logger.h
+++ b/logger.h
@@ -6,7 +6,7 @@
/* TODO: starttime tunable */
#define LOGGER_BUF_SIZE 1024 * 64
-#define LOGGER_THREAD_BUF_SIZE 1024 * 256
+#define LOGGER_WATCHER_BUF_SIZE 1024 * 256
#define LOGGER_ENTRY_MAX_SIZE 2048
#define GET_LOGGER() ((logger *) pthread_getspecific(logger_key));
@@ -35,13 +35,13 @@ enum logger_parse_entry_ret {
typedef const struct {
enum log_entry_subtype subtype;
int reqlen;
- uint16_t watcher_flag;
+ uint16_t eflags;
char *format;
} entry_details;
typedef struct _logentry {
enum log_entry_subtype event;
- uint16_t watcher_flag;
+ uint16_t eflags;
uint64_t gid;
struct timeval tv; /* not monotonic! */
int size;
@@ -84,11 +84,11 @@ typedef struct {
void *c; /* original connection structure. still with source thread attached */
int chunks; /* count of chunks stored up */
int sfd; /* client fd */
- int flushed; /* backlog data flushed so far from active chunk */
- int min_flushed; /* it's safe to flush the central buffer up to here */
+ uint64_t skipped; /* lines skipped since last successful print */
int id; /* id number for watcher list */
enum logger_watcher_type t; /* stderr, client, syslog, etc */
uint16_t eflags; /* flags we are interested in */
+ bipbuf_t *buf; /* per-watcher output buffer */
} logger_watcher;
extern pthread_key_t logger_key;