Alembic: addition of a scope timer to perform basic profiling.
This commit is contained in:
parent
8c5826f59a
commit
a0b8a9fe68
Notes:
blender-bot
2023-02-13 12:02:01 +01:00
Referenced by commit5c3216e233
, Fix compiling aftera0b8a9f
|
@ -37,6 +37,8 @@ extern "C" {
|
|||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "PIL_time.h"
|
||||
}
|
||||
|
||||
std::string get_id_name(Object *ob)
|
||||
|
@ -523,3 +525,15 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe
|
|||
|
||||
return reader;
|
||||
}
|
||||
|
||||
/* ********************** */
|
||||
|
||||
ScopeTimer::ScopeTimer(const char *message)
|
||||
: m_message(message)
|
||||
, m_start(PIL_check_seconds_timer())
|
||||
{}
|
||||
|
||||
ScopeTimer::~ScopeTimer()
|
||||
{
|
||||
std::fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start);
|
||||
}
|
||||
|
|
|
@ -146,4 +146,23 @@ ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
|
|||
yup[2] = -zup[1];
|
||||
}
|
||||
|
||||
/* *************************** */
|
||||
|
||||
#undef ABC_DEBUG_TIME
|
||||
|
||||
class ScopeTimer {
|
||||
const char *m_message;
|
||||
double m_start;
|
||||
|
||||
public:
|
||||
ScopeTimer(const char *message);
|
||||
~ScopeTimer();
|
||||
};
|
||||
|
||||
#ifdef ABC_DEBUG_TIME
|
||||
# define SCOPE_TIMER(message) ScopeTimer prof(message)
|
||||
#else
|
||||
# define SCOPE_TIMER(message)
|
||||
#endif
|
||||
|
||||
#endif /* __ABC_UTIL_H__ */
|
||||
|
|
|
@ -542,6 +542,8 @@ ABC_INLINE bool is_mesh_and_strands(const IObject &object)
|
|||
|
||||
static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
|
||||
{
|
||||
SCOPE_TIMER("Alembic import, objects reading and creation");
|
||||
|
||||
ImportJobData *data = static_cast<ImportJobData *>(user_data);
|
||||
|
||||
data->stop = stop;
|
||||
|
@ -677,6 +679,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
|
|||
|
||||
static void import_endjob(void *user_data)
|
||||
{
|
||||
SCOPE_TIMER("Alembic import, cleanup");
|
||||
|
||||
ImportJobData *data = static_cast<ImportJobData *>(user_data);
|
||||
|
||||
std::vector<AbcObjectReader *>::iterator iter;
|
||||
|
|
Loading…
Reference in New Issue