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) | ifneq ($(OBJDUMP),objdump) | ||||||
| override STRUCTSFLAGS += --objdump-tool="$(OBJDUMP)" | override STRUCTSFLAGS += --objdump-tool="$(OBJDUMP)" | ||||||
| endif | endif | ||||||
| override CODEFLAGS += -S |  | ||||||
| override DATAFLAGS += -S |  | ||||||
| override STACKFLAGS += -S |  | ||||||
| override STRUCTSFLAGS += -S |  | ||||||
| override COVERAGEFLAGS += -s |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # commands | # commands | ||||||
| @@ -94,26 +89,10 @@ size: $(OBJ) | |||||||
| tags: | tags: | ||||||
| 	$(CTAGS) --totals --c-types=+p $(shell find -H -name '*.h') $(SRC) | 	$(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 | .PHONY: calls | ||||||
| calls: $(CGI) | calls: $(CGI) | ||||||
| 	./scripts/calls.py $^ $(CALLSFLAGS) | 	./scripts/calls.py $^ $(CALLSFLAGS) | ||||||
|  |  | ||||||
| .PHONY: stack |  | ||||||
| stack: $(CGI) |  | ||||||
| 	./scripts/stack.py $^ $(STACKFLAGS) |  | ||||||
|  |  | ||||||
| .PHONY: structs |  | ||||||
| structs: $(OBJ) |  | ||||||
| 	./scripts/structs.py $^ $(STRUCTSFLAGS) |  | ||||||
|  |  | ||||||
| .PHONY: test | .PHONY: test | ||||||
| test: | test: | ||||||
| 	./scripts/test.py $(TESTFLAGS) | 	./scripts/test.py $(TESTFLAGS) | ||||||
| @@ -121,8 +100,44 @@ test: | |||||||
| test%: tests/test$$(firstword $$(subst \#, ,%)).toml | test%: tests/test$$(firstword $$(subst \#, ,%)).toml | ||||||
| 	./scripts/test.py $@ $(TESTFLAGS) | 	./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 | .PHONY: coverage | ||||||
| coverage: | coverage: | ||||||
|  | 	./scripts/coverage.py $(BUILDDIR)tests/*.toml.info -s $(COVERAGEFLAGS) | ||||||
|  |  | ||||||
|  | .PHONY: coverage-diff | ||||||
|  | coverage-diff: | ||||||
| 	./scripts/coverage.py $(BUILDDIR)tests/*.toml.info $(COVERAGEFLAGS) | 	./scripts/coverage.py $(BUILDDIR)tests/*.toml.info $(COVERAGEFLAGS) | ||||||
|  |  | ||||||
| # rules | # rules | ||||||
| @@ -148,6 +163,7 @@ $(BUILDDIR)%.ci: %.c | |||||||
| .PHONY: clean | .PHONY: clean | ||||||
| clean: | clean: | ||||||
| 	rm -f $(TARGET) | 	rm -f $(TARGET) | ||||||
|  | 	rm -f $(TARGET).*.csv | ||||||
| 	rm -f $(OBJ) | 	rm -f $(OBJ) | ||||||
| 	rm -f $(CGI) | 	rm -f $(CGI) | ||||||
| 	rm -f $(DEP) | 	rm -f $(DEP) | ||||||
|   | |||||||
| @@ -90,13 +90,16 @@ def main(**args): | |||||||
|  |  | ||||||
|     # find previous results? |     # find previous results? | ||||||
|     if args.get('diff'): |     if args.get('diff'): | ||||||
|         with open(args['diff']) as f: |         try: | ||||||
|             r = csv.DictReader(f) |             with open(args['diff']) as f: | ||||||
|             prev_results = [ |                 r = csv.DictReader(f) | ||||||
|                 (   result['file'], |                 prev_results = [ | ||||||
|                     result['function'], |                     (   result['file'], | ||||||
|                     int(result['code_size'])) |                         result['function'], | ||||||
|                 for result in r] |                         int(result['code_size'])) | ||||||
|  |                     for result in r] | ||||||
|  |         except FileNotFoundError: | ||||||
|  |             prev_results = [] | ||||||
|  |  | ||||||
|         prev_total = 0 |         prev_total = 0 | ||||||
|         for _, _, size in prev_results: |         for _, _, size in prev_results: | ||||||
|   | |||||||
| @@ -99,14 +99,17 @@ def main(**args): | |||||||
|  |  | ||||||
|     # find previous results? |     # find previous results? | ||||||
|     if args.get('diff'): |     if args.get('diff'): | ||||||
|         with open(args['diff']) as f: |         try: | ||||||
|             r = csv.DictReader(f) |             with open(args['diff']) as f: | ||||||
|             prev_results = [ |                 r = csv.DictReader(f) | ||||||
|                 (   result['file'], |                 prev_results = [ | ||||||
|                     result['function'], |                     (   result['file'], | ||||||
|                     int(result['coverage_hits']), |                         result['function'], | ||||||
|                     int(result['coverage_count'])) |                         int(result['coverage_hits']), | ||||||
|                 for result in r] |                         int(result['coverage_count'])) | ||||||
|  |                     for result in r] | ||||||
|  |         except FileNotFoundError: | ||||||
|  |             prev_results = [] | ||||||
|  |  | ||||||
|         prev_total_hits, prev_total_count = 0, 0 |         prev_total_hits, prev_total_count = 0, 0 | ||||||
|         for _, _, hits, count in prev_results: |         for _, _, hits, count in prev_results: | ||||||
|   | |||||||
| @@ -90,13 +90,16 @@ def main(**args): | |||||||
|  |  | ||||||
|     # find previous results? |     # find previous results? | ||||||
|     if args.get('diff'): |     if args.get('diff'): | ||||||
|         with open(args['diff']) as f: |         try: | ||||||
|             r = csv.DictReader(f) |             with open(args['diff']) as f: | ||||||
|             prev_results = [ |                 r = csv.DictReader(f) | ||||||
|                 (   result['file'], |                 prev_results = [ | ||||||
|                     result['function'], |                     (   result['file'], | ||||||
|                     int(result['data_size'])) |                         result['function'], | ||||||
|                 for result in r] |                         int(result['data_size'])) | ||||||
|  |                     for result in r] | ||||||
|  |         except FileNotFoundError: | ||||||
|  |             prev_results = [] | ||||||
|  |  | ||||||
|         prev_total = 0 |         prev_total = 0 | ||||||
|         for _, _, size in prev_results: |         for _, _, size in prev_results: | ||||||
|   | |||||||
| @@ -141,14 +141,17 @@ def main(**args): | |||||||
|  |  | ||||||
|     # find previous results? |     # find previous results? | ||||||
|     if args.get('diff'): |     if args.get('diff'): | ||||||
|         with open(args['diff']) as f: |         try: | ||||||
|             r = csv.DictReader(f) |             with open(args['diff']) as f: | ||||||
|             prev_results = [ |                 r = csv.DictReader(f) | ||||||
|                 (   result['file'], |                 prev_results = [ | ||||||
|                     result['function'], |                     (   result['file'], | ||||||
|                     int(result['stack_frame']), |                         result['function'], | ||||||
|                     float(result['stack_limit'])) |                         int(result['stack_frame']), | ||||||
|                 for result in r] |                         float(result['stack_limit'])) | ||||||
|  |                     for result in r] | ||||||
|  |         except FileNotFoundError: | ||||||
|  |             prev_results = [] | ||||||
|  |  | ||||||
|         prev_total_frame = 0 |         prev_total_frame = 0 | ||||||
|         prev_total_limit = 0 |         prev_total_limit = 0 | ||||||
|   | |||||||
| @@ -98,13 +98,16 @@ def main(**args): | |||||||
|  |  | ||||||
|     # find previous results? |     # find previous results? | ||||||
|     if args.get('diff'): |     if args.get('diff'): | ||||||
|         with open(args['diff']) as f: |         try: | ||||||
|             r = csv.DictReader(f) |             with open(args['diff']) as f: | ||||||
|             prev_results = [ |                 r = csv.DictReader(f) | ||||||
|                 (   result['file'], |                 prev_results = [ | ||||||
|                     result['struct'], |                     (   result['file'], | ||||||
|                     int(result['struct_size'])) |                         result['struct'], | ||||||
|                 for result in r] |                         int(result['struct_size'])) | ||||||
|  |                     for result in r] | ||||||
|  |         except FileNotFoundError: | ||||||
|  |             prev_results = [] | ||||||
|  |  | ||||||
|         prev_total = 0 |         prev_total = 0 | ||||||
|         for _, _, size in prev_results: |         for _, _, size in prev_results: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user