1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 20:01:56 +00:00
srs/trunk/3rdparty/st-srs
winlin 442cf615c0 ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2
commit f4872e528cad07f8ea683cc8cb26e34111bad1b5
Author: winlin <winlin@vip.126.com>
Date:   Fri Feb 26 09:13:21 2021 +0800

    ST: For #2188: Remove sendmmsg from ST.

commit aaeb8919bd4a026268e0600398cb1e9ad477663f
Author: winlin <winlin@vip.126.com>
Date:   Thu Mar 11 08:09:54 2021 +0800

    ST: Refine utest script.

commit d1ac9da53060b6bfa82b5d041da4c2ad9bd6b90a
Author: winlin <winlin@vip.126.com>
Date:   Wed Mar 3 11:02:25 2021 +0800

    ST: Support fast utest and coverage

commit 8400115b83c022e33f59422dbf6d85ee46fb9edb
Author: winlin <winlin@vip.126.com>
Date:   Fri Feb 26 07:02:19 2021 +0800

    ST: Always use unserialized accept for linux or darwin

commit c3686f2bca80d2c139239b08975575b1bb981ffa
Author: winlin <winlin@vip.126.com>
Date:   Fri Feb 26 06:54:05 2021 +0800

    ST: Refine ARFLAGS by disable the verbose log

commit aaa5c4f863eba278c4ed2b29a46297fb01a4ed63
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 08:58:46 2021 +0800

    ST: Stack always grows from top to down.

commit dddd466e5c2e418c6f4896cd8bf701130052b3d9
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 08:51:31 2021 +0800

    ST: Ignore process fork, for single process only

commit 7906cb5f6e78c916cb8b8d9522275bfc086bb6a3
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 08:50:59 2021 +0800

    ST: Fix build warnings

commit d94921b84a3b6cf88ace2c766cc2bfedb9c0602e
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 07:27:45 2021 +0800

    ST: Remove select and poll support, only epoll and kqueue

commit 76d202514615f78d1a8f2b15778f3dac5abf4abb
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 07:10:47 2021 +0800

    ST: Remove multiple OS support, except Linux and Darwin.

commit 13c4ba345c61170e86dde486a174378ca235f442
Author: winlin <winlin@vip.126.com>
Date:   Thu Feb 25 06:59:35 2021 +0800

    ST: Remove __ia64__ CPU support

commit 46c06e4a11879cfeb828382e44f11287782ce4b5
Author: winlin <winlin@vip.126.com>
Date:   Wed Feb 24 11:37:27 2021 +0800

    ST: Remove unused files for ST
2021-05-19 18:25:49 +08:00
..
.circleci Merge ST, support utest and coverage by gtest. 2021-03-04 15:01:14 +08:00
auto ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
docs For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00
utest ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
.gitignore Merge ST, support utest and coverage by gtest. 2021-03-04 15:01:14 +08:00
common.h ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
event.c ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
io.c ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
key.c For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00
Makefile ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
md.h ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
md_darwin.S Support macOS OSX 2020-03-28 17:20:40 +08:00
md_linux.S ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
public.h ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
README For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00
README.md ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
sched.c ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process. 5.0.2 2021-05-19 18:25:49 +08:00
st.pc.in For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00
stk.c For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00
sync.c For #1537, #1282, use ST source code in SRS 2019-12-25 15:55:56 +08:00

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