Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tools): tracy profiler #10702

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

- **[База данных](https://github.com/ChaoticOnyx/OnyxBay/blob/dev/docs/db.md)** - база данных и как её поднимать.

- **[Профилирование](https://github.com/ChaoticOnyx/OnyxBay/blob/dev/docs/profiling.md)** - профилирование кода.

## Списки задач

- [Задачи с денежными наградами](https://github.com/ChaoticOnyx/OnyxBay/issues?q=is%3Aopen+is%3Aissue+label%3A%F0%9F%92%B0%D0%BD%D0%B0%D0%B3%D1%80%D0%B0%D0%B4%D0%B0)
Expand Down
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// END_FILE_DIR
// BEGIN_PREFERENCES
#define DEBUG
// #define TRACY_PROFILER
// END_PREFERENCES
// BEGIN_INCLUDE
#include "code\__spaceman_dmm.dm"
Expand Down
18 changes: 18 additions & 0 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,26 @@ var/server_name = "OnyxBay"

return match

/world/proc/__init_tracy()
#ifdef TRACY_PROFILER
var/tracy_lib

if(world.system_type == MS_WINDOWS)
tracy_lib = "prof.dll"
else
tracy_lib = "libprof.so"

var/tracy_init = call(tracy_lib, "init")()

if(tracy_init != "0")
CRASH("[tracy_lib] init error: [tracy_init]")
#else
return
#endif

#define RECOMMENDED_VERSION 514
/world/New()
__init_tracy()
SetupLogs()

if(world.system_type == UNIX)
Expand Down
9 changes: 9 additions & 0 deletions docs/profiling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Profiling

В билде есть поддержка профайлера [byond-tracy](https://github.com/mafemergency/byond-tracy) версии [cc015b63c4569929ab8e57a0dc2ab4363a77b188](https://github.com/mafemergency/byond-tracy/commit/cc015b63c4569929ab8e57a0dc2ab4363a77b188). Для его включения нужно скомпилироавть билд с `#define TRACY_PROFILER`.

## Использование

Для получения данных от профайлера к нему нужно подключиться с помощью Tracy, его можно скачать [отсюда](https://github.com/wolfpld/tracy) (выберите одну из поддерживаемых byond-tracy версию). Подключение можно начать в любой удобный момент времени - до или после старта билда.

Собранные данные можно сохранять в отдельный файл.
Binary file added prof.dll
Binary file not shown.
Loading