summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/Makefile.in548
-rwxr-xr-xexamples/count-pkts-per-ip.lua50
-rwxr-xr-xexamples/dumpdns.lua18
-rwxr-xr-xexamples/test_pcap_read.lua149
-rwxr-xr-xexamples/test_throughput.lua539
6 files changed, 564 insertions, 742 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 96361b9..948358b 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -18,4 +18,4 @@
dist_doc_DATA = capture.lua dumpdns2pcap.lua dumpdns.lua dumpdns-qr.lua \
filter_rcode.lua qr-multi-pcap-state.lua readme.lua replay.lua \
- replay_multicli.lua respdiff.lua test_pcap_read.lua test_throughput.lua
+ replay_multicli.lua respdiff.lua
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 0000000..c763907
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,548 @@
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (c) 2018-2021, OARC, Inc.
+# All rights reserved.
+#
+# This file is part of dnsjit.
+#
+# dnsjit is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# dnsjit 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with dnsjit. If not, see <http://www.gnu.org/licenses/>.
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_warn_all.m4 \
+ $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_compiler_vendor.m4 \
+ $(top_srcdir)/m4/ax_ext.m4 \
+ $(top_srcdir)/m4/ax_gcc_x86_avx_xgetbv.m4 \
+ $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
+ $(top_srcdir)/m4/ax_prepend_flag.m4 \
+ $(top_srcdir)/m4/ax_pthread.m4 \
+ $(top_srcdir)/m4/ax_require_defined.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(dist_doc_DATA) \
+ $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(dist_doc_DATA)
+am__extra_recursive_targets = gcov-recursive
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPUEXT_FLAGS = @CPUEXT_FLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LUAJIT = @LUAJIT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIMD_FLAGS = @SIMD_FLAGS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+ck_CFLAGS = @ck_CFLAGS@
+ck_LIBS = @ck_LIBS@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+liblz4_CFLAGS = @liblz4_CFLAGS@
+liblz4_LIBS = @liblz4_LIBS@
+libzstd_CFLAGS = @libzstd_CFLAGS@
+libzstd_LIBS = @libzstd_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+luajit_CFLAGS = @luajit_CFLAGS@
+luajit_LIBS = @luajit_LIBS@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_doc_DATA = capture.lua dumpdns2pcap.lua dumpdns.lua dumpdns-qr.lua \
+ filter_rcode.lua qr-multi-pcap-state.lua readme.lua replay.lua \
+ replay_multicli.lua respdiff.lua
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign examples/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+gcov-local:
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+gcov: gcov-am
+
+gcov-am: gcov-local
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am gcov-am gcov-local html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_docDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am uninstall-dist_docDATA
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/examples/count-pkts-per-ip.lua b/examples/count-pkts-per-ip.lua
deleted file mode 100755
index 9a6908e..0000000
--- a/examples/count-pkts-per-ip.lua
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env dnsjit
--- count-pkts-per-ip.lua: count number of packets received from each IP/IPv6 address
-
-local input = require("dnsjit.input.pcap").new()
-local layer = require("dnsjit.filter.layer").new()
-local object = require("dnsjit.core.objects")
-local ip = require("dnsjit.lib.ip")
-local trie = require("dnsjit.lib.trie").new("uint64_t", true)
-local getopt = require("dnsjit.lib.getopt").new({})
-
-local pcap = unpack(getopt:parse())
-if pcap == nil then
- print("usage: "..arg[1].." <pcap>")
-end
-
--- Set up input
-input:open_offline(pcap)
-layer:producer(input)
-local produce, pctx = layer:produce()
-
--- Read input and count packets
-while true do
- local obj = produce(pctx)
- if obj == nil then break end
- local pkt = obj:cast_to(object.IP) or obj:cast_to(object.IP6)
-
- if pkt ~= nil then
- local iplen = 4
- if pkt:type() == "ip6" then
- iplen = 16
- end
-
- local node = trie:get_ins(pkt.src, iplen)
- node:set(node:get() + 1)
- end
-end
-
--- Print statistics
-local iter = trie:iter()
-local node = iter:node()
-
-while node ~= nil do
- local npkts = tonumber(node:get())
- local key = node:key()
- local ipstr = ip.tostring(key, true)
-
- print(ipstr.." sent "..npkts.." packets")
- iter:next()
- node = iter:node()
-end
diff --git a/examples/dumpdns.lua b/examples/dumpdns.lua
index 7c6fb8c..3b90034 100755
--- a/examples/dumpdns.lua
+++ b/examples/dumpdns.lua
@@ -1,18 +1,30 @@
#!/usr/bin/env dnsjit
local pcap = arg[2]
+local compression = arg[3]
if pcap == nil then
- print("usage: "..arg[1].." <pcap>")
+ print("usage: "..arg[1].." <pcap> [compression]")
return
end
local object = require("dnsjit.core.objects")
local input = require("dnsjit.input.pcap").new()
+local zinput = require("dnsjit.input.zpcap").new()
local layer = require("dnsjit.filter.layer").new()
local dns = require("dnsjit.core.object.dns").new()
-input:open_offline(pcap)
-layer:producer(input)
+if string.lower(string.sub(pcap, -4)) == ".zst" or compression == "zstd" then
+ zinput:zstd()
+ zinput:open(pcap)
+ layer:producer(zinput)
+elseif string.lower(string.sub(pcap, -4)) == ".lz4" or compression == "lz4" then
+ zinput:lz4()
+ zinput:open(pcap)
+ layer:producer(zinput)
+else
+ input:open_offline(pcap)
+ layer:producer(input)
+end
local producer, ctx = layer:produce()
while true do
diff --git a/examples/test_pcap_read.lua b/examples/test_pcap_read.lua
deleted file mode 100755
index 7d29c7a..0000000
--- a/examples/test_pcap_read.lua
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/env dnsjit
-local clock = require("dnsjit.lib.clock")
-local log = require("dnsjit.core.log")
-local getopt = require("dnsjit.lib.getopt").new({
- { "v", "verbose", 0, "Enable and increase verbosity for each time given", "?+" },
- { "l", "layer", false, "Test also with dnsjit.filter.layer", "?" },
- { "p", "producer", false, "Test with the producer interface rather then receiver interface", "?" },
-})
-local pcap, runs = unpack(getopt:parse())
-if getopt:val("help") then
- getopt:usage()
- return
-end
-local v = getopt:val("v")
-if v > 0 then
- log.enable("warning")
-end
-if v > 1 then
- log.enable("notice")
-end
-if v > 2 then
- log.enable("info")
-end
-if v > 3 then
- log.enable("debug")
-end
-
-if pcap == nil then
- print("usage: "..arg[1].." <pcap> [runs]")
- return
-end
-
-inputs = { "fpcap", "mmpcap", "pcap" }
-result = {}
-results = {}
-highest = nil
-
-if runs == nil then
- runs = 10
-else
- runs = tonumber(runs)
-end
-
-if getopt:val("p") then
- for _, name in pairs(inputs) do
- rt = 0.0
- p = 0
-
- print("run", name)
- for n = 1, runs do
- o = require("dnsjit.output.null").new()
- i = require("dnsjit.input."..name).new()
-
- if name == "pcap" then
- i:open_offline(pcap)
- else
- i:open(pcap)
- end
-
- if getopt:val("l") then
- f = require("dnsjit.filter.layer").new()
- f:producer(i)
- o:producer(f)
- else
- o:producer(i)
- end
-
- ss, sns = clock:monotonic()
- o:run()
- es, ens = clock:monotonic()
-
- if es > ss then
- rt = rt + ((es - ss) - 1) + ((1000000000 - sns + ens)/1000000000)
- elseif es == ss and ens > sns then
- rt = rt + (ens - sns) / 1000000000
- end
-
- p = p + o:packets()
- end
-
- result[name] = {
- rt = rt,
- p = p
- }
- if highest == nil or rt > result[highest].rt then
- highest = name
- end
- table.insert(results, name)
- end
-else
- for _, name in pairs(inputs) do
- rt = 0.0
- p = 0
-
- print("run", name)
- for n = 1, runs do
- o = require("dnsjit.output.null").new()
- i = require("dnsjit.input."..name).new()
-
- if name == "pcap" then
- i:open_offline(pcap)
- else
- i:open(pcap)
- end
-
- if getopt:val("l") then
- f = require("dnsjit.filter.layer").new()
- f:receiver(o)
- i:receiver(f)
- else
- i:receiver(o)
- end
-
- ss, sns = clock:monotonic()
- if name == "pcap" then
- i:dispatch()
- else
- i:run()
- end
- es, ens = clock:monotonic()
-
- if es > ss then
- rt = rt + ((es - ss) - 1) + ((1000000000 - sns + ens)/1000000000)
- elseif es == ss and ens > sns then
- rt = rt + (ens - sns) / 1000000000
- end
-
- p = p + o:packets()
- end
-
- result[name] = {
- rt = rt,
- p = p
- }
- if highest == nil or rt > result[highest].rt then
- highest = name
- end
- table.insert(results, name)
- end
-end
-
-print("name", "runtime", "pps", "x", "pkts")
-print(highest, result[highest].rt, result[highest].p/result[highest].rt, 1.0, result[highest].p)
-for _, name in pairs(results) do
- if name ~= highest then
- local f = result[name].p / result[highest].p
- print(name, result[name].rt, result[name].p/result[name].rt, (result[highest].rt/result[name].rt)*f, result[name].p)
- end
-end
diff --git a/examples/test_throughput.lua b/examples/test_throughput.lua
deleted file mode 100755
index b936c41..0000000
--- a/examples/test_throughput.lua
+++ /dev/null
@@ -1,539 +0,0 @@
-#!/usr/bin/env dnsjit
-local ffi = require("ffi")
-local object = require("dnsjit.core.objects")
-local clock = require("dnsjit.lib.clock")
-local log = require("dnsjit.core.log")
-local getopt = require("dnsjit.lib.getopt").new({
- { "v", "verbose", 0, "Enable and increase verbosity for each time given", "?+" },
- { "s", "split", false, "Test also with dnsjit.filter.split", "?" },
- { "t", "thread", false, "Test also with dnsjit.core.thread using dnsjit.core.channel", "?" },
-})
-local num, runs = unpack(getopt:parse())
-if getopt:val("help") then
- getopt:usage()
- return
-end
-local v = getopt:val("v")
-if v > 0 then
- log.enable("warning")
-end
-if v > 1 then
- log.enable("notice")
-end
-if v > 2 then
- log.enable("info")
-end
-if v > 3 then
- log.enable("debug")
-end
-
-if num == nil then
- print("usage: "..arg[1].." <num> [runs]")
- return
-else
- num = tonumber(num)
-end
-
-if runs == nil then
- runs = 1
-else
- runs = tonumber(runs)
-end
-
-print("zero:receiver() -> null:receive()")
-local run
-for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local o = require("dnsjit.output.null").new()
-
- i:receiver(o)
- local start_sec, start_nsec = clock:monotonic()
- i:run(num)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o:packets())
-end
-
-print("lua -> null:receive()")
-local run
-for run = 1, runs do
- local o = require("dnsjit.output.null").new()
- local recv, rctx = o:receive()
- local pkt = ffi.new("core_object_null_t")
- pkt.obj_type = object.NULL
- local obj = ffi.cast("core_object_t*", pkt)
-
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num do
- recv(rctx, obj)
- end
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o:packets())
-end
-
--- TODO: use core.thread
-
-print("zero:produce() <- null:producer()")
-local run
-for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local o = require("dnsjit.output.null").new()
-
- local start_sec, start_nsec = clock:monotonic()
- o:producer(i)
- o:run(num)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o:packets())
-end
-
-print("zero:produce() <- lua")
-local run
-for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local prod, pctx = i:produce()
-
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num do
- prod(pctx)
- end
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", num)
-end
-
-print("zero:produce() <- lua -> null:receive()")
-local run
-for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local o = require("dnsjit.output.null").new()
- local prod, pctx = i:produce()
- local recv, rctx = o:receive()
-
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num do
- recv(rctx, prod(pctx))
- end
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", num)
-end
-
-if getopt:val("s") then
- print("zero:receiver() -> split:receiver() -> null:receive() x1")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local s = require("dnsjit.filter.split").new()
- local o1 = require("dnsjit.output.null").new()
-
- s:receiver(o1)
- i:receiver(s)
- local start_sec, start_nsec = clock:monotonic()
- i:run(num)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o1:packets(), o1:packets())
- end
-
- print("zero:receiver() -> split:receiver() -> null:receive() x2")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local s = require("dnsjit.filter.split").new()
- local o1 = require("dnsjit.output.null").new()
- local o2 = require("dnsjit.output.null").new()
-
- s:receiver(o1)
- s:receiver(o2)
- i:receiver(s)
- local start_sec, start_nsec = clock:monotonic()
- i:run(num)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o1:packets() + o2:packets(), o1:packets(), o2:packets())
- end
-
- print("zero:receiver() -> split:receiver() -> null:receive() x4")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local s = require("dnsjit.filter.split").new()
- local o1 = require("dnsjit.output.null").new()
- local o2 = require("dnsjit.output.null").new()
- local o3 = require("dnsjit.output.null").new()
- local o4 = require("dnsjit.output.null").new()
-
- s:receiver(o1)
- s:receiver(o2)
- s:receiver(o3)
- s:receiver(o4)
- i:receiver(s)
- local start_sec, start_nsec = clock:monotonic()
- i:run(num)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o1:packets() + o2:packets() + o3:packets() + o4:packets(), o1:packets(), o2:packets(), o3:packets(), o4:packets())
- end
-
- print("zero:receiver() -> lua split table -> null:receive() x4")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local o1 = require("dnsjit.output.null").new()
- local o2 = require("dnsjit.output.null").new()
- local o3 = require("dnsjit.output.null").new()
- local o4 = require("dnsjit.output.null").new()
-
- local prod, pctx = i:produce()
- local recv, rctx = {}, {}
-
- local f, c = o1:receive()
- table.insert(recv, f)
- table.insert(rctx, c)
- f, c = o2:receive()
- table.insert(recv, f)
- table.insert(rctx, c)
- f, c = o3:receive()
- table.insert(recv, f)
- table.insert(rctx, c)
- f, c = o4:receive()
- table.insert(recv, f)
- table.insert(rctx, c)
-
- local start_sec, start_nsec = clock:monotonic()
- local idx = 1
- for n = 1, num do
- local f, c = recv[idx], rctx[idx]
- if not f then
- idx = 1
- f, c = recv[1], rctx[1]
- end
- f(c, prod(pctx))
- idx = idx + 1
- end
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o1:packets() + o2:packets() + o3:packets() + o4:packets(), o1:packets(), o2:packets(), o3:packets(), o4:packets())
- end
-
- print("zero:receiver() -> lua split gen code -> null:receive() x4")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local o1 = require("dnsjit.output.null").new()
- local o2 = require("dnsjit.output.null").new()
- local o3 = require("dnsjit.output.null").new()
- local o4 = require("dnsjit.output.null").new()
-
- local prod, pctx = i:produce()
- local f1, c1 = o1:receive()
- local f2, c2 = o2:receive()
- local f3, c3 = o3:receive()
- local f4, c4 = o4:receive()
-
- local code = "return function (num, prod, pctx, f1, c1, f2, c2, f3, c3, f4, c4)\nlocal n = 0\nwhile n < num do\n"
- code = code .. "f1(c1,prod(pctx))\n"
- code = code .. "n = n + 1\n"
- code = code .. "f2(c2,prod(pctx))\n"
- code = code .. "n = n + 1\n"
- code = code .. "f3(c3,prod(pctx))\n"
- code = code .. "n = n + 1\n"
- code = code .. "f4(c4,prod(pctx))\n"
- code = code .. "n = n + 1\n"
- code = code .. "end\n"
- code = code .. "end"
- local f = assert(loadstring(code))()
-
- local start_sec, start_nsec = clock:monotonic()
- f(num, prod, pctx, f1, c1, f2, c2, f3, c3, f4, c4)
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec", o1:packets() + o2:packets() + o3:packets() + o4:packets(), o1:packets(), o2:packets(), o3:packets(), o4:packets())
- end
-end
-
-if getopt:val("t") then
- print("zero:receiver() -> thread lua x1")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local c = require("dnsjit.core.channel").new()
- local t = require("dnsjit.core.thread").new()
-
- t:start(function(t)
- local c = t:pop()
-
- while true do
- local o = c:get()
- if o == nil then break end
- end
- end)
- t:push(c)
-
- local prod, pctx = i:produce()
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num do
- c:put(prod(pctx))
- end
- c:close()
- t:stop()
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec")
- end
-
- print("zero:receiver() -> thread lua x2")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local c = require("dnsjit.core.channel").new()
- local c2 = require("dnsjit.core.channel").new()
- local t = require("dnsjit.core.thread").new()
- local t2 = require("dnsjit.core.thread").new()
-
- local f = function(t)
- local c = t:pop()
-
- while true do
- local o = c:get()
- if o == nil then break end
- end
- end
-
- t:start(f)
- t2:start(f)
- t:push(c)
- t2:push(c2)
-
- local prod, pctx = i:produce()
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num/2 do
- c:put(prod(pctx))
- c2:put(prod(pctx))
- end
- c:close()
- c2:close()
- t:stop()
- t2:stop()
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec")
- end
-
- print("zero:receiver() -> thread lua x4")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local c = require("dnsjit.core.channel").new()
- local c2 = require("dnsjit.core.channel").new()
- local c3 = require("dnsjit.core.channel").new()
- local c4 = require("dnsjit.core.channel").new()
- local t = require("dnsjit.core.thread").new()
- local t2 = require("dnsjit.core.thread").new()
- local t3 = require("dnsjit.core.thread").new()
- local t4 = require("dnsjit.core.thread").new()
-
- local f = function(t)
- local c = t:pop()
-
- while true do
- local o = c:get()
- if o == nil then break end
- end
- end
-
- t:start(f)
- t2:start(f)
- t3:start(f)
- t4:start(f)
- t:push(c)
- t2:push(c2)
- t3:push(c3)
- t4:push(c4)
-
- local prod, pctx = i:produce()
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num/4 do
- c:put(prod(pctx))
- c2:put(prod(pctx))
- c3:put(prod(pctx))
- c4:put(prod(pctx))
- end
- c:close()
- c2:close()
- c3:close()
- c4:close()
- t:stop()
- t2:stop()
- t3:stop()
- t4:stop()
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec")
- end
-
- print("zero:receiver() -> thread lua x1 -> null:receiver()")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local c = require("dnsjit.core.channel").new()
- local t = require("dnsjit.core.thread").new()
-
- t:start(function(t)
- local c = t:pop()
- local o = require("dnsjit.output.null").new()
-
- local recv, rctx = o:receive()
- while true do
- local obj = c:get()
- if obj == nil then break end
- recv(rctx, obj)
- end
- end)
- t:push(c)
-
- local prod, pctx = i:produce()
- local start_sec, start_nsec = clock:monotonic()
- for n = 1, num do
- c:put(prod(pctx))
- end
- c:close()
- t:stop()
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec")
- end
-
- print("zero:receiver() -> thread x1 -> null:receiver()")
- local run
- for run = 1, runs do
- local i = require("dnsjit.input.zero").new()
- local c = require("dnsjit.core.channel").new()
- local t = require("dnsjit.core.thread").new()
-
- t:start(function(t)
- local c = t:pop()
- local o = require("dnsjit.output.null").new()
-
- c:receiver(o)
- c:run()
- end)
- t:push(c)
-
- i:receiver(c)
- local start_sec, start_nsec = clock:monotonic()
- i:run(num)
- c:close()
- t:stop()
- local end_sec, end_nsec = clock:monotonic()
-
- local runtime = 0
- if end_sec > start_sec then
- runtime = ((end_sec - start_sec) - 1) + ((1000000000 - start_nsec + end_nsec)/1000000000)
- elseif end_sec == start_sec and end_nsec > start_nsec then
- runtime = (end_nsec - start_nsec) / 1000000000
- end
-
- print(run, "runtime", runtime, num/runtime, "/sec")
- end
-end