#include <inttypes.h>
#include <ncurses.h>
+#ifdef WITH_FWP
+#include <ul_logreg.h>
+#endif
+
#ifdef WITH_FWP
#include <frsh.h>
#include <fwp_res.h>
#else
int recv_packet_fwp(struct stream *stream, struct msg_t *msg)
{
+ int ret;
size_t mlen;
- mlen = frsh_receive_sync(stream->resp_endpoint, msg, sizeof(*msg), &mlen, NULL);
+ ret = frsh_receive_sync(stream->resp_endpoint, msg, sizeof(*msg), &mlen, NULL);
return mlen;
}
#endif
int ret = 0;
buff->msg.resp_port = htons(stream->resp_port);
- ret = frsh_send_sync(stream->endpoint, buff, stream->packet_size);
+ ret = frsh_send_async(stream->endpoint, buff, stream->packet_size);
+ if (ret) {
+ char msg[1024];
+ frsh_strerror(ret, msg, sizeof(msg));
+ fprintf(stderr, "frsh_send error: %s\n", msg);
+ }
return (ret == 0) ? 0 : -1;
}
#endif
ret = send_packet(stream, &buff);
if (ret < 0) {
+ stopper();
goto out;
}
fflush(stderr);
}
+#ifdef WITH_FWP
+int print_log_domain(ul_log_domain_t *domain, void *context)
+{
+ printf("%s = %d\n", domain->name, domain->level);
+ return 0;
+}
+#endif
int main(int argc, char *argv[])
{
int i, rc, frames, seconds;
char opt;
- while ((opt = getopt(argc, argv, "B:b:C:c:Gg:I:j:o:qQ:s:T:")) != -1) {
+ while ((opt = getopt(argc, argv, "B:b:C:c:Gg:I:j:l:o:qQ:s:T:")) != -1) {
switch (opt) {
case 'B':
opt_def_bandwidth = atoi(optarg);
opt_jitter = atoi(optarg);
#endif
break;
+#ifdef WITH_FWP
+ case 'l':
+ if (*optarg == '?') {
+ ul_logreg_for_each_domain(print_log_domain, NULL);
+ exit(0);
+ }
+ {
+ int ret;
+ ret = ul_log_domain_arg2levels(optarg);
+ if (ret)
+ error(1, EINVAL, "Error parsing -l argument at char %d\n", ret);
+ }
+ break;
+#endif
case 'o':
opt_output = optarg;
break;
fprintf(stderr, " -C comment (added to header)\n");
fprintf(stderr, " -c count (number of seconds to run)\n");
fprintf(stderr, " -g histogram granularity [usec]\n");
+ fprintf(stderr, " -G show status in textual GUI\n");
fprintf(stderr, " -I <interface> send packets from this interface\n");
+#ifdef WITH_FWP
+ fprintf(stderr, " -l <loglevel> uLUt logging levels\n");
+#endif
fprintf(stderr, " -j send jitter (0-100) [%%]\n");
fprintf(stderr, " -o output filename (.dat will be appended)\n");
fprintf(stderr, " -q gather statistics only after some queue becomes full\n");
}
end_gui();
+
+ fprintf(stderr, "\nWaiting for threads to finish\n");
+ wait_for_all_threads_to_finish();
+
#ifdef WITH_FWP
for (i=0; i < nr_streams; i++) {
if (streams[i].vres)
}
#endif
- fprintf(stderr, "\nWaiting for threads to finish\n");
- wait_for_all_threads_to_finish();
-
struct timespec ts;
uint64_t end_timestamp, measure_length;
clock_gettime(CLOCK_REALTIME,&ts);