You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
srs/trunk/3rdparty/st-srs
winlin 1ee77614fb Refine comments 4 years ago
..
.circleci Merge ST, support utest and coverage by gtest. 4 years ago
auto Merge ST, support utest and coverage by gtest. 4 years ago
docs For #1537, #1282, use ST source code in SRS 5 years ago
examples For #1537, #1282, use ST source code in SRS 5 years ago
extensions For #1537, #1282, use ST source code in SRS 5 years ago
utest Merge ST, support utest and coverage by gtest. 4 years ago
.gitignore Merge ST, support utest and coverage by gtest. 4 years ago
Makefile Merge ST, support utest and coverage by gtest. 4 years ago
README For #1537, #1282, use ST source code in SRS 5 years ago
README.md Merge ST, support utest and coverage by gtest. 4 years ago
common.h Clock: Update stat. Insert timer to execute first 4 years ago
event.c Support to disable stats by default 4 years ago
io.c Refine comments 4 years ago
key.c For #1537, #1282, use ST source code in SRS 5 years ago
libst.def For #1537, #1282, use ST source code in SRS 5 years ago
md.S For #1537, #1282, use new algorithm for arm. 5 years ago
md.h Support macOS OSX 5 years ago
md_darwin.S Support macOS OSX 5 years ago
osguess.sh For #1537, #1282, use ST source code in SRS 5 years ago
public.h Merge ST, support utest and coverage by gtest. 4 years ago
sched.c Support to disable stats by default 4 years ago
st.pc.in For #1537, #1282, use ST source code in SRS 5 years ago
st.spec For #1537, #1282, use ST source code in SRS 5 years ago
stk.c For #1537, #1282, use ST source code in SRS 5 years ago
sync.c For #1537, #1282, use ST source code in SRS 5 years ago

README.md

state-threads

Fork from http://sourceforge.net/projects/state-threads, patched for SRS.

See: https://github.com/ossrs/state-threads/blob/srs/README

For original ST without any changes, checkout the ST master branch.

Usage

Get code:

git clone https://github.com/ossrs/state-threads.git &&
cd state-threads && git checkout srs

For Linux:

make linux-debug EXTRA_CFLAGS="-DMD_HAVE_EPOLL"

For OSX:

make darwin-debug EXTRA_CFLAGS="-DMD_HAVE_KQUEUE"

Linux with valgrind:

make linux-debug EXTRA_CFLAGS="-DMD_VALGRIND"

Remark: User must install valgrind, for instance, in centos6 sudo yum install -y valgrind valgrind-devel.

Linux with valgrind and epoll:

make linux-debug EXTRA_CFLAGS="-DMD_HAVE_EPOLL -DMD_VALGRIND"

For OSX, user must specifies the valgrind header files:

make darwin-debug EXTRA_CFLAGS="-DMD_HAVE_KQUEUE -DMD_VALGRIND -I/usr/local/include"

Remark: Latest OSX does not support ST, please use docker to run ST.

Branch SRS

The branch srs will be patched the following patches:

GDB Tools

Valgrind

How to debug with gdb under valgrind, read valgrind manual.

About startup parameters, read valgrind cli.

Important cli options:

  1. --undef-value-errors=<yes|no> [default: yes], Controls whether Memcheck reports uses of undefined value errors. Set this to no if you don't want to see undefined value errors. It also has the side effect of speeding up Memcheck somewhat.
  2. --leak-check=<no|summary|yes|full> [default: summary], When enabled, search for memory leaks when the client program finishes. If set to summary, it says how many leaks occurred. If set to full or yes, each individual leak will be shown in detail and/or counted as an error, as specified by the options --show-leak-kinds and --errors-for-leak-kinds.
  3. --track-origins=<yes|no> [default: no], Controls whether Memcheck tracks the origin of uninitialised values. By default, it does not, which means that although it can tell you that an uninitialised value is being used in a dangerous way, it cannot tell you where the uninitialised value came from. This often makes it difficult to track down the root problem.
  4. --show-reachable=<yes|no> , --show-possibly-lost=<yes|no>, to show the using memory.

UTest and Coverage

First of all, download google test to utest/gtest, check by:

ls -lh utest/gtest/include/gtest/gtest.h >/dev/null && echo yes

To make ST with utest and run it:

make linux-debug-gcov && ./obj/st_utest

For macOS: make darwin-debug-gcov && ./obj/st_utest

Run utest without coverage: make darwin-debug-utest && ./obj/st_utest

Then, install gcovr for coverage:

yum install -y python2-pip &&
pip install lxml && pip install gcovr

For macOS: pip3 install gcovr

Finally, run test and get the report

mkdir -p coverage &&
gcovr -r . -e LINUX -e DARWIN -e examples --html --html-details -o coverage/st.html &&
open coverage/st.html

Note: We ignore LINUX* and DARWIN* which is obj actually.

Or just run locally:

bash auto/coverage.sh

Docs & Analysis

Winlin 2016