mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:03:13 +02:00
atop's `-P PRC` output inserts the clock-tick rate (HZ=100) between the
`state` and `utime` columns. Both the Python parser and the native C
aggregator read that constant as utime for every record, charging a flat
1 CPU-second per record — so cpu_seconds collapsed to pid_count and
short-lived fork-storm commands (xset, dd, chronyc) topped the CPU table
(xset showed 67h). The old test fixtures lacked the HZ field, so code and
tests agreed on the bug.
- _parse_prc / atop_agg.c: read utime/stime past the HZ field (after+2/+3,
tokens[10]/[11]); bump the length guards accordingly
- restore C/atop_agg (deleted in 89b4f59) under linux_configuration/C/,
where the build path resolves; corrected test fixtures to include HZ
- _atop_agg_binary: fall back to the Python parser when the C source tree
is gone instead of trusting an orphaned cached binary
- add regression tests proving HZ is not summed as CPU
- bundle the in-progress since-last-report multi-day aggregation (segments,
-b/-e bounding, persisted state, window merging) and its tests/conftest
- meta: gate linux_configuration/tests in pytest_changed_packages.py
Verified by running usage_report.py --date 20260604: Top CPU now led by
SkyrimSE; xset/dd/chronyc fall to ~0. C unit tests + full pytest suite green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
930 B
Makefile
34 lines
930 B
Makefile
CC := gcc
|
|
CFLAGS := -O2 -std=c11 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wno-unused-parameter
|
|
COV := -O0 -g --coverage -std=c11 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wno-unused-parameter -DATOP_AGG_NO_MAIN
|
|
|
|
SRC := atop_agg.c
|
|
HDR := atop_agg.h
|
|
BIN := atop_agg
|
|
|
|
.PHONY: all clean rebuild test coverage
|
|
|
|
all: $(BIN)
|
|
|
|
$(BIN): $(SRC) $(HDR)
|
|
$(CC) $(CFLAGS) -o $@ $(SRC)
|
|
|
|
test_atop_agg: test_atop_agg.c atop_agg.c atop_agg.h
|
|
$(CC) $(COV) -o test_atop_agg test_atop_agg.c atop_agg.c
|
|
|
|
test: test_atop_agg
|
|
./test_atop_agg
|
|
|
|
coverage: test_atop_agg
|
|
./test_atop_agg
|
|
lcov --capture --directory . --output-file coverage.info --no-external
|
|
lcov --remove coverage.info '*/test_atop_agg.c' --output-file coverage.info
|
|
genhtml coverage.info --output-directory coverage_html
|
|
@echo "Coverage report at coverage_html/index.html"
|
|
|
|
clean:
|
|
rm -f $(BIN) test_atop_agg *.o *.gcda *.gcno coverage.info
|
|
rm -rf coverage_html
|
|
|
|
rebuild: clean all
|