Change-Id: I9863b4e97238dcc6759f21d9685aa101dae75fa1pull/1759/head
| @ -0,0 +1 @@ | |||||
| fixtures/* /usr/share/rtpengine-perftest/ | |||||
| @ -0,0 +1 @@ | |||||
| usr/bin/rtpengine-perftest | |||||
| @ -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") | |||||