1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

wip mem profiling, DO NOT USE

This commit is contained in:
M1nd3r 2024-10-21 15:54:04 +02:00
parent 31c3c5c896
commit 1799386c78
3 changed files with 18 additions and 1 deletions

View File

@ -438,7 +438,6 @@ jobs:
core_memory_profile:
name: Memory allocation report
if: false # NOTE manual job, comment out to run
runs-on: ubuntu-latest
env:
TREZOR_MODEL: T

View File

@ -93,6 +93,16 @@ async def sign_tx(
request_class, req = req
assert TxRequest.is_type_of(req)
if req.request_type == RequestType.TXFINISHED:
try:
import micropython
print("micropython.mem_info() from received_message_handler.py")
micropython.mem_info()
print("Allocation count:", micropython.alloc_count()) # type: ignore ["alloc_count" is not a known attribute of module]
except AttributeError:
print(
"To show allocation count, create the build with TREZOR_MEMPERF=1"
)
return req
res = await call(req, request_class)
elif isinstance(req, helpers.UiConfirm):

View File

@ -13,6 +13,8 @@
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import time
import warnings
from copy import copy
from decimal import Decimal
@ -358,7 +360,12 @@ def sign_tx(
)
R = messages.RequestType
start2 = time.time()
end2 = time.time()
while isinstance(res, messages.TxRequest):
print(end2 - start2)
start2 = time.time()
# If there's some part of signed transaction, let's add it
if res.serialized:
if res.serialized.serialized_tx:
@ -420,6 +427,7 @@ def sign_tx(
)
res = session.call(messages.TxAck(tx=msg))
end2 = time.time()
if not isinstance(res, messages.TxRequest):
raise exceptions.TrezorException("Unexpected message")