Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Quark Breaking Changes
~~~~~~~~~~~~~~~~~~~~~~
This file documents breaking and/or other changes that might require
user interaction. Examples include: a user facing structure change; a
new library call; a change in behaviour.

Changes from 0.1 to 0.2
~~~~~~~~~~~~~~~~~~~~~~~
o quark_queue_stats{} got a "backend" member.
1 change: 1 addition & 0 deletions bpf_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ bpf_queue_open(struct quark_queue *qq)
goto fail;

qq->queue_ops = &queue_ops_bpf;
qq->stats.backend = QQ_EBPF;

return (0);
fail:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ <h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1
</div>
<table class="foot">
<tr>
<td class="foot-date">October 15, 2024</td>
<td class="foot-date">October 18, 2024</td>
<td class="foot-os">Linux</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion docs/quark.7.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ <h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1
</div>
<table class="foot">
<tr>
<td class="foot-date">October 15, 2024</td>
<td class="foot-date">October 18, 2024</td>
<td class="foot-os">Linux</td>
</tr>
</table>
Expand Down
6 changes: 5 additions & 1 deletion docs/quark_queue_get_stats.3.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIP
u64 aggregations;
u64 non_aggregations;
u64 lost;
int backend;
};</pre>
</div>
<dl class="Bl-tag">
Expand All @@ -67,6 +68,9 @@ <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIP
simply can't handle the load, the former is way more likely. It is a state
counter representing total loss, the user should compare to an old reading
to know if it increased.</dd>
<dt id="backend"><a class="permalink" href="#backend"><i class="Em">backend</i></a></dt>
<dd>Active queue backend, either <code class="Dv">QQ_EBPF</code> or
<code class="Dv">QQ_KPROBE</code>.</dd>
</dl>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
Expand All @@ -85,7 +89,7 @@ <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
</div>
<table class="foot">
<tr>
<td class="foot-date">September 19, 2024</td>
<td class="foot-date">October 18, 2024</td>
<td class="foot-os">Linux</td>
</tr>
</table>
Expand Down
1 change: 1 addition & 0 deletions kprobe_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ kprobe_queue_open(struct quark_queue *qq)
}

qq->queue_ops = &queue_ops_kprobe;
qq->stats.backend = QQ_KPROBE;

return (0);

Expand Down
24 changes: 20 additions & 4 deletions quark-mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
static int gotsigint;

static void
quark_queue_dump_stats(struct quark_queue *qq)
dump_stats(struct quark_queue *qq)
{
struct quark_queue_stats s;
struct quark_queue_stats s;

quark_queue_get_stats(qq, &s);
printf("%8llu insertions %8llu removals %8llu aggregations "
Expand All @@ -28,6 +28,18 @@ quark_queue_dump_stats(struct quark_queue *qq)
s.non_aggregations, s.lost);
}

static const char *
fetch_backend(struct quark_queue *qq)
{
struct quark_queue_stats s;

quark_queue_get_stats(qq, &s);

return (s.backend == QQ_EBPF ? "ebpf" :
s.backend == QQ_KPROBE ? "kprobe" :
"invalid");
}

static void
sigint_handler(int sig)
{
Expand Down Expand Up @@ -179,6 +191,9 @@ main(int argc, char *argv[])
if ((qevs = calloc(nqevs, sizeof(*qevs))) == NULL)
err(1, "calloc");

if (quark_verbose)
printf("using %s for backend\n", fetch_backend(qq));

/* From now on we will be nobody */
if (do_priv_drop)
priv_drop();
Expand All @@ -204,7 +219,8 @@ main(int argc, char *argv[])
quark_event_dump(qev, stdout);
/* No events, just block */
if (n == 0) {
quark_queue_block(qq);
if (quark_queue_block(qq) == -1 && errno != EINTR)
err(1, "quark_queue_block");
continue;
}
}
Expand All @@ -225,7 +241,7 @@ main(int argc, char *argv[])
}

free(qevs);
quark_queue_dump_stats(qq);
dump_stats(qq);
quark_queue_close(qq);
free(qq);

Expand Down
1 change: 1 addition & 0 deletions quark.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ struct quark_queue_stats {
u64 aggregations;
u64 non_aggregations;
u64 lost;
int backend; /* active backend, QQ_EBPF or QQ_KPROBE */
/* TODO u64 peak_nodes; */
};

Expand Down
6 changes: 6 additions & 0 deletions quark_queue_get_stats.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct quark_queue_stats {
u64 aggregations;
u64 non_aggregations;
u64 lost;
int backend;
};
.Ed
.Bl -tag -width "non_aggregations"
Expand Down Expand Up @@ -50,6 +51,11 @@ fast enough or if
simply can't handle the load, the former is way more likely.
It is a state counter representing total loss, the user should compare to an old
reading to know if it increased.
.It Em backend
Active queue backend, either
.Dv QQ_EBPF
or
.Dv QQ_KPROBE .
.El
.Sh SEE ALSO
.Xr quark_event_dump 3 ,
Expand Down