Fix Benchmark
Build / Build (AMD64, Server) (push) Successful in 10m10s Details
Build / Build (AMD64, Client) (push) Successful in 10m24s Details
Build / Build (ARM64, Server) (push) Successful in 10m15s Details
Build / Build (ARM64, Client) (push) Successful in 10m35s Details
Build / Build (ARMHF, Server) (push) Successful in 7m7s Details
Build / Build (ARMHF, Client) (push) Successful in 9m43s Details
Build / Test (Server) (push) Successful in 11m22s Details
Build / Release (push) Has been skipped Details
Build / Test (Client) (push) Successful in 17m22s Details

This commit is contained in:
TheBrokenRail 2024-01-23 23:00:22 -05:00
parent 0b252faa5f
commit 49f56bd90d
3 changed files with 17 additions and 18 deletions

View File

@ -13,7 +13,7 @@ void init_compat();
void init_server();
#else
void init_multiplayer();
void init_benchmark();
void init_benchmark(int argc, char *argv[]);
#endif
#ifndef MCPI_HEADLESS_MODE
void init_sound();

View File

@ -10,20 +10,6 @@
#include <mods/compat/compat.h>
#include <mods/misc/misc.h>
// --benchmark: Activate Benchmark
static bool active = false;
__attribute__((constructor)) static void _init_active(int argc, char *argv[]) {
// Iterate Arguments
for (int i = 1; i < argc; i++) {
// Check Argument
if (strcmp(argv[i], "--benchmark") == 0) {
// Enabled
active = true;
break;
}
}
}
// Constants
#define NANOSECONDS_IN_SECOND 1000000000ll
@ -172,7 +158,17 @@ static void Minecraft_update_injection(Minecraft *minecraft) {
}
// Init Benchmark
void init_benchmark() {
void init_benchmark(int argc, char *argv[]) {
// --benchmark: Activate Benchmark
bool active = false;
for (int i = 1; i < argc; i++) {
// Check Argument
if (strcmp(argv[i], "--benchmark") == 0) {
// Enabled
active = true;
break;
}
}
if (active) {
misc_run_on_update(Minecraft_update_injection);
// Track Ticks

View File

@ -3,7 +3,7 @@
#include <media-layer/core.h>
#include <symbols/minecraft.h>
__attribute__((constructor)) static void init() {
__attribute__((constructor)) static void init(int argc, char *argv[]) {
media_ensure_loaded();
run_tests();
init_symbols();
@ -34,6 +34,9 @@ __attribute__((constructor)) static void init() {
init_bucket();
init_home();
#ifndef MCPI_SERVER_MODE
init_benchmark();
init_benchmark(argc, argv);
#else
(void) argc;
(void) argv;
#endif
}