test-bus-kernel-benchmark.c revision 40ca29a1370379d43e44c0ed425eecc7218dcbca
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <ctype.h>
#include "util.h"
#include "log.h"
#include "time-util.h"
#include "sd-bus.h"
#include "bus-message.h"
#include "bus-error.h"
#include "bus-kernel.h"
#include "bus-internal.h"
#include "bus-util.h"
int r;
for (;;) {
r = sd_bus_process(b, &m);
assert_se(r >= 0);
if (r == 0)
if (!m)
continue;
const void *p;
/* Make sure the mmap is mapped */
return;
} else
assert_not_reached("Unknown method");
}
}
uint8_t *p;
}
static void client_bisect(const char *address) {
sd_bus *b;
int r;
r = sd_bus_new(&b);
assert_se(r >= 0);
r = sd_bus_set_address(b, address);
assert_se(r >= 0);
r = sd_bus_start(b);
assert_se(r >= 0);
lsize = 1;
printf("SIZE\tCOPY\tMEMFD\n");
for (;;) {
usec_t t;
break;
if (csize <= 0)
break;
b->use_memfd = 0;
t = now(CLOCK_MONOTONIC);
transaction(b, csize);
break;
}
b->use_memfd = -1;
t = now(CLOCK_MONOTONIC);
transaction(b, csize);
break;
}
break;
else
}
b->use_memfd = 1;
sd_bus_unref(b);
}
static void client_chart(const char *address) {
sd_bus *b;
int r;
r = sd_bus_new(&b);
assert_se(r >= 0);
r = sd_bus_set_address(b, address);
assert_se(r >= 0);
r = sd_bus_start(b);
assert_se(r >= 0);
printf("SIZE\tCOPY\tMEMFD\n");
usec_t t;
b->use_memfd = 0;
t = now(CLOCK_MONOTONIC);
transaction(b, csize);
break;
}
b->use_memfd = -1;
t = now(CLOCK_MONOTONIC);
transaction(b, csize);
break;
}
}
b->use_memfd = 1;
sd_bus_unref(b);
}
enum {
} mode = MODE_BISECT;
int i;
sd_bus *b;
int r;
for (i = 1; i < argc; i++) {
mode = MODE_CHART;
continue;
}
}
assert_se(arg_loop_usec > 0);
r = sd_bus_new(&b);
assert_se(r >= 0);
r = sd_bus_set_address(b, address);
assert_se(r >= 0);
r = sd_bus_start(b);
assert_se(r >= 0);
sync();
if (pid == 0) {
sd_bus_unref(b);
switch (mode) {
case MODE_BISECT:
break;
case MODE_CHART:
break;
}
_exit(0);
}
if (mode == MODE_BISECT)
sd_bus_unref(b);
return 0;
}