Add bad_open benchmark, which measures failed opens by calling

open("", O_RDONLY);.

Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
This commit is contained in:
Edward Tomasz Napierala 2017-11-02 12:15:39 +00:00
parent cf8ca06ad8
commit e2828958cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325317

View file

@ -391,6 +391,21 @@ test_open_close(uintmax_t num, uintmax_t int_arg, const char *path)
return (i); return (i);
} }
uintmax_t
test_bad_open(uintmax_t num, uintmax_t int_arg, const char *path)
{
uintmax_t i;
benchmark_start();
for (i = 0; i < num; i++) {
if (alarm_fired)
break;
open("", O_RDONLY);
}
benchmark_stop();
return (i);
}
uintmax_t uintmax_t
test_read(uintmax_t num, uintmax_t int_arg, const char *path) test_read(uintmax_t num, uintmax_t int_arg, const char *path)
{ {
@ -702,6 +717,7 @@ static const struct test tests[] = {
{ "socket_tcp", test_socket_stream, .t_int = PF_INET }, { "socket_tcp", test_socket_stream, .t_int = PF_INET },
{ "socket_udp", test_socket_dgram, .t_int = PF_INET }, { "socket_udp", test_socket_dgram, .t_int = PF_INET },
{ "create_unlink", test_create_unlink, .t_flags = FLAG_PATH }, { "create_unlink", test_create_unlink, .t_flags = FLAG_PATH },
{ "bad_open", test_bad_open },
{ "open_close", test_open_close, .t_flags = FLAG_PATH }, { "open_close", test_open_close, .t_flags = FLAG_PATH },
{ "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH, { "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH,
.t_int = 1 }, .t_int = 1 },