Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into oops2
Browse files Browse the repository at this point in the history
  • Loading branch information
goober3 committed Nov 17, 2023
2 parents c37e987 + 4fab9ba commit f640b04
Show file tree
Hide file tree
Showing 1,445 changed files with 97,337 additions and 62,265 deletions.
21 changes: 21 additions & 0 deletions .github/TICK_ORDER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The byond tick proceeds as follows:
1. procs sleeping via walk() are resumed (i dont know why these are first)

2. normal sleeping procs are resumed, in the order they went to sleep in the first place, this is where the MC wakes up and processes subsystems. a consequence of this is that the MC almost never resumes before other sleeping procs, because it only goes to sleep for 1 tick 99% of the time, and 99% of procs either go to sleep for less time than the MC (which guarantees that they entered the sleep queue earlier when its time to wake up) and/or were called synchronously from the MC's execution, almost all of the time the MC is the last sleeping proc to resume in any given tick. This is good because it means the MC can account for the cost of previous resuming procs in the tick, and minimizes overtime.

3. control is passed to byond after all of our code's procs stop execution for this tick

4. a few small things happen in byond internals

5. SendMaps is called for this tick, which processes the game state for all clients connected to the game and handles sending them changes
in appearances within their view range. This is expensive and takes up a significant portion of our tick, about 0.45% per connected player
as of 3/20/2022. meaning that with 50 players, 22.5% of our tick is being used up by just SendMaps, after all of our code has stopped executing. Thats only the average across all rounds, for most highpop rounds it can look like 0.6% of the tick per player, which is 30% for 50 players.

6. After SendMaps ends, client verbs sent to the server are executed, and its the last major step before the next tick begins.
During the course of the tick, a client can send a command to the server saying that they have executed any verb. The actual code defined
for that /verb/name() proc isnt executed until this point, and the way the MC is designed makes this especially likely to make verbs
"overrun" the bounds of the tick they executed in, stopping the other tick from starting and thus delaying the MC firing in that tick.

The master controller can derive how much of the tick was used in: procs executing before it woke up (because of world.tick_usage), and SendMaps (because of world.map_cpu, since this is a running average you cant derive the tick spent on maptick on any particular tick). It cannot derive how much of the tick was used for sleeping procs resuming after the MC ran, or for verbs executing after SendMaps.

It is for these reasons why you should heavily limit processing done in verbs, while procs resuming after the MC are rare, verbs are not, and are much more likely to cause overtime since theyre literally at the end of the tick. If you make a verb, try to offload any expensive work to the beginning of the next tick via a verb management subsystem.
2 changes: 1 addition & 1 deletion .github/workflows/autowiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
autowiki:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: "Check for AUTOWIKI_USERNAME"
id: secrets_set
Expand Down
68 changes: 19 additions & 49 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
- master
jobs:
run_linters:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Run Linters
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -66,8 +67,9 @@ jobs:
cat check_regex_output.txt
compile_all_maps:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Compile Maps
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Python setup
Expand All @@ -90,54 +92,22 @@ jobs:
tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS -DFULL_INIT
run_all_tests:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Integration Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Setup cache
id: cache-byond
uses: actions/cache@v3
with:
path: ~/BYOND
key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- name: Install BYOND
if: steps.cache-byond.outputs.cache-hit != 'true'
run: bash tools/ci/install_byond.sh
- name: Setup database
run: |
sudo systemctl start mysql
mysql -u root -proot -e 'CREATE DATABASE tg_ci;'
mysql -u root -proot tg_ci < SQL/tgstation_schema.sql
mysql -u root -proot -e 'CREATE DATABASE tg_ci_prefixed;'
mysql -u root -proot tg_ci_prefixed < SQL/tgstation_schema_prefixed.sql
- name: Install rust-g
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -o APT::Immediate-Configure=false libssl1.1:i386
bash tools/ci/install_rust_g.sh
- name: Install auxmos
run: |
bash tools/ci/install_auxmos.sh
- name: Compile Tests
run: |
bash tools/ci/install_byond.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/build/build --ci dm -DCIBUILDING -DANSICOLORS
- name: Run Tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh
uses: ./.github/workflows/run_integration_tests.yml

# run_alternate_tests:
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
# name: Alternate Tests
# strategy:
# fail-fast: false
# matrix:
# major: [515]
# minor: [1614]
# uses: ./.github/workflows/run_integration_tests.yml
# with:
# major: ${{ matrix.major }}
# minor: ${{ matrix.minor }}

test_windows:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
compile:
name: "Compile changelogs"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: "Check for ACTION_ENABLER secret and pass it to output if it exists to be checked by later steps"
id: value_holder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
publish:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Restore SpacemanDMM cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
MakeCL:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/round_id_linker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
link_rounds:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: shiptest-ss13/[email protected]
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a reusable workflow to run integration tests.
# This is run for every single map in ci_suite.yml. You might want to edit that instead.
name: Run Integration Tests
on:
workflow_call:
inputs:
major:
required: false
type: string
minor:
required: false
type: string
jobs:
run_integration_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Setup cache
id: cache-byond
uses: actions/cache@v3
with:
path: ~/BYOND
key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- name: Setup database
run: |
sudo systemctl start mysql
mysql -u root -proot -e 'CREATE DATABASE tg_ci;'
mysql -u root -proot tg_ci < SQL/tgstation_schema.sql
mysql -u root -proot -e 'CREATE DATABASE tg_ci_prefixed;'
mysql -u root -proot tg_ci_prefixed < SQL/tgstation_schema_prefixed.sql
- name: Install rust-g
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -o APT::Immediate-Configure=false libssl-dev:i386
bash tools/ci/install_rust_g.sh
- name: Install auxmos
run: |
bash tools/ci/install_auxmos.sh
- name: Configure version
if: ${{ inputs.major }}
run: |
echo "BYOND_MAJOR=${{ inputs.major }}" >> $GITHUB_ENV
echo "BYOND_MINOR=${{ inputs.minor }}" >> $GITHUB_ENV
- name: Compile Tests
run: |
bash tools/ci/install_byond.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/build/build --ci dm -DCIBUILDING -DANSICOLORS
- name: Run Tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
stale:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_tgs_dmapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update-dmapi:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Update the TGS DMAPI
steps:
- name: Clone
Expand Down
Loading

0 comments on commit f640b04

Please sign in to comment.