Coder Social home page Coder Social logo

overfittingstudyroom / state-threads Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ossrs/state-threads

0.0 0.0 0.0 654 KB

Lightweight thread library for C/C++ coroutine (similar to goroutine), for high performance network servers.

Home Page: http://sourceforge.net/projects/state-threads

License: Other

Shell 0.27% C++ 84.90% C 9.66% Assembly 2.03% Makefile 0.92% CMake 2.23%

state-threads's Introduction

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.

LICENSE

state-threads is licenced under MPL or GPLv2.

Linux: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For Linux:

make linux-debug

For Linux aarch64, which fail with Unknown CPU architecture:

make linux-debug EXTRA_CFLAGS="-D__aarch64__"

Note: For more CPU architectures, please see #22

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"

Mac: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For OSX:

make darwin-debug

For OSX, user must specifies the valgrind header files:

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

Remark: M1 is unsupported by ST, please use docker to run, please read SRS#2747.

Windows: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For Cygwin(Windows):

make cygwin64-debug

Remark: Windows native build is unsupported right now.

Branch SRS

The branch srs was patched and refined:

  • ARM: Patch st.arm.patch, for ARM.
  • OSX: Patch st.osx.kqueue.patch, for osx.
  • Linux: Patch st.disable.examples.patch, for ubuntu.
  • System: Refine TAB of code.
  • ARM: Merge from michaeltalyansky and xzh3836598, support ARM.
  • Valgrind: Merge from toffaletti, support valgrind for ST.
  • OSX: Patch st.osx10.14.build.patch, for osx 10.14 build.
  • ARM: Support macro MD_ST_NO_ASM to disable ASM, #8.
  • AARCH64: Merge patch srs#1282 to support aarch64, #9.
  • OSX: Support OSX for Apple Darwin, macOS, #11.
  • System: Refine performance for sleep or epoll_wait(0), #17.
  • System: Support utest by gtest and coverage by gcov/gocvr.
  • System: Only support for Linux and Darwin. #19, srs#2188.
  • System: Improve the performance of timer. 9fe8cfe5b, 7879c2b, 387cddb
  • Windows: Support Windows 64bits. #20.
  • MIPS: Support Linux/MIPS for OpenWRT, #21.
  • LOONGARCH: Support loongarch for loongson CPU, #24.
  • System: Support Multiple Threads for Linux and Darwin. #19, srs#2188.
  • RISCV: Support RISCV for RISCV CPU, #24.
  • MIPS: Support Linux/MIPS64 for loongson 3A4000/3B3000, #21.
  • AppleM1: Support Apple Silicon M1(aarch64), #30.
  • IDE: Support CLion for debugging and learning.
  • Define and use a new jmpbuf, because the structure is different.
  • System: Support sendmmsg for UDP, #12.

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.

Linux: UTest

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

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

Note that the gcc(4.8) of CentOS is too old, please use docker(ossrs/srs:dev-gcc7) to run:

docker run --rm -it -v $(pwd):/state-threads -w /state-threads \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:dev-gcc7 \
    bash -c 'make linux-debug-utest && ./obj/st_utest'

Mac: UTest

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

make darwin-debug-utest && ./obj/st_utest

Linux: Coverage

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

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

Note that the gcc(4.8) of CentOS is too old, please use docker(ossrs/srs:dev-gcc7) to run:

docker run --rm -it -v $(pwd):/state-threads -w /state-threads \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:dev-gcc7 \
    bash -c 'make linux-debug-gcov && ./obj/st_utest'

Then, install gcovr for coverage:

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

Finally, run test and get the report:

bash auto/coverage.sh

Mac: Coverage

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

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

Then, install gcovr for coverage:

pip install gcovr

Finally, run test and get the report:

bash auto/coverage.sh

Docs & Analysis

CLion

Use CLion to open directory state-threads.

Then, open ide/st_clion/CMakeLists.txt and click Load CMake project.

Finally, select a configuration to run or debug.

Winlin 2016

state-threads's People

Contributors

chen-guanghua avatar t-bagwell avatar timgates42 avatar winlinvip avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.