Commit graph

67 commits

Author SHA1 Message Date
Yanray Wang
30769696e7 Merge remote-tracking branch 'origin/development' into adjust_tfm_configs 2023-11-08 10:00:24 +08:00
Dave Rodgman
16799db69a update headers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-02 19:47:20 +00:00
Yanray Wang
08e9423f14 Merge remote-tracking branch 'origin/development' into adjust_tfm_configs 2023-10-19 17:44:47 +08:00
Thomas Daubney
540324cd21 Correct styling of Mbed TLS in documentation
Several bits of documentation were incorrectly styling Mbed TLS
as MbedTLS.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-06 17:07:24 +01:00
Yanray Wang
2864823671 configs: move TFM config to a subdirectory
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-09-26 17:15:52 +08:00
Yanray Wang
bc775c48c9 code_size_compare: handle deleted files and new files properly
'Removed' and 'NotCreated' should be displayed in new and old column
respectively. The value of delta is reflected on change column. This
commit handles the corner cases properly.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-16 16:08:22 +08:00
Yanray Wang
8a25e6fdb2 code_size_compare: add old text and data section in CSV output
To keep a concise markdown table, we don't list text and data
section from old Git revision. However, it should be ideal to keep
those two sections in CSV output. Therefore, we list comparison
result for CSV output in following format:

 filename new(text) new(data) old(text) old(data) change(text) change(data)

Additionally, if a file only exits in new Git revision not in old
Git revision, it's marked as `NotCreated` as we haven't created this
file yet from perspective of old Git revision.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 15:22:36 +08:00
Yanray Wang
0de1183e4c code_size_compare: add + in front of positive values
In comparison result, to indicate it's a delta value, we add `+` in
front of positive values. For unchanged attributes, it's still
shown as `0'.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:58:48 +08:00
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
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
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
Yanray Wang
c7a2a6d11d code_size_compare.py: change prompt message in code size measurement
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
72b105f1ae code_size_compare: clarify input and return types
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
8804db9d99 code_size_compare.py: integrate code with CodeSizeBase
The code size measurement script generates code size
record / comparison csv file in a more readable format.

The script won't generate new record file if there is an existing
one. It reads the record and stores data into dictionary of code_size
for comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00