Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

17
test/bench/BUILD.gn Normal file
View File

@@ -0,0 +1,17 @@
import("//build/userland/TEMPLATE.gni")
xOS_executable("launch_server") {
signexec = true
install_path = "System/"
sources = [
"main.cpp",
"pngloader.cpp",
]
configs = [ "//build/userland:userland_flags" ]
deplibs = [
"libcxx",
"libfoundation",
"libg",
"libui",
]
}

21
test/bench/common.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <ctime>
#include <sys/time.h>
#define RUN_BENCH(name, x) for (bench_run = 0, bench_pno = bench_no, gettimeofday(&tv, &tz); bench_run < x; gettimeofday(&ttv, &tz), printf("[BENCH][%s] %d (usec)\n", name, to_usec()), fflush(stdout), bench_run++, gettimeofday(&tv, &tz))
extern int bench_pno;
extern int bench_no;
extern int bench_run;
extern timeval_t tv, ttv;
extern timezone_t tz;
static inline int to_usec()
{
int sec = ttv.tv_sec - tv.tv_sec;
int diff = ttv.tv_usec - tv.tv_usec;
return sec * 1000000 + diff;
}
void bench_pngloader();

39
test/bench/main.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include "common.h"
#include <cstdio>
#include <cstdlib>
#include <sys/wait.h>
#include <unistd.h>
char* bench_name;
int bench_pno = -1;
int bench_no = 0;
int bench_run = 0;
timeval_t tv, ttv;
timezone_t tz;
void bench_kernel()
{
RUN_BENCH("FORK", 3)
{
for (int i = 0; i < 20; i++) {
int pid = fork();
if (pid < 0) {
return;
}
if (pid) {
wait(pid);
} else {
exit(0);
}
}
}
}
int main(int argc, char** argv)
{
bench_kernel();
bench_pngloader();
printf("[BENCH END]\n\n");
fflush(stdout);
return 0;
}

13
test/bench/pngloader.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include "common.h"
#include <libg/ImageLoaders/PNGLoader.h>
LG::PixelBitmap bitmap;
void bench_pngloader()
{
RUN_BENCH("PNG LOADER", 5)
{
LG::PNG::PNGLoader loader;
bitmap = loader.load_from_file("/res/wallpapers/island.png");
}
}