mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
wip mem profiling, DO NOT USE
This commit is contained in:
parent
31c3c5c896
commit
1799386c78
1
.github/workflows/core.yml
vendored
1
.github/workflows/core.yml
vendored
@ -438,7 +438,6 @@ jobs:
|
|||||||
|
|
||||||
core_memory_profile:
|
core_memory_profile:
|
||||||
name: Memory allocation report
|
name: Memory allocation report
|
||||||
if: false # NOTE manual job, comment out to run
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TREZOR_MODEL: T
|
TREZOR_MODEL: T
|
||||||
|
@ -93,6 +93,16 @@ async def sign_tx(
|
|||||||
request_class, req = req
|
request_class, req = req
|
||||||
assert TxRequest.is_type_of(req)
|
assert TxRequest.is_type_of(req)
|
||||||
if req.request_type == RequestType.TXFINISHED:
|
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
|
return req
|
||||||
res = await call(req, request_class)
|
res = await call(req, request_class)
|
||||||
elif isinstance(req, helpers.UiConfirm):
|
elif isinstance(req, helpers.UiConfirm):
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the License along with this library.
|
# 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>.
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||||
|
|
||||||
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
@ -358,7 +360,12 @@ def sign_tx(
|
|||||||
)
|
)
|
||||||
|
|
||||||
R = messages.RequestType
|
R = messages.RequestType
|
||||||
|
start2 = time.time()
|
||||||
|
end2 = time.time()
|
||||||
|
|
||||||
while isinstance(res, messages.TxRequest):
|
while isinstance(res, messages.TxRequest):
|
||||||
|
print(end2 - start2)
|
||||||
|
start2 = time.time()
|
||||||
# If there's some part of signed transaction, let's add it
|
# If there's some part of signed transaction, let's add it
|
||||||
if res.serialized:
|
if res.serialized:
|
||||||
if res.serialized.serialized_tx:
|
if res.serialized.serialized_tx:
|
||||||
@ -420,6 +427,7 @@ def sign_tx(
|
|||||||
)
|
)
|
||||||
|
|
||||||
res = session.call(messages.TxAck(tx=msg))
|
res = session.call(messages.TxAck(tx=msg))
|
||||||
|
end2 = time.time()
|
||||||
|
|
||||||
if not isinstance(res, messages.TxRequest):
|
if not isinstance(res, messages.TxRequest):
|
||||||
raise exceptions.TrezorException("Unexpected message")
|
raise exceptions.TrezorException("Unexpected message")
|
||||||
|
Loading…
Reference in New Issue
Block a user