summaryrefslogtreecommitdiffstats
path: root/streaming/rrdpush.h
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-07-01 01:13:00 +0300
committerGitHub <noreply@github.com>2023-07-01 01:13:00 +0300
commitfdfc8fa0b13414898d1ac7d6e51808b418b951de (patch)
tree97adfd5bdbd1cfe6eadbe143c0517a59eb9f1e45 /streaming/rrdpush.h
parent5b56f09dbcfa159605268e731c02734486530507 (diff)
Optimizations part 3 (#15293)
* use madvise to speed up indexing * collect all rrddim members into a collector structure * use tier 0 virtual point for storing last stored value * reorganize key fields in rrddim * remove fgets from pluginsd and replace it with read() * properly uncork the web server sockets * Revert "reorganize key fields in rrddim" This reverts commit 2d45fa3959087e05462d387ff115a260f3a04b60. * Revert "use tier 0 virtual point for storing last stored value" This reverts commit a576cdd377ad4778a3b8608cabbb7ea7bb19a3a8. * fix cork names * fix compilation warnings
Diffstat (limited to 'streaming/rrdpush.h')
-rw-r--r--streaming/rrdpush.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/streaming/rrdpush.h b/streaming/rrdpush.h
index 7ee2e1bf85..f97b7f6912 100644
--- a/streaming/rrdpush.h
+++ b/streaming/rrdpush.h
@@ -350,6 +350,19 @@ typedef struct stream_node_instance {
} STREAM_NODE_INSTANCE;
*/
+struct buffered_reader {
+ ssize_t read_len;
+ ssize_t pos;
+ char read_buffer[PLUGINSD_LINE_MAX + 1];
+};
+
+char *buffered_reader_next_line(struct buffered_reader *reader, char *dst, size_t dst_size);
+static inline void buffered_reader_init(struct buffered_reader *reader) {
+ reader->read_buffer[0] = '\0';
+ reader->read_len = 0;
+ reader->pos = 0;
+}
+
struct receiver_state {
RRDHOST *host;
pid_t tid;
@@ -371,8 +384,8 @@ struct receiver_state {
struct rrdhost_system_info *system_info;
STREAM_CAPABILITIES capabilities;
time_t last_msg_t;
- char read_buffer[PLUGINSD_LINE_MAX + 1];
- int read_len;
+
+ struct buffered_reader reader;
uint16_t hops;