From 15271403c57beb483fcaf04a68b463a058f72df6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jan 2024 06:13:02 +0100 Subject: Merging upstream version 2.14.0. Signed-off-by: Daniel Baumann --- src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/buffer.h | 2 +- src/config.h.in | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/datafile.c | 2 +- src/datafile.h | 2 +- src/dns.c | 2 +- src/dns.h | 2 +- src/dnsperf.1.in | 2 +- src/dnsperf.c | 54 +++++++++++++++++----------- src/edns.c | 2 +- src/edns.h | 2 +- src/list.h | 2 +- src/log.c | 2 +- src/log.h | 2 +- src/net.c | 2 +- src/net.h | 2 +- src/net_doh.c | 2 +- src/net_dot.c | 2 +- src/net_tcp.c | 2 +- src/net_udp.c | 2 +- src/opt.c | 2 +- src/opt.h | 2 +- src/os.c | 26 +++++++++++++- src/os.h | 5 ++- src/qtype.c | 2 +- src/qtype.h | 2 +- src/resperf-report | 2 +- src/resperf.1.in | 2 +- src/resperf.c | 16 ++++++--- src/result.h | 2 +- src/strerror.c | 2 +- src/strerror.h | 2 +- src/tsig.c | 2 +- src/tsig.h | 2 +- src/util.h | 2 +- 36 files changed, 208 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 810f99b..46ae754 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# Copyright 2019-2023 OARC, Inc. +# Copyright 2019-2024 OARC, Inc. # Copyright 2017-2018 Akamai Technologies # Copyright 2006-2016 Nominum, Inc. # All rights reserved. diff --git a/src/Makefile.in b/src/Makefile.in index 8b0716a..578444f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright 2019-2023 OARC, Inc. +# Copyright 2019-2024 OARC, Inc. # Copyright 2017-2018 Akamai Technologies # Copyright 2006-2016 Nominum, Inc. # All rights reserved. diff --git a/src/buffer.h b/src/buffer.h index 1cc5962..29e0b69 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/config.h.in b/src/config.h.in index e0341dc..ab63351 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -24,15 +24,27 @@ /* Define to 1 if you have the `nghttp2' library (-lnghttp2). */ #undef HAVE_LIBNGHTTP2 +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + /* Define to 1 if you have the header file. */ #undef HAVE_NGHTTP2_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_NP_H + /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT +/* Define to 1 if you have the `pthread_setname_np' function. */ +#undef HAVE_PTHREAD_SETNAME_NP + +/* Define to 1 if you have the `pthread_set_name_np' function. */ +#undef HAVE_PTHREAD_SET_NAME_NP + /* Define to 1 if you have the header file. */ #undef HAVE_STDATOMIC_H @@ -63,6 +75,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR @@ -96,6 +111,94 @@ backward compatibility; new code need not use it. */ #undef STDC_HEADERS +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + /* Version number of package */ #undef VERSION diff --git a/src/datafile.c b/src/datafile.c index 85e34b8..bc54f95 100644 --- a/src/datafile.c +++ b/src/datafile.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/datafile.h b/src/datafile.h index bebc1e9..c03f07e 100644 --- a/src/datafile.h +++ b/src/datafile.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/dns.c b/src/dns.c index c990d9b..f8e1fb0 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/dns.h b/src/dns.h index 0c0df3c..ba1051a 100644 --- a/src/dns.h +++ b/src/dns.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/dnsperf.1.in b/src/dnsperf.1.in index 6c699fe..5bc1d74 100644 --- a/src/dnsperf.1.in +++ b/src/dnsperf.1.in @@ -1,4 +1,4 @@ -.\" Copyright 2019-2023 OARC, Inc. +.\" Copyright 2019-2024 OARC, Inc. .\" Copyright 2017-2018 Akamai Technologies .\" Copyright 2006-2016 Nominum, Inc. .\" All rights reserved. diff --git a/src/dnsperf.c b/src/dnsperf.c index f124f64..0697be3 100644 --- a/src/dnsperf.c +++ b/src/dnsperf.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. @@ -86,7 +86,7 @@ typedef struct { uint32_t bufsize; bool edns; bool dnssec; - perf_tsigkey_t* tsigkey; + const char* tsigkey; perf_ednsoption_t* edns_option; uint32_t max_outstanding; uint32_t max_qps; @@ -129,7 +129,7 @@ typedef struct { uint64_t latency_min; uint64_t latency_max; - uint64_t num_conn_reconnect; + uint64_t num_conn_attempts; uint64_t num_conn_completed; uint64_t conn_latency_sum; @@ -294,7 +294,7 @@ diff_stats(const config_t* config, stats_t* last, stats_t* now, stats_t* diff) diff->latency_min = 0; /* not enough data */ diff->latency_max = 0; - diff->num_conn_reconnect = now->num_conn_reconnect - last->num_conn_reconnect; + diff->num_conn_attempts = now->num_conn_attempts - last->num_conn_attempts; diff->num_conn_completed = now->num_conn_completed - last->num_conn_completed; diff->conn_latency_sum = now->conn_latency_sum - last->conn_latency_sum; @@ -438,16 +438,16 @@ print_statistics(const config_t* config, const times_t* times, stats_t* stats, u printf("\n"); - if (!stats->num_conn_completed && !stats->num_conn_reconnect) { + if (!stats->num_conn_completed && !stats->num_conn_attempts) { fflush(stdout); return; } printf("Connection Statistics:\n\n"); - printf(" Reconnections: %" PRIu64 " (%.2lf%% of %" PRIu64 " connections)\n\n", - stats->num_conn_reconnect, - PERF_SAFE_DIV(100.0 * stats->num_conn_reconnect, stats->num_conn_completed), - stats->num_conn_completed); + printf(" Connection attempts: %" PRIu64 " (%" PRIu64 " successful, %.2lf%%)\n\n", + stats->num_conn_attempts, + stats->num_conn_completed, + PERF_SAFE_DIV(100.0 * stats->num_conn_completed, stats->num_conn_attempts)); latency_avg = PERF_SAFE_DIV(stats->conn_latency_sum, stats->num_conn_completed); printf(" Average Latency (s): %u.%06u", (unsigned int)(latency_avg / MILLION), @@ -518,7 +518,7 @@ sum_stats(const config_t* config, stats_t* total) total->latency_max = stats->latency_max; total->num_conn_completed += stats->num_conn_completed; - total->num_conn_reconnect += stats->num_conn_reconnect; + total->num_conn_attempts += stats->num_conn_attempts; total->conn_latency_sum += stats->conn_latency_sum; total->conn_latency_sum_squares += stats->conn_latency_sum_squares; @@ -582,7 +582,6 @@ setup(int argc, char** argv, config_t* config) in_port_t local_port = DEFAULT_LOCAL_PORT; const char* filename = NULL; const char* edns_option = NULL; - const char* tsigkey = NULL; const char* mode = 0; const char* doh_uri = DEFAULT_DOH_URI; const char* doh_method = DEFAULT_DOH_METHOD; @@ -646,7 +645,7 @@ setup(int argc, char** argv, config_t* config) &config->dnssec); perf_opt_add('y', perf_opt_string, "[alg:]name:secret", "the TSIG algorithm, name and secret (base64)", NULL, - &tsigkey); + &config->tsigkey); perf_opt_add('q', perf_opt_uint, "num_queries", "the maximum number of queries outstanding", stringify(DEFAULT_MAX_OUTSTANDING), @@ -753,8 +752,11 @@ setup(int argc, char** argv, config_t* config) if (config->dnssec || edns_option != NULL) config->edns = true; - if (tsigkey != NULL) - config->tsigkey = perf_tsig_parsekey(tsigkey); + if (config->tsigkey) { + // check TSIG key to die earlier than in threads + perf_tsigkey_t* k = perf_tsig_parsekey(config->tsigkey); + perf_tsig_destroykey(&k); + } if (edns_option != NULL) config->edns_option = perf_edns_parseoption(edns_option); @@ -802,8 +804,6 @@ cleanup(config_t* config) close(mainpipe[i]); close(intrpipe[i]); } - if (config->tsigkey != NULL) - perf_tsig_destroykey(&config->tsigkey); if (config->edns_option != NULL) perf_edns_destroyoption(&config->edns_option); } @@ -909,6 +909,7 @@ do_send(void* arg) perf_result_t result; bool all_fail; unsigned char socketbits[(MAX_SOCKETS / 8) + 1] = {}; + perf_tsigkey_t* tsigkey = 0; tinfo = (threadinfo_t*)arg; config = tinfo->config; @@ -917,6 +918,9 @@ do_send(void* arg) max_packet_size = config->edns ? MAX_EDNS_PACKET : MAX_UDP_PACKET; perf_buffer_init(&msg, packet_buffer, max_packet_size); perf_buffer_init(&lines, input_data, sizeof(input_data)); + if (config->tsigkey) { + tsigkey = perf_tsig_parsekey(config->tsigkey); + } if (tinfo->max_qps > 0) { q_step = MILLION / tinfo->max_qps; @@ -1072,7 +1076,7 @@ do_send(void* arg) perf_buffer_usedregion(&lines, &used); result = perf_dns_buildrequest(&used, qid, config->edns, config->dnssec, config->input_format == input_format_text_update, - config->tsigkey, config->edns_option, + tsigkey, config->edns_option, &msg); break; @@ -1156,6 +1160,10 @@ do_send(void* arg) tinfo->done_sending = true; if (write(mainpipe[1], "", 1)) { // lgtm [cpp/empty-block] } + + if (tsigkey) { + perf_tsig_destroykey(&tsigkey); + } return NULL; } @@ -1502,7 +1510,8 @@ static void perf__net_event(struct perf_net_socket* sock, perf_socket_event_t ev break; case perf_socket_event_reconnecting: - stats->num_conn_reconnect++; + case perf_socket_event_connecting: + stats->num_conn_attempts++; break; default: @@ -1512,7 +1521,7 @@ static void perf__net_event(struct perf_net_socket* sock, perf_socket_event_t ev static void threadinfo_init(threadinfo_t* tinfo, const config_t* config, - const times_t* times) + const times_t* times, int idx) { unsigned int offset, socket_offset, i; @@ -1581,8 +1590,13 @@ threadinfo_init(threadinfo_t* tinfo, const config_t* config, } tinfo->current_sock = 0; + char name[16]; // glibc is limited to 16 characters PERF_THREAD(&tinfo->receiver, do_recv, tinfo); + snprintf(name, sizeof(name), "perf-recv-%04d", idx); + perf_os_thread_setname(tinfo->receiver, name); PERF_THREAD(&tinfo->sender, do_send, tinfo); + snprintf(name, sizeof(name), "perf-send-%04d", idx); + perf_os_thread_setname(tinfo->sender, name); } static void @@ -1652,7 +1666,7 @@ int main(int argc, char** argv) perf_log_fatal("out of memory"); } for (i = 0; i < config.threads; i++) - threadinfo_init(&threads[i], &config, ×); + threadinfo_init(&threads[i], &config, ×, i); if (config.stats_interval > 0) { stats_thread.config = &config; stats_thread.times = × diff --git a/src/edns.c b/src/edns.c index d3a0608..239f091 100644 --- a/src/edns.c +++ b/src/edns.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/edns.h b/src/edns.h index bcd6822..3d0c033 100644 --- a/src/edns.h +++ b/src/edns.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/list.h b/src/list.h index 47064fb..25770da 100644 --- a/src/list.h +++ b/src/list.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/log.c b/src/log.c index 661e373..6bc7307 100644 --- a/src/log.c +++ b/src/log.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/log.h b/src/log.h index 040a29a..f22aa67 100644 --- a/src/log.h +++ b/src/log.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net.c b/src/net.c index bb29661..3c438db 100644 --- a/src/net.c +++ b/src/net.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net.h b/src/net.h index 25b9251..608e6fa 100644 --- a/src/net.h +++ b/src/net.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net_doh.c b/src/net_doh.c index 56fd7ef..d2c0af6 100644 --- a/src/net_doh.c +++ b/src/net_doh.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net_dot.c b/src/net_dot.c index c2985a3..ee2ae7b 100644 --- a/src/net_dot.c +++ b/src/net_dot.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net_tcp.c b/src/net_tcp.c index fe3317b..69e7768 100644 --- a/src/net_tcp.c +++ b/src/net_tcp.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/net_udp.c b/src/net_udp.c index 2efc384..896b234 100644 --- a/src/net_udp.c +++ b/src/net_udp.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/opt.c b/src/opt.c index cd312ad..361034e 100644 --- a/src/opt.c +++ b/src/opt.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/opt.h b/src/opt.h index 82a15a2..ffd8d7b 100644 --- a/src/opt.h +++ b/src/opt.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/os.c b/src/os.c index a36cbed..d16d3b3 100644 --- a/src/os.c +++ b/src/os.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. @@ -32,6 +32,10 @@ #include #include +#if defined(HAVE_PTHREAD_NP_H) +#include +#endif /* if defined(HAVE_PTHREAD_NP_H) */ + void perf_os_blocksignal(int sig, bool block) { sigset_t sset; @@ -149,3 +153,23 @@ perf_os_waituntilanywritable(struct perf_net_socket** socks, unsigned int nfds, return (PERF_R_SUCCESS); } } + +void perf_os_thread_setname(pthread_t thread, const char* name) +{ +#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__APPLE__) + /* + * macOS has pthread_setname_np but only works on the + * current thread so it's not used here + */ +#if defined(__NetBSD__) + (void)pthread_setname_np(thread, name, NULL); +#else /* if defined(__NetBSD__) */ + (void)pthread_setname_np(thread, name); +#endif /* if defined(__NetBSD__) */ +#elif defined(HAVE_PTHREAD_SET_NAME_NP) + (void)pthread_set_name_np(thread, name); +#else /* if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__APPLE__) */ + (void)(thread); + (void)(name); +#endif /* if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__APPLE__) */ +} diff --git a/src/os.h b/src/os.h index 0d9e8c5..e6144c2 100644 --- a/src/os.h +++ b/src/os.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. @@ -25,6 +25,7 @@ #include #include +#include void perf_os_blocksignal(int sig, bool block); @@ -41,4 +42,6 @@ perf_result_t perf_os_waituntilanywritable(struct perf_net_socket** socks, unsigned int nfds, int pipe_fd, int64_t timeout); +void perf_os_thread_setname(pthread_t thread, const char* name); + #endif diff --git a/src/qtype.c b/src/qtype.c index bce24f3..3d80ada 100644 --- a/src/qtype.c +++ b/src/qtype.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/qtype.h b/src/qtype.h index d136870..80aef38 100644 --- a/src/qtype.h +++ b/src/qtype.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/resperf-report b/src/resperf-report index 7c1431d..af9458f 100755 --- a/src/resperf-report +++ b/src/resperf-report @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2019-2023 OARC, Inc. +# Copyright 2019-2024 OARC, Inc. # Copyright 2017-2018 Akamai Technologies # Copyright 2006-2016 Nominum, Inc. # All rights reserved. diff --git a/src/resperf.1.in b/src/resperf.1.in index 1c31b35..5b5f6e3 100644 --- a/src/resperf.1.in +++ b/src/resperf.1.in @@ -1,4 +1,4 @@ -.\" Copyright 2019-2023 OARC, Inc. +.\" Copyright 2019-2024 OARC, Inc. .\" Copyright 2017-2018 Akamai Technologies .\" Copyright 2006-2016 Nominum, Inc. .\" All rights reserved. diff --git a/src/resperf.c b/src/resperf.c index d11e232..f32a177 100644 --- a/src/resperf.c +++ b/src/resperf.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. @@ -149,7 +149,8 @@ static uint64_t num_queries_outstanding; static uint64_t num_responses_received; static uint64_t num_queries_timed_out; static uint64_t rcodecounts[16]; -static uint64_t num_reconnections; +static uint64_t num_conn_completed; +static uint64_t num_conn_attempts; static uint64_t time_now; static uint64_t time_of_program_start; @@ -489,10 +490,12 @@ static void perf__net_event(struct perf_net_socket* sock, perf_socket_event_t ev case perf_socket_event_connected: b->connections++; b->conn_latency_sum += elapsed_time / (double)MILLION; + num_conn_completed++; break; case perf_socket_event_reconnecting: - num_reconnections++; + case perf_socket_event_connecting: + num_conn_attempts++; break; default: @@ -545,8 +548,7 @@ print_statistics(void) perf_dns_rcode_strings[i], rcodecounts[i], (rcodecounts[i] * 100.0) / num_responses_received); } - printf("\n"); - printf(" Reconnection(s): %" PRIu64 "\n", num_reconnections); + printf("\n\n"); printf(" Run time (s): %u.%06u\n", (unsigned int)(run_time / MILLION), (unsigned int)(run_time % MILLION)); @@ -569,6 +571,10 @@ print_statistics(void) printf(" Maximum throughput: %.6lf qps\n", max_throughput); printf(" Lost at that point: %.2f%%\n", loss_at_max_throughput); printf("\n"); + printf(" Connection attempts: %" PRIu64 " (%" PRIu64 " successful, %.2lf%%)\n\n", + num_conn_attempts, + num_conn_completed, + PERF_SAFE_DIV(100.0 * num_conn_completed, num_conn_attempts)); } /* diff --git a/src/result.h b/src/result.h index b50716b..32b0608 100644 --- a/src/result.h +++ b/src/result.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/strerror.c b/src/strerror.c index d870cb1..8ecbd44 100644 --- a/src/strerror.c +++ b/src/strerror.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/strerror.h b/src/strerror.h index 312b148..dd17bb6 100644 --- a/src/strerror.h +++ b/src/strerror.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/tsig.c b/src/tsig.c index 9f48c63..cb2eb16 100644 --- a/src/tsig.c +++ b/src/tsig.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/tsig.h b/src/tsig.h index 8ec108e..8c74805 100644 --- a/src/tsig.h +++ b/src/tsig.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. diff --git a/src/util.h b/src/util.h index ae821b0..7b54e5b 100644 --- a/src/util.h +++ b/src/util.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 OARC, Inc. + * Copyright 2019-2024 OARC, Inc. * Copyright 2017-2018 Akamai Technologies * Copyright 2006-2016 Nominum, Inc. * All rights reserved. -- cgit v1.2.3