MT#56374 add perf-tester

Change-Id: I9863b4e97238dcc6759f21d9685aa101dae75fa1
pull/1759/head
Richard Fuchs 2 years ago
parent 4cbc35e0f2
commit e5cb0018eb

@ -22,6 +22,7 @@ all:
$(MAKE) -C daemon
ifeq ($(with_transcoding),yes)
$(MAKE) -C recording-daemon
$(MAKE) -C perf-tester
endif
$(MAKE) -C iptables-extension
@ -29,6 +30,7 @@ install:
$(MAKE) -C daemon install
ifeq ($(with_transcoding),yes)
$(MAKE) -C recording-daemon install
$(MAKE) -C perf-tester install
endif
$(MAKE) -C iptables-extension install
mkdir -p $(DESTDIR)/usr/libexec/rtpengine/ $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/man/man1
@ -40,6 +42,7 @@ coverity:
$(MAKE) -C daemon
ifeq ($(with_transcoding),yes)
$(MAKE) -C recording-daemon
$(MAKE) -C perf-tester
endif
.PHONY: with-kernel
@ -53,6 +56,7 @@ install-with-kernel: all install
distclean clean:
$(MAKE) -C daemon clean
$(MAKE) -C recording-daemon clean
$(MAKE) -C perf-tester clean
$(MAKE) -C iptables-extension clean
$(MAKE) -C kernel-module clean
$(MAKE) -C t clean
@ -60,6 +64,7 @@ distclean clean:
.DEFAULT:
$(MAKE) -C daemon $@
$(MAKE) -C recording-daemon $@
$(MAKE) -C perf-tester
$(MAKE) -C iptables-extension $@
$(MAKE) -C kernel-module $@

28
debian/control vendored

@ -30,6 +30,7 @@ Build-Depends:
libjson-glib-dev,
libjson-perl,
libmosquitto-dev,
libncurses-dev,
libnet-interface-perl,
libopus-dev,
libpcap0.8-dev,
@ -54,6 +55,7 @@ Package: ngcp-rtpengine-daemon
Architecture: any
Multi-Arch: foreign
Recommends:
ngcp-rtpengine-perftest,
ngcp-rtpengine-recording-daemon,
ngcp-rtpengine-utils,
Suggests:
@ -103,6 +105,7 @@ Depends:
ngcp-rtpengine-daemon (>= ${source:Version}),
ngcp-rtpengine-iptables (>= ${source:Version}),
ngcp-rtpengine-kernel-dkms (>= ${source:Version}),
ngcp-rtpengine-perftest (>= ${source:Version}),
ngcp-rtpengine-recording-daemon (>= ${source:Version}),
ngcp-rtpengine-utils (>= ${source:Version}),
${misc:Depends},
@ -140,3 +143,28 @@ Depends:
${perl:Depends},
Description: scripts and Perl modules for NGCP rtpengine
This package contains scripts and Perl modules for NGCP rtpengine
Package: ngcp-rtpengine-perftest
Architecture: any
Multi-Arch: foreign
Build-Profiles: <!pkg.ngcp-rtpengine.no-transcoding>
Depends:
ngcp-rtpengine-perftest-data (= ${source:Version}),
${misc:Depends},
${shlibs:Depends},
Description: helper tool to test rtpengine transcoding performance
This interactive tool simulates transcoding scenarios using the rtpengine code
base and produces performance and load statistics.
Package: ngcp-rtpengine-perftest-data
Architecture: all
Multi-Arch: foreign
Build-Profiles: <!pkg.ngcp-rtpengine.no-transcoding>
Depends:
${misc:Depends},
${shlibs:Depends},
Description: helper tool to test rtpengine transcoding performance - data files
This interactive tool simulates transcoding scenarios using the rtpengine code
base and produces performance and load statistics.
.
These are data files needed for the binary package.

@ -0,0 +1 @@
fixtures/* /usr/share/rtpengine-perftest/

@ -0,0 +1 @@
usr/bin/rtpengine-perftest

2
debian/rules vendored

@ -21,6 +21,8 @@ export DEB_CFLAGS_MAINT_SET =
export DEB_LDFLAGS_MAINT_SET =
endif
export FIXTURES_PATH = /usr/share/rtpengine-perftest
%:
dh $@

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -0,0 +1,18 @@
*.8
*.o
rtpengine-perftest
core
core.*
.ycm_extra_conf.pyc
auxlib.c
loglib.c
rtplib.c
codeclib.c
resample.c
str.c
fix_frame_channel_layout.h
mvr2s_x64_avx512.S
mvr2s_x64_avx2.S
dtmflib.c
poller.c
ssllib.c

@ -0,0 +1,109 @@
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-g',
'-Wall',
'-Wstrict-prototypes',
'-Wshadow',
'-pthread',
'-fno-strict-aliasing',
'-I/usr/include/glib-2.0',
'-I/usr/lib/x86_64-linux-gnu/glib-2.0/include',
'-I/usr/include/mysql',
'-I.',
'-I../lib/',
'-pthread',
'-D_GNU_SOURCE',
'-D__DEBUG=1',
'-D__YCM=1',
'-DFIXTURES_PATH="."',
'-O2',
'-fstack-protector',
'--param=ssp-buffer-size=4',
'-Wformat',
'-Werror=format-security',
'-D_FORTIFY_SOURCE=2',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't
# know which language to use when compiling headers. So it will guess.
# Badly. So C++ headers will be compiled as C headers.
# You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c',
]
if compilation_database_folder:
database = ycm_core.CompilationDatabase(compilation_database_folder)
else:
database = None
def DirectoryOfThisScript():
return os.path.dirname(os.path.abspath(__file__))
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
if not working_directory:
return flags
new_flags = []
make_next_absolute = False
path_flags = ['-isystem', '-I', '-iquote', '--sysroot=']
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith('/'):
new_flag = os.path.join(working_directory, flag)
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith(path_flag):
path = flag[len(path_flag):]
new_flag = path_flag + os.path.join(working_directory, path)
break
if new_flag:
new_flags.append(new_flag)
return new_flags
def FlagsForFile(filename):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = database.GetCompilationInfoForFile(filename)
final_flags = PrepareClangFlags(
MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_),
filename)
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
return {
'flags': final_flags,
'do_cache': True
}

@ -0,0 +1,52 @@
TARGET = rtpengine-perftest
FIXTURES_PATH ?= ../fixtures
CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \
-Wshadow
CFLAGS += -pthread
CFLAGS += -std=c11
CFLAGS += -I. -I../kernel-module/ -I../lib/
CFLAGS += -DFIXTURES_PATH="\"$(FIXTURES_PATH)\""
CFLAGS += $(shell pkg-config --cflags glib-2.0)
CFLAGS += $(shell pkg-config --cflags gthread-2.0)
CFLAGS += -D_GNU_SOURCE
CFLAGS += $(shell pkg-config --cflags libavcodec)
CFLAGS += $(shell pkg-config --cflags libavformat)
CFLAGS += $(shell pkg-config --cflags libavutil)
CFLAGS += $(shell pkg-config --cflags libswresample)
CFLAGS += $(shell pkg-config --cflags libavfilter)
CFLAGS += $(shell pkg-config --cflags spandsp)
CFLAGS += $(shell pkg-config --cflags opus)
CFLAGS += $(shell pkg-config --cflags ncursesw)
CFLAGS += -DWITH_TRANSCODING
CFLAGS += $(shell pkg-config --cflags openssl)
LDLIBS = -lm -ldl
LDLIBS += $(shell pkg-config --libs glib-2.0)
LDLIBS += $(shell pkg-config --libs gthread-2.0)
LDLIBS += $(shell pkg-config --libs libavcodec)
LDLIBS += $(shell pkg-config --libs libavformat)
LDLIBS += $(shell pkg-config --libs libavutil)
LDLIBS += $(shell pkg-config --libs libswresample)
LDLIBS += $(shell pkg-config --libs libavfilter)
LDLIBS += $(shell pkg-config --libs spandsp)
LDLIBS += $(shell pkg-config --libs opus)
LDLIBS += $(shell pkg-config --libs ncursesw)
LDLIBS += $(shell pkg-config --libs openssl)
include ../lib/g729.Makefile
SRCS = main.c log.c
LIBSRCS = codeclib.strhash.c loglib.c auxlib.c resample.c str.c dtmflib.c rtplib.c poller.c ssllib.c
LIBASM = mvr2s_x64_avx2.S mvr2s_x64_avx512.S
OBJS = $(SRCS:.c=.o) $(LIBSRCS:.c=.o) $(LIBASM:.S=.o)
include ../lib/common.Makefile
main.o: fix_frame_channel_layout.h
install: $(TARGET)
install -m 0755 -D $(TARGET) $(DESTDIR)/usr/bin/$(TARGET)

@ -0,0 +1,56 @@
#include "log.h"
#include <syslog.h>
#include <stdarg.h>
#include <stdio.h>
#include "loglib.h"
static const uint max_log_lines = 10000;
mutex_t log_lock = MUTEX_STATIC_INIT;
static GQueue log_buffer = G_QUEUE_INIT;
void __ilog(int prio, const char *fmt, ...) {
va_list ap;
GSList *to_free = NULL;
va_start(ap, fmt);
char *line = g_strdup_vprintf(fmt, ap);
{
LOCK(&log_lock);
g_queue_push_tail(&log_buffer, line);
while (log_buffer.length > max_log_lines)
to_free = g_slist_prepend(to_free, g_queue_pop_head(&log_buffer));
}
va_end(ap);
g_slist_free_full(to_free, g_free);
}
GQueue *get_log_lines(uint num, uint end) {
GQueue *ret = g_queue_new();
LOCK(&log_lock);
GList *l = log_buffer.tail;
while (l && end--)
l = l->prev;
for (; l && num; num--, l = l->prev)
g_queue_push_tail(ret, g_strdup(l->data));
return ret;
}
void log_clear(void) {
LOCK(&log_lock);
g_queue_clear_full(&log_buffer, g_free);
}
int get_local_log_level(unsigned int subsystem_idx) {
return -1;
}

@ -0,0 +1,12 @@
#ifndef __LOG_H__
#define __LOG_H__
#include "loglib.h"
void __ilog(int prio, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
GQueue *get_log_lines(uint num, uint end);
void log_clear(void);
#endif

@ -0,0 +1,8 @@
#ifndef __LOG_FUNCS_H__
#define __LOG_FUNCS_H__
#include "compat.h"
INLINE void log_info_reset(void) { }
#endif

@ -0,0 +1,7 @@
ll(core, "Everything that isn't part of another subsystem")
ll(spandsp, "Log messages generated by SpanDSP directly")
ll(ffmpeg, "Log messages generated by ffmpeg directly")
ll(transcoding, "Media and RTP transcoding")
ll(codec, "Codec negotiation")
ll(internals, "Noisy low-level internals")
ll(dtx, "DTX timer/buffer")

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save