/***
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 "sd-bus.h"
#include "alloc-util.h"
#include "bus-internal.h"
#include "bus-kernel.h"
#include "bus-util.h"
#include "def.h"
#include "fd-util.h"
#include "time-util.h"
#include "util.h"
typedef enum Type {
} Type;
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 */
r = sd_bus_reply_method_return(m, NULL);
assert_se(r >= 0);
return;
assert_not_reached("Unknown method");
}
}
uint8_t *p;
assert_se(sd_bus_message_new_method_call(b, &m, server_name, "/", "benchmark.server", "Work") >= 0);
}
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);
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);
break;
}
b->use_memfd = -1;
t = now(CLOCK_MONOTONIC);
break;
}
break;
else
}
b->use_memfd = 1;
assert_se(sd_bus_message_new_method_call(b, &x, server_name, "/", "benchmark.server", "Exit") >= 0);
sd_bus_unref(b);
}
sd_bus *b;
int r;
r = sd_bus_new(&b);
assert_se(r >= 0);
if (type == TYPE_DIRECT) {
assert_se(r >= 0);
} else {
r = sd_bus_set_address(b, address);
assert_se(r >= 0);
r = sd_bus_set_bus_client(b, true);
assert_se(r >= 0);
}
r = sd_bus_start(b);
assert_se(r >= 0);
assert_se(r >= 0);
switch (type) {
case TYPE_KDBUS:
printf("SIZE\tCOPY\tMEMFD\n");
break;
case TYPE_LEGACY:
printf("SIZE\tLEGACY\n");
break;
case TYPE_DIRECT:
printf("SIZE\tDIRECT\n");
break;
}
usec_t t;
if (type == TYPE_KDBUS) {
b->use_memfd = 0;
t = now(CLOCK_MONOTONIC);
break;
}
b->use_memfd = -1;
}
t = now(CLOCK_MONOTONIC);
break;
}
}
b->use_memfd = 1;
assert_se(sd_bus_message_new_method_call(b, &x, server_name, "/", "benchmark.server", "Exit") >= 0);
sd_bus_unref(b);
}
enum {
const char *unique;
sd_bus *b;
int r;
for (i = 1; i < argc; i++) {
mode = MODE_CHART;
continue;
type = TYPE_LEGACY;
continue;
type = TYPE_DIRECT;
continue;
}
}
assert_se(arg_loop_usec > 0);
if (type == TYPE_KDBUS) {
} else if (type == TYPE_LEGACY) {
const char *e;
e = secure_getenv("DBUS_SESSION_BUS_ADDRESS");
assert_se(e);
}
r = sd_bus_new(&b);
assert_se(r >= 0);
if (type == TYPE_DIRECT) {
assert_se(r >= 0);
r = sd_bus_set_server(b, true, SD_ID128_NULL);
assert_se(r >= 0);
} else {
r = sd_bus_set_address(b, address);
assert_se(r >= 0);
r = sd_bus_set_bus_client(b, true);
assert_se(r >= 0);
}
r = sd_bus_start(b);
assert_se(r >= 0);
if (type != TYPE_DIRECT) {
r = sd_bus_get_unique_name(b, &unique);
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;
}