QUARK_QUEUE_OPEN(3) | Library Functions Manual | QUARK_QUEUE_OPEN(3) |
quark_queue_open
—
initialize a quark_queue
#include
<quark.h>
int
quark_queue_open
(struct
quark_queue *qq, struct
quark_queue_attr *attr);
quark_queue_open
initializes the
quark_queue pointed to by qq with
the attributes pointed to by attr.
A quark_queue is the main runtime datastructure of quark, it is loosely called a queue as it's where events will originate from. Events will be collected into the queue, buffered, aggregated and filtered if necessary.
The quark_queue_open
function does the
following:
quark_queue_open
is smart
enough to open the rings before the scraping, as to be make sure no
process is lost. These initial process events will be available on the
first call to
quark_queue_get_event(3)
with the events member set to
QUARK_EV_SNAPSHOT
.Default queue behaviour can be tweaked with attr. A default configuration for tweaking can be acquired via quark_queue_default_attr(3). In case attr is NULL, the default configuration is used.
struct quark_queue_attr is defined as:
struct quark_queue_attr { int flags; int max_length; int cache_grace_time; /* in milliseconds */ int hold_time; /* in milliseconds */ ... };
QQ_EBPF
QQ_KPROBE
QQ_ALL_BACKENDS
QQ_THREAD_EVENTS
QQ_NO_SNAPSHOT
QQ_MIN_AGG
QQ_ENTRY_LEADER
Quark buffers each event for a computed interval in order to sort and aggregate multiple events into one. The closer the queue is to being full, the smaller the interval: until quark decides to not buffer events at all.
When a process exits, it is removed from the cache, but only after cache_grace_time, this gives the user a small window where it can still query a terminated process via quark_process_lookup(3).
Events received from the backend are not immediately forwarded to the user, this allows multiple events to be aggregated as well as ordered by time. In case quark is overloaded, it will use a stepping function where hold_time decreases the more loaded it is.
Details are described in quark(7).
Zero on success, -1 otherwise and errno is set. In the case of an error, the internal state is cleared up and a quark_queue_close(3) should NOT be issued.
quark_event_dump(3), quark_process_lookup(3), quark_queue_block(3), quark_queue_close(3), quark_queue_default_attr(3), quark_queue_get_epollfd(3), quark_queue_get_event(3), quark_queue_get_stats(3), quark(7), quark-btf(8), quark-mon(8), quark-test(8)
December 1, 2024 | Linux |