Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-07-01 12:17:50 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-07-01 12:17:50 +0300
commite7a21275c0f1bfb0e8bbeda384e5b46131e48b93 (patch)
tree91d9cd8f1dba9a35b0a51a51f344975f9e99ee3d /source/blender/io/usd/intern/usd_capi_export.cc
parent4527dd1ce4784292cd3b8dd3764b9cd843020f9a (diff)
IO: print import & export times of Alembic & USD
Many existing importers/exporters do log the time it takes to system console (some others log more information too). In particular, OBJ (C++ & python), STL (C++ & python), PLY, glTF2 all log the time it takes. However, neither USD nor Alembic do. And also it's harder to know the time it takes there from a profiler, since all the work normally is done on a background job and is split between several threads (so you can't just find some top-level function and see how much time it took). This change: - Adds import/export time logging to USD & Alembic importer/exporter, - In the time utility class (also used by OBJ & STL), improve the output formatting: 1) print only one decimal digit, 2) for long times, print seconds and also produce a hours:minutes:seconds form. Reviewed By: Michael Kowalski, Kévin Dietrich Differential Revision: https://developer.blender.org/D15170
Diffstat (limited to 'source/blender/io/usd/intern/usd_capi_export.cc')
-rw-r--r--source/blender/io/usd/intern/usd_capi_export.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/io/usd/intern/usd_capi_export.cc b/source/blender/io/usd/intern/usd_capi_export.cc
index d9995117b70..1033f85181c 100644
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@ -27,6 +27,7 @@
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
+#include "BLI_timeit.hh"
#include "WM_api.h"
#include "WM_types.h"
@@ -42,8 +43,17 @@ struct ExportJobData {
USDExportParams params;
bool export_ok;
+ timeit::TimePoint start_time;
};
+static void report_job_duration(const ExportJobData *data)
+{
+ timeit::Nanoseconds duration = timeit::Clock::now() - data->start_time;
+ std::cout << "USD export of '" << data->filepath << "' took ";
+ timeit::print_duration(duration);
+ std::cout << '\n';
+}
+
static void export_startjob(void *customdata,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
@@ -53,6 +63,7 @@ static void export_startjob(void *customdata,
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
data->export_ok = false;
+ data->start_time = timeit::Clock::now();
G.is_rendering = true;
WM_set_locked_interface(data->wm, true);
@@ -151,6 +162,7 @@ static void export_endjob(void *customdata)
G.is_rendering = false;
WM_set_locked_interface(data->wm, false);
+ report_job_duration(data);
}
} // namespace blender::io::usd