mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Put slice-time in slice-data-sharing.
part of CURA-10299
This commit is contained in:
parent
5970524b3a
commit
4efa8e3ab4
3 changed files with 61 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2021 Ultimaker B.V.
|
||||
# Copyright (c) 2023 UltiMaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import json
|
||||
|
@ -27,7 +27,7 @@ catalog = i18nCatalog("cura")
|
|||
|
||||
|
||||
class SliceInfo(QObject, Extension):
|
||||
"""This Extension runs in the background and sends several bits of information to the Ultimaker servers.
|
||||
"""This Extension runs in the background and sends several bits of information to the UltiMaker servers.
|
||||
|
||||
The data is only sent when the user in question gave permission to do so. All data is anonymous and
|
||||
no model files are being sent (Just a SHA256 hash of the model).
|
||||
|
@ -277,6 +277,26 @@ class SliceInfo(QObject, Extension):
|
|||
# Send the name of the output device type that is used.
|
||||
data["output_to"] = type(output_device).__name__
|
||||
|
||||
# Engine Statistics (Slicing Time, ...)
|
||||
# Call it backend-time, sice we might want to get the actual slice time from the engine itself,
|
||||
# to also identify problems in between the users pressing the button and the engine actually starting
|
||||
# (and the other way around with data that arrives back from the engine).
|
||||
time_setup = 0.0
|
||||
time_backend = 0.0
|
||||
if not print_information.preSliced:
|
||||
backend_info = self._application.getBackend().resetAndReturnLastSliceTimeStats()
|
||||
time_start_process = backend_info["time_start_process"]
|
||||
time_send_message = backend_info["time_send_message"]
|
||||
time_end_slice = backend_info["time_end_slice"]
|
||||
if time_start_process and time_send_message and time_end_slice:
|
||||
time_setup = time_send_message - time_start_process
|
||||
time_backend = time_end_slice - time_send_message
|
||||
data["engine_stats"] = {
|
||||
"is_presliced": int(print_information.preSliced),
|
||||
"time_setup": int(round(time_setup)),
|
||||
"time_backend": int(round(time_backend)),
|
||||
}
|
||||
|
||||
# Convert data to bytes
|
||||
binary_data = json.dumps(data).encode("utf-8")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue