Ahmet Göksu pushed to branch GSoC-2023-Ahmet at FreeType / FreeType
Commits:
-
46551f7e
by goksu at 2023-06-19T22:15:55+03:00
5 changed files:
- builds/testing.mk
- src/tools/ftbench/fonts/deactivated/Arial_subset.ttf → src/tools/ftbench/fonts/Arial_subset.ttf
- src/tools/ftbench/fonts/deactivated/Tahoma_subset.ttf → src/tools/ftbench/fonts/Tahoma_subset.ttf
- src/tools/ftbench/fonts/deactivated/TimesNewRoman_subset.ttf → src/tools/ftbench/fonts/TimesNewRoman_subset.ttf
- src/tools/ftbench/src/tohtml.py
Changes:
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench
|
3 | 3 | FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c
|
4 | 4 | FTBENCH_BIN = $(OBJ_DIR)/bench.o
|
5 | +FTBENCH_FLAG = -c 50
|
|
5 | 6 | FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf)
|
6 | 7 | BASELINE = $(addprefix $(FTBENCH_DIR)/baseline/, $(notdir $(FONTS:.ttf=.txt)))
|
7 | 8 | BENCHMARK = $(addprefix $(FTBENCH_DIR)/benchmark/, $(notdir $(FONTS:.ttf=.txt)))
|
... | ... | @@ -25,7 +26,7 @@ $(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR) |
25 | 26 | baseline: $(FTBENCH_BIN) $(BASELINE_DIR)
|
26 | 27 | @echo "Creating baseline..."
|
27 | 28 | @$(foreach font, $(FONTS), \
|
28 | - $(FTBENCH_BIN) $(font) > $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
29 | + $(FTBENCH_BIN) $(FTBENCH_FLAG) $(font) > $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
29 | 30 | )
|
30 | 31 | @echo "Baseline created."
|
31 | 32 | |
... | ... | @@ -34,9 +35,9 @@ baseline: $(FTBENCH_BIN) $(BASELINE_DIR) |
34 | 35 | benchmark: $(FTBENCH_BIN) $(BENCHMARK_DIR)
|
35 | 36 | @echo "Creating benchmark..."
|
36 | 37 | @$(foreach font, $(FONTS), \
|
37 | - $(FTBENCH_BIN) $(font) > $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
38 | + $(FTBENCH_BIN) $(FTBENCH_FLAG) $(font) > $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
38 | 39 | )
|
39 | - @$(PYTHON) $(HTMLCREATOR) > $(HTMLFILE)
|
|
40 | + @$(PYTHON) $(HTMLCREATOR)
|
|
40 | 41 | @echo "Benchmark created."
|
41 | 42 | |
42 | 43 | .PHONY: clean-benchmark
|
... | ... | @@ -2,7 +2,15 @@ import os |
2 | 2 | import re
|
3 | 3 | |
4 | 4 | # Create the HTML file
|
5 | -with open('../../../../benchmark.html', 'w') as f:
|
|
5 | +current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
6 | + |
|
7 | +# Get the project root directory (assuming the script is inside nested directories in the project root)
|
|
8 | +project_root = os.path.abspath(os.path.join(current_dir, '../../../../'))
|
|
9 | + |
|
10 | +# Construct the absolute path to the benchmark file
|
|
11 | +benchmark_file = os.path.join(project_root, 'benchmark.html')
|
|
12 | + |
|
13 | +with open(benchmark_file, 'w') as f:
|
|
6 | 14 | f.write('<html>\n')
|
7 | 15 | f.write('<head>\n')
|
8 | 16 | f.write('<title>Benchmark Results</title>\n')
|
... | ... | @@ -10,10 +18,10 @@ with open('../../../../benchmark.html', 'w') as f: |
10 | 18 | f.write('<body>\n')
|
11 | 19 | f.write('<h1>Benchmark Results</h1>\n')
|
12 | 20 | |
13 | - # Traverse through the 'baselines' directory
|
|
14 | - for filename in os.listdir('../baseline'):
|
|
15 | - baseline_filepath = os.path.join('../baseline', filename)
|
|
16 | - benchmark_filepath = os.path.join('../benchmark', filename)
|
|
21 | + # Traverse through the 'baseline directory
|
|
22 | + for filename in os.listdir(os.path.join(project_root, 'src/tools/ftbench/baseline')):
|
|
23 | + baseline_filepath = os.path.join(os.path.join(project_root, 'src/tools/ftbench/baseline'), filename)
|
|
24 | + benchmark_filepath = os.path.join(os.path.join(project_root, 'src/tools/ftbench/benchmark'), filename)
|
|
17 | 25 | |
18 | 26 | # Process the baseline file
|
19 | 27 | with open(baseline_filepath, 'r') as baseline_file:
|