mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Added make *-diff rules, quick commands to compare sizes
This required a patch to the --diff flag for the scripts to ignore
a missing file. This enables the useful one liner for making comparisons
with potentially missing previous versions:
    ./scripts/code.py lfs.o -d lfs.o.code.csv -o lfs.o.code.csv
    function (0 added, 0 removed)            old     new    diff
    TOTAL                                  25476   25476      +0
One downside, these previous files are easy to delete as a part of make
clean, which limits their usefulness for comparing configuration
changes...
			
			
This commit is contained in:
		
							
								
								
									
										58
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										58
									
								
								Makefile
									
									
									
									
									
								
							| @@ -72,11 +72,6 @@ endif | ||||
| ifneq ($(OBJDUMP),objdump) | ||||
| override STRUCTSFLAGS += --objdump-tool="$(OBJDUMP)" | ||||
| endif | ||||
| override CODEFLAGS += -S | ||||
| override DATAFLAGS += -S | ||||
| override STACKFLAGS += -S | ||||
| override STRUCTSFLAGS += -S | ||||
| override COVERAGEFLAGS += -s | ||||
|  | ||||
|  | ||||
| # commands | ||||
| @@ -94,26 +89,10 @@ size: $(OBJ) | ||||
| tags: | ||||
| 	$(CTAGS) --totals --c-types=+p $(shell find -H -name '*.h') $(SRC) | ||||
|  | ||||
| .PHONY: code | ||||
| code: $(OBJ) | ||||
| 	./scripts/code.py $^ $(CODEFLAGS) | ||||
|  | ||||
| .PHONY: data | ||||
| data: $(OBJ) | ||||
| 	./scripts/data.py $^ $(DATAFLAGS) | ||||
|  | ||||
| .PHONY: calls | ||||
| calls: $(CGI) | ||||
| 	./scripts/calls.py $^ $(CALLSFLAGS) | ||||
|  | ||||
| .PHONY: stack | ||||
| stack: $(CGI) | ||||
| 	./scripts/stack.py $^ $(STACKFLAGS) | ||||
|  | ||||
| .PHONY: structs | ||||
| structs: $(OBJ) | ||||
| 	./scripts/structs.py $^ $(STRUCTSFLAGS) | ||||
|  | ||||
| .PHONY: test | ||||
| test: | ||||
| 	./scripts/test.py $(TESTFLAGS) | ||||
| @@ -121,8 +100,44 @@ test: | ||||
| test%: tests/test$$(firstword $$(subst \#, ,%)).toml | ||||
| 	./scripts/test.py $@ $(TESTFLAGS) | ||||
|  | ||||
| .PHONY: code | ||||
| code: $(OBJ) | ||||
| 	./scripts/code.py $^ -S $(CODEFLAGS) | ||||
|  | ||||
| .PHONY: code-diff | ||||
| code-diff: $(OBJ) | ||||
| 	./scripts/code.py $^ -d $(TARGET).code.csv -o $(TARGET).code.csv $(CODEFLAGS) | ||||
|  | ||||
| .PHONY: data | ||||
| data: $(OBJ) | ||||
| 	./scripts/data.py $^ -S $(DATAFLAGS) | ||||
|  | ||||
| .PHONY: data-diff | ||||
| data-diff: $(OBJ) | ||||
| 	./scripts/data.py $^ -d $(TARGET).data.csv -o $(TARGET).data.csv $(DATAFLAGS) | ||||
|  | ||||
| .PHONY: stack | ||||
| stack: $(CGI) | ||||
| 	./scripts/stack.py $^ -S $(STACKFLAGS) | ||||
|  | ||||
| .PHONY: stack-diff | ||||
| stack-diff: $(CGI) | ||||
| 	./scripts/stack.py $^ -d $(TARGET).stack.csv -o $(TARGET).stack.csv $(STACKFLAGS) | ||||
|  | ||||
| .PHONY: structs | ||||
| structs: $(OBJ) | ||||
| 	./scripts/structs.py $^ -S $(STRUCTSFLAGS) | ||||
|  | ||||
| .PHONY: structs-diff | ||||
| structs-diff: $(OBJ) | ||||
| 	./scripts/structs.py $^ -d $(TARGET).structs.csv -o $(TARGET).structs.csv $(STRUCTSFLAGS) | ||||
|  | ||||
| .PHONY: coverage | ||||
| coverage: | ||||
| 	./scripts/coverage.py $(BUILDDIR)tests/*.toml.info -s $(COVERAGEFLAGS) | ||||
|  | ||||
| .PHONY: coverage-diff | ||||
| coverage-diff: | ||||
| 	./scripts/coverage.py $(BUILDDIR)tests/*.toml.info $(COVERAGEFLAGS) | ||||
|  | ||||
| # rules | ||||
| @@ -148,6 +163,7 @@ $(BUILDDIR)%.ci: %.c | ||||
| .PHONY: clean | ||||
| clean: | ||||
| 	rm -f $(TARGET) | ||||
| 	rm -f $(TARGET).*.csv | ||||
| 	rm -f $(OBJ) | ||||
| 	rm -f $(CGI) | ||||
| 	rm -f $(DEP) | ||||
|   | ||||
| @@ -90,13 +90,16 @@ def main(**args): | ||||
|  | ||||
|     # find previous results? | ||||
|     if args.get('diff'): | ||||
|         with open(args['diff']) as f: | ||||
|             r = csv.DictReader(f) | ||||
|             prev_results = [ | ||||
|                 (   result['file'], | ||||
|                     result['function'], | ||||
|                     int(result['code_size'])) | ||||
|                 for result in r] | ||||
|         try: | ||||
|             with open(args['diff']) as f: | ||||
|                 r = csv.DictReader(f) | ||||
|                 prev_results = [ | ||||
|                     (   result['file'], | ||||
|                         result['function'], | ||||
|                         int(result['code_size'])) | ||||
|                     for result in r] | ||||
|         except FileNotFoundError: | ||||
|             prev_results = [] | ||||
|  | ||||
|         prev_total = 0 | ||||
|         for _, _, size in prev_results: | ||||
|   | ||||
| @@ -99,14 +99,17 @@ def main(**args): | ||||
|  | ||||
|     # find previous results? | ||||
|     if args.get('diff'): | ||||
|         with open(args['diff']) as f: | ||||
|             r = csv.DictReader(f) | ||||
|             prev_results = [ | ||||
|                 (   result['file'], | ||||
|                     result['function'], | ||||
|                     int(result['coverage_hits']), | ||||
|                     int(result['coverage_count'])) | ||||
|                 for result in r] | ||||
|         try: | ||||
|             with open(args['diff']) as f: | ||||
|                 r = csv.DictReader(f) | ||||
|                 prev_results = [ | ||||
|                     (   result['file'], | ||||
|                         result['function'], | ||||
|                         int(result['coverage_hits']), | ||||
|                         int(result['coverage_count'])) | ||||
|                     for result in r] | ||||
|         except FileNotFoundError: | ||||
|             prev_results = [] | ||||
|  | ||||
|         prev_total_hits, prev_total_count = 0, 0 | ||||
|         for _, _, hits, count in prev_results: | ||||
|   | ||||
| @@ -90,13 +90,16 @@ def main(**args): | ||||
|  | ||||
|     # find previous results? | ||||
|     if args.get('diff'): | ||||
|         with open(args['diff']) as f: | ||||
|             r = csv.DictReader(f) | ||||
|             prev_results = [ | ||||
|                 (   result['file'], | ||||
|                     result['function'], | ||||
|                     int(result['data_size'])) | ||||
|                 for result in r] | ||||
|         try: | ||||
|             with open(args['diff']) as f: | ||||
|                 r = csv.DictReader(f) | ||||
|                 prev_results = [ | ||||
|                     (   result['file'], | ||||
|                         result['function'], | ||||
|                         int(result['data_size'])) | ||||
|                     for result in r] | ||||
|         except FileNotFoundError: | ||||
|             prev_results = [] | ||||
|  | ||||
|         prev_total = 0 | ||||
|         for _, _, size in prev_results: | ||||
|   | ||||
| @@ -141,14 +141,17 @@ def main(**args): | ||||
|  | ||||
|     # find previous results? | ||||
|     if args.get('diff'): | ||||
|         with open(args['diff']) as f: | ||||
|             r = csv.DictReader(f) | ||||
|             prev_results = [ | ||||
|                 (   result['file'], | ||||
|                     result['function'], | ||||
|                     int(result['stack_frame']), | ||||
|                     float(result['stack_limit'])) | ||||
|                 for result in r] | ||||
|         try: | ||||
|             with open(args['diff']) as f: | ||||
|                 r = csv.DictReader(f) | ||||
|                 prev_results = [ | ||||
|                     (   result['file'], | ||||
|                         result['function'], | ||||
|                         int(result['stack_frame']), | ||||
|                         float(result['stack_limit'])) | ||||
|                     for result in r] | ||||
|         except FileNotFoundError: | ||||
|             prev_results = [] | ||||
|  | ||||
|         prev_total_frame = 0 | ||||
|         prev_total_limit = 0 | ||||
|   | ||||
| @@ -98,13 +98,16 @@ def main(**args): | ||||
|  | ||||
|     # find previous results? | ||||
|     if args.get('diff'): | ||||
|         with open(args['diff']) as f: | ||||
|             r = csv.DictReader(f) | ||||
|             prev_results = [ | ||||
|                 (   result['file'], | ||||
|                     result['struct'], | ||||
|                     int(result['struct_size'])) | ||||
|                 for result in r] | ||||
|         try: | ||||
|             with open(args['diff']) as f: | ||||
|                 r = csv.DictReader(f) | ||||
|                 prev_results = [ | ||||
|                     (   result['file'], | ||||
|                         result['struct'], | ||||
|                         int(result['struct_size'])) | ||||
|                     for result in r] | ||||
|         except FileNotFoundError: | ||||
|             prev_results = [] | ||||
|  | ||||
|         prev_total = 0 | ||||
|         for _, _, size in prev_results: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user