Commit graph

1320 commits

Author SHA1 Message Date
Yanray Wang
9a6ee71f6f code_size_compare: right-align numbers in the comparison result
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:30:27 +08:00
Yanray Wang
1998aac349 logging_util: support to tweak loglevel directed to stderr/stdout
Previously we set loglevel >= WARNING printed to stderr and
loglevel < WARNING printed to stdout. To be more flexible, we
replace this `WARNING` value with an argument: split_level and leave
`WARNING` as default split_level if not set.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:22:34 +08:00
Yanray Wang
ee07afa205 code_size_compare: add option '--show-all'
When '--show-all' is enabled, all the objects will be displayed in
comparison result no matter if there is code size change or not.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:43:56 +08:00
Yanray Wang
b167320e27 code_size_compare: use '.md' suffix if '--markdown' enabled
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:24:17 +08:00
Yanray Wang
dcf360dd72 code_size_compare: track removed object as well
It makes sense to display code size changes if a file has been
removed in our library. With this commit we track old objects as
well. If a file is not present in the new Git revision,
we display -old_size in the new_size column. The size change is
marked as `Removed` to indicate the file has been removed.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:05:37 +08:00
Yanray Wang
4dfc132bcb code_size_compare: change format for comparison result
The result format for code size comparison is:

filename new(text) new(data) change(text) change(data)
yyy.o    xxx       xxx       xx           xx

The numbers followed are in bytes.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-27 10:47:21 +08:00
Yanray Wang
6f09267646 code_size_compare: remove column of percentage for code size change
Percentage is not a useful number when looking at code size changes.
Since it depends on the base of the code size. It might give
misleading information by simply looking at the numbers.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-27 10:19:38 +08:00
Yanray Wang
ca9a3cbc1d code_size_compare: detect architecture of x86_32 properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:21:10 +08:00
Yanray Wang
6ae94a0a72 code_size_compare: make sure _remove_worktree executed
Add try and finally to make sure we remove worktree as expected even
if we hit errors by accident.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:13:24 +08:00
Yanray Wang
9e8b671b1c code_size_compare: check --record-dir properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:37:29 +08:00
Yanray Wang
a279ca9ff8 code_size_compare: remove unnecessary -r in cp command
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:01:12 +08:00
Yanray Wang
6ef5049b9f code_size_compare: simplify some code for python dictionary
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:59:39 +08:00
Yanray Wang
15b1358f22 logging_util: rename argument
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:48:12 +08:00
Yanray Wang
68265f41d7 code_size_compare: use current as default new Git revision
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:45:00 +08:00
Yanray Wang
bef1acd7b8 code_size_compare: left align file names in markdown table
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 11:07:49 +08:00
Yanray Wang
ea842e791b code_size_compare: print prompt message under correct condition
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 11:03:11 +08:00
Yanray Wang
533cde22c0 code_size_compare: set log level as ERROR in option --stdout
If we use option --stdout, the logging level is set as
logging.ERROR. But --verbose is able to overwrite logging level as
logging.INFO if we want to display intermediate log in the process
of code size comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 10:27:10 +08:00
Yanray Wang
2ba9df2c1b code_size_compare: direct error message by logger.error
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 10:11:34 +08:00
Yanray Wang
e4a3636fac code_size_compare: add comments to make code more readable
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-25 10:37:12 +08:00
Yanray Wang
25bd331899 code_size_compare: round percentage to an integer value
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-25 10:24:23 +08:00
Yanray Wang
f2cd717952 code_size_compare: print 'None' if comparing size for a new file
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
69262fc087 code_size_compare: add extra indication if print to sys.stdout
If we output comparison result into sys.stdout, it will print an
extra line to show information we used for code size comparison in
detail. This would be helpful if we copy & paste code size changes
in Github comment.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
a6cf692e2a code_size_compare: simplify how to generate file name of code size
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
950590099d code_size_compare: simplify CodeSizeGeneratorWithSize
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
5605c6f58f code_size_compare: make CodeSizeBuildInfo more flexible
This commit changes how to infer make command. Although we haven't
supported to pass more options in command line, this is the
preparation work to support those features.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
955671b0ef code_size_compare: replace SimpleNameSpace to a clearer data struct
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
5b64e4c7e0 code_size_compare: clean up comments
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
386c2f9e93 code_size_compare: clean up code to make it more readable
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
21127f7095 code_size_compare: add logging module and tweak prompt message
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:12 +08:00
Yanray Wang
227576aaa4 code_size_compare: add option --stdout to show result in sys.stdout
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
b664cb7569 code_size_compare: add --markdown to show result in a markdown table
The option --markdown supports to only show the files that
have changed in a markdown table between two commits.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
9b174e90d3 code_size_compare: generate text,data as comparison result
Previously we used dec(total) as comparison result of code size
measurement. However, it's not accurate because dec(total) is
the sum of text, data and bss. Now we show text,data instead
since those are sections we care about in code size perspective
specifically for TF-M.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
802af160b4 code_size_compare: support to measure code size with multiple tools
For time being, code_size_compare.py only supports `size`. This
commit builds up foundation to extend code size measurement with
other tools.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
923f943a3e code_size_compare: introduce SimpleNamespace to store info
We use SimpleNamespace class to store all the information used to
measure code size of objects in library.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
5e9130a5e9 code_size_compare: simplify methods in CodeSizeComparison
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
e0e276046b code_size_compare: add CodeSizeCalculator to calculate code size
CodeSizeCalculator is aimed to calculate code size based on a Git
revision and code size measurement tool. The output of code size is
in utf-8 encoding.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
15c43f3407 code_size_compare: add a base class as CodeSizeGenerator
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
fc6ed4ddad code_size_compare: add a parser to generate code size with size tool
This commit splits CodeSizeBase as a separate class to prepare a
parser as CodeSizeGenerator. The benefit is we can extend the tool
of code size measurement in order to generate more types of code
size record.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Gilles Peskine
5647d06be8
Merge pull request #7518 from gilles-peskine-arm/psa_inject_entropy-file-stability
Fix and test MBEDTLS_PSA_INJECT_ENTROPY
2023-07-21 17:37:15 +02:00
Yanray Wang
699a6c8a6d code_size_compare.py: add comment for sys_arch
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-04 17:27:45 +08:00
Yanray Wang
4c26db0845 code_size_compare.py: run make clean before build libraries
If we don't remove all executable files in current working
directory, we might measure code size between different architecture
and configuration. This generates a wrong code size comparison
report. This commit guarantees it runs `make clean` before build
libraries for code size comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-04 17:27:45 +08:00
Tom Cosgrove
1940e7bae4
Merge pull request #7671 from yanrayw/7360-code-size-improve-format
code size: improve format of csv file
2023-07-04 09:15:48 +01:00
Dave Rodgman
38939f705a
Merge pull request #7822 from gilles-peskine-arm/code-style-since
code_style.py --since
2023-06-30 11:37:02 +01:00
Paul Elliott
92a55bf5ea
Merge pull request #7793 from minosgalanakis/ecp/6025_fast_reduction_dispatch
[Bignum] Fast reduction dispatch
2023-06-28 17:38:37 +01:00
Minos Galanakis
dae4c038f8 ecp.py: Extended EcpP224K1Raw tests for 32/64 bit architectures.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 18:54:53 +01:00
Minos Galanakis
80c4ae893c bignum_common.py: Added bits_to_limbs method.
This patch introduces a rounding-error-resiliant method to
calculate bits_to_limbs, and is updating `SECP224R1` and
`SECP224K1` to use it.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 16:38:22 +01:00
Gilles Peskine
717a83164e
Merge pull request #7807 from gilles-peskine-arm/mbedtls_ssl_protocol_version_str-no_array
Fix very high stack usage in SSL debug code
2023-06-26 09:36:53 +02:00
Gilles Peskine
163ec4090e Handle deleted files correctly
Don't attempt to run on a file that isn't present now.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-25 22:18:40 +02:00
Gilles Peskine
9d7b24fb26 Fix extra character in debug string
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-23 21:11:46 +02:00
Gilles Peskine
43838b8a24 Add --since option to check files modified since a given commit
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-22 20:31:02 +02:00