From ceb8fab9aef386f43abe79d9379a8649acc0c9fd Mon Sep 17 00:00:00 2001 From: goksu <25721443+goeksu@users.noreply.github.com> Date: Wed, 12 Jul 2023 00:52:31 +0300 Subject: [PATCH] html dirs --- builds/testing.mk | 14 +++---- src/tools/ftbench/src/tohtml.py | 65 ++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/builds/testing.mk b/builds/testing.mk index c7eb267d9..f2dff8caf 100644 --- a/builds/testing.mk +++ b/builds/testing.mk @@ -5,14 +5,14 @@ FTBENCH_BIN = $(OBJ_DIR)/bench.o FTBENCH_FLAG ?= -c 200 INCLUDES = -I$(TOP_DIR)/include FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf) -BASELINE = $(addprefix $(FTBENCH_DIR)/baseline/, $(notdir $(FONTS:.ttf=.txt))) -BENCHMARK = $(addprefix $(FTBENCH_DIR)/benchmark/, $(notdir $(FONTS:.ttf=.txt))) -BASELINE_DIR = $(FTBENCH_DIR)/baseline/ -BENCHMARK_DIR = $(FTBENCH_DIR)/benchmark/ +BASELINE_DIR = $(OBJ_DIR)/baseline/ +BENCHMARK_DIR = $(OBJ_DIR)/benchmark/ +BASELINE = $(addprefix $(BASELINE_DIR), $(notdir $(FONTS:.ttf=.txt))) +BENCHMARK = $(addprefix $(BENCHMARK_DIR), $(notdir $(FONTS:.ttf=.txt))) BASELINE_INFO = $(BASELINE_DIR)info.txt BENCHMARK_INFO = $(BENCHMARK_DIR)info.txt HTMLCREATOR = $(FTBENCH_DIR)/src/tohtml.py -HTMLFILE = $(TOP_DIR)/benchmark.html +HTMLFILE = $(OBJ_DIR)/benchmark.html # Create directories for baseline and benchmark $(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR): @@ -21,7 +21,7 @@ $(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR): # Build ftbench $(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR) @echo "Building ftbench..." - $(CC) $(INCLUDES) $< -lfreetype -o $@ + @$(CC) $(INCLUDES) $< -lfreetype -o $@ # Create a baseline .PHONY: baseline @@ -49,7 +49,7 @@ benchmark: $(FTBENCH_BIN) $(BENCHMARK_DIR) @$(foreach font, $(FONTS), \ $(FTBENCH_BIN) $(FTBENCH_FLAG) $(font) >> $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \ ) - @$(PYTHON) $(HTMLCREATOR) + @$(PYTHON) $(HTMLCREATOR) $(OBJ_DIR) @echo "Benchmark created." .PHONY: clean-benchmark diff --git a/src/tools/ftbench/src/tohtml.py b/src/tools/ftbench/src/tohtml.py index 3d227bf2b..a3b766654 100644 --- a/src/tools/ftbench/src/tohtml.py +++ b/src/tools/ftbench/src/tohtml.py @@ -1,21 +1,48 @@ import os import re +import sys # Create the HTML file -current_dir = os.path.dirname(os.path.abspath(__file__)) -project_root = os.path.abspath(os.path.join(current_dir, '../../../../')) +project_root = sys.argv[1] benchmark_html = os.path.join(project_root, 'benchmark.html') # GitLab URL gitlab_url = 'https://gitlab.freedesktop.org/freetype/freetype/-/commit/' +# CSS style +CSS_STYLE = """ + +""" + # Directories -baseline_dir = os.path.join(project_root, 'src/tools/ftbench/baseline') -benchmark_dir = os.path.join(project_root, 'src/tools/ftbench/benchmark') +baseline_dir = os.path.join(project_root, 'baseline') +benchmark_dir = os.path.join(project_root, 'benchmark') # Open HTML file for writing with open(benchmark_html, 'w') as html_file: - html_file.write('\n
\n| Test | Baseline | Benchmark | Difference |
|---|---|---|---|
| Test | Baseline (µs/op) | Benchmark (µs/op) | Difference (%) |
| {} | {:.2f}\tus/op | {:.2f}\tus/op | {:.2f}% |
| {} | {:.2f} | {:.2f} | {:.2f} |
| {} | {:.2f}\tus/op | {:.2f}\tus/op | {:.2f}% |
| {} | {:.2f} | {:.2f} | {:.2f} |