diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc index 493735d6f42..9f98a696285 100644 --- a/source/blender/blenkernel/intern/blendfile.cc +++ b/source/blender/blenkernel/intern/blendfile.cc @@ -24,10 +24,9 @@ #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_system.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "IMB_colormanagement.h" #include "BKE_addon.h" @@ -942,7 +941,7 @@ static void setup_app_data(bContext *C, BLI_assert(BKE_main_namemap_validate(bmain)); if (mode != LOAD_UNDO && !USER_EXPERIMENTAL_TEST(&U, no_override_auto_resync)) { - reports->duration.lib_overrides_resync = PIL_check_seconds_timer(); + reports->duration.lib_overrides_resync = BLI_check_seconds_timer(); BKE_lib_override_library_main_resync( bmain, @@ -950,7 +949,7 @@ static void setup_app_data(bContext *C, bfd->cur_view_layer ? bfd->cur_view_layer : BKE_view_layer_default_view(curscene), reports); - reports->duration.lib_overrides_resync = PIL_check_seconds_timer() - + reports->duration.lib_overrides_resync = BLI_check_seconds_timer() - reports->duration.lib_overrides_resync; /* We need to rebuild some of the deleted override rules (for UI feedback purpose). */ diff --git a/source/blender/blenkernel/intern/cloth.cc b/source/blender/blenkernel/intern/cloth.cc index cceca4eaf11..199e67634d6 100644 --- a/source/blender/blenkernel/intern/cloth.cc +++ b/source/blender/blenkernel/intern/cloth.cc @@ -38,7 +38,7 @@ #include "SIM_mass_spring.h" -// #include "PIL_time.h" /* timing for debug prints */ +// #include "BLI_time.h" /* timing for debug prints */ /* ********** cloth engine ******* */ /* Prototypes for internal functions. diff --git a/source/blender/blenkernel/intern/effect.cc b/source/blender/blenkernel/intern/effect.cc index 3e349614911..223877a410e 100644 --- a/source/blender/blenkernel/intern/effect.cc +++ b/source/blender/blenkernel/intern/effect.cc @@ -33,10 +33,9 @@ #include "BLI_math_vector.h" #include "BLI_noise.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BKE_anim_path.h" /* needed for where_on_path */ #include "BKE_bvhutils.hh" #include "BKE_collection.h" @@ -85,7 +84,7 @@ PartDeflect *BKE_partdeflect_new(int type) pd->pdef_sbift = 0.2f; pd->pdef_sboft = 0.02f; pd->pdef_cfrict = 5.0f; - pd->seed = (uint(ceil(PIL_check_seconds_timer())) + 1) % 128; + pd->seed = (uint(ceil(BLI_check_seconds_timer())) + 1) % 128; pd->f_strength = 1.0f; pd->f_damp = 1.0f; diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 90fca88530f..5f8ec5c85fa 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -56,6 +56,7 @@ #include "BLI_system.h" #include "BLI_task.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_timecode.h" /* For stamp time-code format. */ #include "BLI_utildefines.h" @@ -81,8 +82,6 @@ #include "BLF_api.h" -#include "PIL_time.h" - #include "RE_pipeline.h" #include "SEQ_utils.hh" /* SEQ_get_topmost_sequence() */ @@ -1485,7 +1484,7 @@ void BKE_image_packfiles_from_mem(ReportList *reports, void BKE_image_tag_time(Image *ima) { - ima->lastused = PIL_check_seconds_timer_i(); + ima->lastused = BLI_check_seconds_timer_i(); } static uintptr_t image_mem_size(Image *image) diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc index 1165a98c529..f858fe739a5 100644 --- a/source/blender/blenkernel/intern/image_gpu.cc +++ b/source/blender/blenkernel/intern/image_gpu.cc @@ -13,6 +13,7 @@ #include "BLI_linklist.h" #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "DNA_image_types.h" #include "DNA_userdef_types.h" @@ -30,8 +31,6 @@ #include "GPU_state.h" #include "GPU_texture.h" -#include "PIL_time.h" - using namespace blender::bke::image::partial_update; extern "C" { @@ -572,7 +571,7 @@ void BKE_image_free_anim_gputextures(Main *bmain) void BKE_image_free_old_gputextures(Main *bmain) { static int lasttime = 0; - int ctime = int(PIL_check_seconds_timer()); + int ctime = int(BLI_check_seconds_timer()); /* * Run garbage collector once for every collecting period of time diff --git a/source/blender/blenkernel/intern/lib_id.cc b/source/blender/blenkernel/intern/lib_id.cc index e13d89c9a9a..4fcf6847471 100644 --- a/source/blender/blenkernel/intern/lib_id.cc +++ b/source/blender/blenkernel/intern/lib_id.cc @@ -74,7 +74,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif static CLG_LogRef LOG = {"bke.lib_id"}; diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc index ba591cc3699..eef5bb2343a 100644 --- a/source/blender/blenkernel/intern/lib_override.cc +++ b/source/blender/blenkernel/intern/lib_override.cc @@ -53,11 +53,10 @@ #include "BLI_set.hh" #include "BLI_string.h" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "RNA_access.hh" #include "RNA_path.hh" #include "RNA_prototypes.h" @@ -70,7 +69,7 @@ // #define DEBUG_OVERRIDE_TIMEIT #ifdef DEBUG_OVERRIDE_TIMEIT -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif static CLG_LogRef LOG = {"bke.liboverride"}; @@ -3171,7 +3170,7 @@ static bool lib_override_library_main_resync_on_library_indirect_level( BlendFileReadReport *reports) { const bool do_reports_recursive_resync_timing = (library_indirect_level != 0); - const double init_time = do_reports_recursive_resync_timing ? PIL_check_seconds_timer() : 0.0; + const double init_time = do_reports_recursive_resync_timing ? BLI_check_seconds_timer() : 0.0; BKE_main_relations_create(bmain, 0); BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); @@ -3477,7 +3476,7 @@ static bool lib_override_library_main_resync_on_library_indirect_level( BKE_lib_override_library_main_hierarchy_root_ensure(bmain); if (do_reports_recursive_resync_timing) { - reports->duration.lib_overrides_recursive_resync += PIL_check_seconds_timer() - init_time; + reports->duration.lib_overrides_recursive_resync += BLI_check_seconds_timer() - init_time; } return process_lib_level_again; diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 9977c99a9aa..e18f582ac2d 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -35,6 +35,7 @@ #include "BLI_span.hh" #include "BLI_string.h" #include "BLI_task.hh" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_vector.hh" #include "BLI_virtual_array.hh" @@ -62,8 +63,6 @@ #include "BKE_multires.hh" #include "BKE_object.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "DEG_depsgraph_query.hh" @@ -96,7 +95,7 @@ static void mesh_init_data(ID *id) mesh->runtime = new blender::bke::MeshRuntime(); - mesh->face_sets_color_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX); + mesh->face_sets_color_seed = BLI_hash_int(BLI_check_seconds_timer_i() & UINT_MAX); } static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 52458ae9ae3..af0695d5fd2 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -44,6 +44,7 @@ #include "BLI_string_utf8.h" #include "BLI_string_utils.hh" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_vector_set.hh" #include "BLT_translation.h" @@ -95,8 +96,6 @@ #include "BLO_read_write.hh" -#include "PIL_time.h" - #define NODE_DEFAULT_MAX_WIDTH 700 using blender::Array; @@ -2508,7 +2507,7 @@ void nodeUniqueName(bNodeTree *ntree, bNode *node) void nodeUniqueID(bNodeTree *ntree, bNode *node) { /* Use a pointer cast to avoid overflow warnings. */ - const double time = PIL_check_seconds_timer() * 1000000.0; + const double time = BLI_check_seconds_timer() * 1000000.0; blender::RandomNumberGenerator id_rng{*reinterpret_cast(&time)}; /* In the unlikely case that the random ID doesn't match, choose a new one until it does. */ diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index 43eb4710da4..5174d3615cf 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -8,11 +8,10 @@ #include "BLI_rand.hh" #include "BLI_set.hh" #include "BLI_stack.hh" +#include "BLI_time.h" #include "BLI_timeit.hh" #include "BLI_vector_set.hh" -#include "PIL_time.h" - #include "DNA_anim_types.h" #include "DNA_modifier_types.h" #include "DNA_node_types.h" diff --git a/source/blender/blenkernel/intern/particle_system.cc b/source/blender/blenkernel/intern/particle_system.cc index 4f7bd65208e..f690b9cd920 100644 --- a/source/blender/blenkernel/intern/particle_system.cc +++ b/source/blender/blenkernel/intern/particle_system.cc @@ -41,6 +41,7 @@ #include "BLI_string_utils.hh" #include "BLI_task.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_animsys.h" @@ -70,8 +71,6 @@ #include "DEG_depsgraph_physics.hh" #include "DEG_depsgraph_query.hh" -#include "PIL_time.h" - #include "RE_texture.h" /* FLUID sim particle import */ diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc index 70826981c5f..439ebb671f7 100644 --- a/source/blender/blenkernel/intern/pbvh.cc +++ b/source/blender/blenkernel/intern/pbvh.cc @@ -22,6 +22,7 @@ #include "BLI_rand.h" #include "BLI_task.h" #include "BLI_task.hh" +#include "BLI_time.h" #include "BLI_timeit.hh" #include "BLI_utildefines.h" #include "BLI_vector.hh" @@ -37,8 +38,6 @@ #include "DRW_pbvh.hh" -#include "PIL_time.h" - #include "bmesh.hh" #include "atomic_ops.h" diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.cc b/source/blender/blenkernel/intern/pbvh_bmesh.cc index 20456dfebd4..078e4774d21 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.cc +++ b/source/blender/blenkernel/intern/pbvh_bmesh.cc @@ -16,6 +16,7 @@ #include "BLI_math_vector.hh" #include "BLI_memarena.h" #include "BLI_span.hh" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_DerivedMesh.hh" @@ -27,8 +28,6 @@ #include "bmesh.hh" #include "pbvh_intern.hh" -#include "PIL_time.h" - #include "CLG_log.h" static CLG_LogRef LOG = {"pbvh.bmesh"}; @@ -1225,7 +1224,7 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *pbvh, BMEdge * static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh) { - const double start_time = PIL_check_seconds_timer(); + const double start_time = BLI_check_seconds_timer(); bool any_subdivided = false; @@ -1268,7 +1267,7 @@ static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh #endif CLOG_INFO( - &LOG, 2, "Long edge subdivision took %f seconds.", PIL_check_seconds_timer() - start_time); + &LOG, 2, "Long edge subdivision took %f seconds.", BLI_check_seconds_timer() - start_time); return any_subdivided; } @@ -1702,7 +1701,7 @@ static void pbvh_bmesh_collapse_edge( static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh) { - const double start_time = PIL_check_seconds_timer(); + const double start_time = BLI_check_seconds_timer(); const float min_len_squared = pbvh->bm_min_edge_len * pbvh->bm_min_edge_len; bool any_collapsed = false; @@ -1753,7 +1752,7 @@ static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh BLI_ghash_free(deleted_verts, nullptr, nullptr); CLOG_INFO( - &LOG, 2, "Short edge collapse took %f seconds.", PIL_check_seconds_timer() - start_time); + &LOG, 2, "Short edge collapse took %f seconds.", BLI_check_seconds_timer() - start_time); return any_collapsed; } diff --git a/source/blender/blenkernel/intern/pbvh_colors.cc b/source/blender/blenkernel/intern/pbvh_colors.cc index b935fef6922..c508c3716e0 100644 --- a/source/blender/blenkernel/intern/pbvh_colors.cc +++ b/source/blender/blenkernel/intern/pbvh_colors.cc @@ -16,6 +16,7 @@ #include "BLI_rand.h" #include "BLI_span.hh" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "DNA_mesh_types.h" @@ -29,8 +30,6 @@ #include "BKE_pbvh_api.hh" #include "BKE_subdiv_ccg.hh" -#include "PIL_time.h" - #include "bmesh.hh" #include "atomic_ops.h" diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index b5445f40117..65184058bca 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -16,8 +16,7 @@ #include "BLI_math_geom.h" #include "BLI_math_vector.h" #include "BLI_task.h" - -#include "PIL_time.h" +#include "BLI_time.h" #include "BKE_global.h" #include "BKE_image_wrappers.hh" diff --git a/source/blender/blenkernel/intern/pointcache.cc b/source/blender/blenkernel/intern/pointcache.cc index d67bdd460cb..939167af0e9 100644 --- a/source/blender/blenkernel/intern/pointcache.cc +++ b/source/blender/blenkernel/intern/pointcache.cc @@ -39,12 +39,11 @@ #include "BLI_math_rotation.h" #include "BLI_math_vector.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "BKE_appdir.h" #include "BKE_cloth.hh" #include "BKE_collection.h" @@ -3297,7 +3296,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) char run[32], cur[32], etd[32]; int cancel = 0; - stime = ptime = PIL_check_seconds_timer(); + stime = ptime = BLI_check_seconds_timer(); for (int fr = scene->r.cfra; fr <= endframe; fr += baker->quick_step, scene->r.cfra = fr) { BKE_scene_graph_update_for_newframe(depsgraph); @@ -3311,7 +3310,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) printf("bake: frame %d :: %d\n", scene->r.cfra, endframe); } else { - ctime = PIL_check_seconds_timer(); + ctime = BLI_check_seconds_timer(); fetd = (ctime - ptime) * (endframe - scene->r.cfra) / baker->quick_step; @@ -3343,7 +3342,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) if (use_timer) { /* start with newline because of \r above */ - ptcache_dt_to_str(run, sizeof(run), PIL_check_seconds_timer() - stime); + ptcache_dt_to_str(run, sizeof(run), BLI_check_seconds_timer() - stime); printf("\nBake %s %s (%i frames simulated).\n", (cancel ? "canceled after" : "finished in"), run, diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 5ad253089d6..24774164957 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -46,6 +46,7 @@ #include "BLI_string_utils.hh" #include "BLI_task.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLO_readfile.h" @@ -109,8 +110,6 @@ #include "engines/eevee/eevee_lightcache.h" -#include "PIL_time.h" - #include "IMB_colormanagement.h" #include "IMB_imbuf.h" diff --git a/source/blender/blenkernel/intern/shrinkwrap.cc b/source/blender/blenkernel/intern/shrinkwrap.cc index b067dee30b5..74706fa6cc2 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.cc +++ b/source/blender/blenkernel/intern/shrinkwrap.cc @@ -49,7 +49,7 @@ /* for timing... */ #if 0 -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #else # define TIMEIT_BENCH(expr, id) (expr) #endif diff --git a/source/blender/blenkernel/intern/softbody.cc b/source/blender/blenkernel/intern/softbody.cc index 50609d99fc1..2661dd24b79 100644 --- a/source/blender/blenkernel/intern/softbody.cc +++ b/source/blender/blenkernel/intern/softbody.cc @@ -47,6 +47,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_vector.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_collection.h" @@ -66,8 +67,6 @@ #include "DEG_depsgraph.hh" #include "DEG_depsgraph_query.hh" -#include "PIL_time.h" - static CLG_LogRef LOG = {"bke.softbody"}; /* callbacks for errors and interrupts and some goo */ @@ -3358,7 +3357,7 @@ static void softbody_step( float forcetime; double sct, sst; - sst = PIL_check_seconds_timer(); + sst = BLI_check_seconds_timer(); /* Integration back in time is possible in theory, but pretty useless here. * So we refuse to do so. Since we do not know anything about 'outside' changes * especially colliders we refuse to go more than 10 frames. @@ -3454,7 +3453,7 @@ static void softbody_step( } loops++; if (sb->solverflags & SBSO_MONITOR) { - sct = PIL_check_seconds_timer(); + sct = BLI_check_seconds_timer(); if (sct - sst > 0.5) { printf("%3.0f%% \r", 100.0f * timedone / dtime); } @@ -3495,7 +3494,7 @@ static void softbody_step( } if (sb->solverflags & SBSO_MONITOR) { - sct = PIL_check_seconds_timer(); + sct = BLI_check_seconds_timer(); if ((sct - sst > 0.5) || (G.debug & G_DEBUG)) { printf(" solver time %f sec %s\n", sct - sst, ob->id.name); } diff --git a/source/blender/blenkernel/intern/subdiv_stats.cc b/source/blender/blenkernel/intern/subdiv_stats.cc index a8387c120ee..1aa58661f2d 100644 --- a/source/blender/blenkernel/intern/subdiv_stats.cc +++ b/source/blender/blenkernel/intern/subdiv_stats.cc @@ -10,7 +10,7 @@ #include -#include "PIL_time.h" +#include "BLI_time.h" void BKE_subdiv_stats_init(SubdivStats *stats) { @@ -26,12 +26,12 @@ void BKE_subdiv_stats_init(SubdivStats *stats) void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value) { - stats->begin_timestamp_[value] = PIL_check_seconds_timer(); + stats->begin_timestamp_[value] = BLI_check_seconds_timer(); } void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value) { - stats->values_[value] = PIL_check_seconds_timer() - stats->begin_timestamp_[value]; + stats->values_[value] = BLI_check_seconds_timer() - stats->begin_timestamp_[value]; } void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value) diff --git a/source/blender/blenkernel/intern/tracking_auto.cc b/source/blender/blenkernel/intern/tracking_auto.cc index 88d89ea8655..89eeab37cea 100644 --- a/source/blender/blenkernel/intern/tracking_auto.cc +++ b/source/blender/blenkernel/intern/tracking_auto.cc @@ -18,8 +18,8 @@ #include "BLI_math_vector.h" #include "BLI_task.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" #include "BKE_global.h" #include "BKE_movieclip.h" diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/BLI_time.h similarity index 80% rename from source/blender/blenlib/PIL_time.h rename to source/blender/blenlib/BLI_time.h index 03681d6d31c..b4529d9c7f3 100644 --- a/source/blender/blenlib/PIL_time.h +++ b/source/blender/blenlib/BLI_time.h @@ -19,18 +19,18 @@ extern * are guaranteed to generate values greater than or * equal to the last call. */ double - PIL_check_seconds_timer(void); + BLI_check_seconds_timer(void); extern - /** `int` version of #PIL_check_seconds_timer. */ + /** `int` version of #BLI_check_seconds_timer. */ long int - PIL_check_seconds_timer_i(void); + BLI_check_seconds_timer_i(void); /** * Platform-independent sleep function. * \param ms: Number of milliseconds to sleep */ -void PIL_sleep_ms(int ms); +void BLI_sleep_ms(int ms); #ifdef __cplusplus } diff --git a/source/blender/blenlib/PIL_time_utildefines.h b/source/blender/blenlib/BLI_time_utildefines.h similarity index 86% rename from source/blender/blenlib/PIL_time_utildefines.h rename to source/blender/blenlib/BLI_time_utildefines.h index 275410ec36d..0daa80222a6 100644 --- a/source/blender/blenlib/PIL_time_utildefines.h +++ b/source/blender/blenlib/BLI_time_utildefines.h @@ -9,12 +9,12 @@ #pragma once +#include "BLI_time.h" /* for BLI_check_seconds_timer */ #include "BLI_utildefines.h" /* for AT */ -#include "PIL_time.h" /* for PIL_check_seconds_timer */ #define TIMEIT_START(var) \ { \ - double _timeit_##var = PIL_check_seconds_timer(); \ + double _timeit_##var = BLI_check_seconds_timer(); \ printf("time start (" #var "): " AT "\n"); \ fflush(stdout); \ { \ @@ -23,7 +23,7 @@ /** * \return the time since TIMEIT_START was called. */ -#define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var) +#define TIMEIT_VALUE(var) (float)(BLI_check_seconds_timer() - _timeit_##var) #define TIMEIT_VALUE_PRINT(var) \ { \ @@ -54,7 +54,7 @@ { \ static float _sum_##var = 0.0f; \ static float _num_##var = 0.0f; \ - double _timeit_##var = PIL_check_seconds_timer(); \ + double _timeit_##var = BLI_check_seconds_timer(); \ printf("time start (" #var "): " AT "\n"); \ fflush(stdout); \ { \ @@ -95,13 +95,13 @@ #define TIMEIT_BLOCK_START(id) \ { \ - double _timeit_block_start_##id = PIL_check_seconds_timer(); \ + double _timeit_block_start_##id = BLI_check_seconds_timer(); \ { \ (void)0 #define TIMEIT_BLOCK_END(id) \ } \ - _timeit_var_##id += (PIL_check_seconds_timer() - _timeit_block_start_##id); \ + _timeit_var_##id += (BLI_check_seconds_timer() - _timeit_block_start_##id); \ } \ (void)0 diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 98dcc14e50d..5a2a3a0865c 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -363,6 +363,8 @@ set(SRC BLI_task.hh BLI_tempfile.h BLI_threads.h + BLI_time.h + BLI_time_utildefines.h BLI_timecode.h BLI_timeit.hh BLI_timer.h @@ -383,8 +385,6 @@ set(SRC BLI_voxel.h BLI_winstuff.h BLI_winstuff_com.hh - PIL_time.h - PIL_time_utildefines.h # Without these files listed, they aren't known to CMake. ../../../extern/json/include/json.hpp diff --git a/source/blender/blenlib/intern/BLI_timer.c b/source/blender/blenlib/intern/BLI_timer.c index fedb6e78bc4..2a308207931 100644 --- a/source/blender/blenlib/intern/BLI_timer.c +++ b/source/blender/blenlib/intern/BLI_timer.c @@ -8,11 +8,11 @@ #include "BLI_timer.h" #include "BLI_listbase.h" +#include "BLI_time.h" #include "MEM_guardedalloc.h" -#include "PIL_time.h" -#define GET_TIME() PIL_check_seconds_timer() +#define GET_TIME() BLI_check_seconds_timer() typedef struct TimedFunction { struct TimedFunction *next, *prev; diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index a3a95674328..7fa8c862f28 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -29,11 +29,10 @@ # include "BLI_span.hh" # include "BLI_stack.hh" # include "BLI_task.hh" +# include "BLI_time.h" # include "BLI_vector.hh" # include "BLI_vector_set.hh" -# include "PIL_time.h" - # include "BLI_mesh_boolean.hh" # ifdef WITH_TBB @@ -3560,7 +3559,7 @@ IMesh boolean_trimesh(IMesh &tm_in, return IMesh(tm_in); } # ifdef PERFDEBUG - double start_time = PIL_check_seconds_timer(); + double start_time = BLI_check_seconds_timer(); std::cout << " boolean_trimesh, timing begins\n"; # endif @@ -3570,7 +3569,7 @@ IMesh boolean_trimesh(IMesh &tm_in, std::cout << "\nboolean_tm_input after intersection:\n" << tm_si; } # ifdef PERFDEBUG - double intersect_time = PIL_check_seconds_timer(); + double intersect_time = BLI_check_seconds_timer(); std::cout << " intersected, time = " << intersect_time - start_time << "\n"; # endif @@ -3581,12 +3580,12 @@ IMesh boolean_trimesh(IMesh &tm_in, auto si_shape_fn = [shape_fn, tm_si](int t) { return shape_fn(tm_si.face(t)->orig); }; TriMeshTopology tm_si_topo(tm_si); # ifdef PERFDEBUG - double topo_time = PIL_check_seconds_timer(); + double topo_time = BLI_check_seconds_timer(); std::cout << " topology built, time = " << topo_time - intersect_time << "\n"; # endif bool pwn = is_pwn(tm_si, tm_si_topo); # ifdef PERFDEBUG - double pwn_time = PIL_check_seconds_timer(); + double pwn_time = BLI_check_seconds_timer(); std::cout << " pwn checked, time = " << pwn_time - topo_time << "\n"; # endif IMesh tm_out; @@ -3602,14 +3601,14 @@ IMesh boolean_trimesh(IMesh &tm_in, tm_out = raycast_patches_boolean(tm_si, op, nshapes, shape_fn, pinfo, arena); } # ifdef PERFDEBUG - double raycast_time = PIL_check_seconds_timer(); + double raycast_time = BLI_check_seconds_timer(); std::cout << " raycast_boolean done, time = " << raycast_time - pwn_time << "\n"; # endif } else { PatchesInfo pinfo = find_patches(tm_si, tm_si_topo); # ifdef PERFDEBUG - double patch_time = PIL_check_seconds_timer(); + double patch_time = BLI_check_seconds_timer(); std::cout << " patches found, time = " << patch_time - pwn_time << "\n"; # endif CellsInfo cinfo = find_cells(tm_si, tm_si_topo, pinfo); @@ -3617,12 +3616,12 @@ IMesh boolean_trimesh(IMesh &tm_in, std::cout << "Input is PWN\n"; } # ifdef PERFDEBUG - double cell_time = PIL_check_seconds_timer(); + double cell_time = BLI_check_seconds_timer(); std::cout << " cells found, time = " << cell_time - pwn_time << "\n"; # endif finish_patch_cell_graph(tm_si, cinfo, pinfo, tm_si_topo, arena); # ifdef PERFDEBUG - double finish_pc_time = PIL_check_seconds_timer(); + double finish_pc_time = BLI_check_seconds_timer(); std::cout << " finished patch-cell graph, time = " << finish_pc_time - cell_time << "\n"; # endif bool pc_ok = patch_cell_graph_ok(cinfo, pinfo); @@ -3634,7 +3633,7 @@ IMesh boolean_trimesh(IMesh &tm_in, cinfo.init_windings(nshapes); int c_ambient = find_ambient_cell(tm_si, nullptr, tm_si_topo, pinfo, arena); # ifdef PERFDEBUG - double amb_time = PIL_check_seconds_timer(); + double amb_time = BLI_check_seconds_timer(); std::cout << " ambient cell found, time = " << amb_time - finish_pc_time << "\n"; # endif if (c_ambient == NO_INDEX) { @@ -3644,12 +3643,12 @@ IMesh boolean_trimesh(IMesh &tm_in, } propagate_windings_and_in_output_volume(pinfo, cinfo, c_ambient, op, nshapes, si_shape_fn); # ifdef PERFDEBUG - double propagate_time = PIL_check_seconds_timer(); + double propagate_time = BLI_check_seconds_timer(); std::cout << " windings propagated, time = " << propagate_time - amb_time << "\n"; # endif tm_out = extract_from_in_output_volume_diffs(tm_si, pinfo, cinfo, arena); # ifdef PERFDEBUG - double extract_time = PIL_check_seconds_timer(); + double extract_time = BLI_check_seconds_timer(); std::cout << " extracted, time = " << extract_time - propagate_time << "\n"; # endif if (dbg_level > 0) { @@ -3665,7 +3664,7 @@ IMesh boolean_trimesh(IMesh &tm_in, std::cout << "boolean tm output:\n" << tm_out; } # ifdef PERFDEBUG - double end_time = PIL_check_seconds_timer(); + double end_time = BLI_check_seconds_timer(); std::cout << " boolean_trimesh done, total time = " << end_time - start_time << "\n"; # endif return tm_out; @@ -3711,7 +3710,7 @@ IMesh boolean_mesh(IMesh &imesh, IMesh *tm_in = imesh_triangulated; IMesh our_triangulation; # ifdef PERFDEBUG - double start_time = PIL_check_seconds_timer(); + double start_time = BLI_check_seconds_timer(); std::cout << "boolean_mesh, timing begins\n"; # endif if (tm_in == nullptr) { @@ -3719,7 +3718,7 @@ IMesh boolean_mesh(IMesh &imesh, tm_in = &our_triangulation; } # ifdef PERFDEBUG - double tri_time = PIL_check_seconds_timer(); + double tri_time = BLI_check_seconds_timer(); std::cout << "triangulated, time = " << tri_time - start_time << "\n"; # endif if (dbg_level > 1) { @@ -3727,7 +3726,7 @@ IMesh boolean_mesh(IMesh &imesh, } IMesh tm_out = boolean_trimesh(*tm_in, op, nshapes, shape_fn, use_self, hole_tolerant, arena); # ifdef PERFDEBUG - double bool_tri_time = PIL_check_seconds_timer(); + double bool_tri_time = BLI_check_seconds_timer(); std::cout << "boolean_trimesh done, time = " << bool_tri_time - tri_time << "\n"; # endif if (dbg_level > 1) { @@ -3736,7 +3735,7 @@ IMesh boolean_mesh(IMesh &imesh, } IMesh ans = polymesh_from_trimesh_with_dissolve(tm_out, imesh, arena); # ifdef PERFDEBUG - double dissolve_time = PIL_check_seconds_timer(); + double dissolve_time = BLI_check_seconds_timer(); std::cout << "polymesh from dissolving, time = " << dissolve_time - bool_tri_time << "\n"; # endif if (dbg_level > 0) { @@ -3747,7 +3746,7 @@ IMesh boolean_mesh(IMesh &imesh, } } # ifdef PERFDEBUG - double end_time = PIL_check_seconds_timer(); + double end_time = BLI_check_seconds_timer(); std::cout << "boolean_mesh done, total time = " << end_time - start_time << "\n"; # endif return ans; diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 45bdce6af08..2e49f598212 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -35,11 +35,10 @@ # include "BLI_task.h" # include "BLI_task.hh" # include "BLI_threads.h" +# include "BLI_time.h" # include "BLI_vector.hh" # include "BLI_vector_set.hh" -# include "PIL_time.h" - # include "BLI_mesh_intersect.hh" // # define PERFDEBUG @@ -2957,7 +2956,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, } # ifdef PERFDEBUG perfdata_init(); - double start_time = PIL_check_seconds_timer(); + double start_time = BLI_check_seconds_timer(); std::cout << "trimesh_nary_intersect start\n"; # endif /* Usually can use tm_in but if it has degenerate or illegal triangles, @@ -2975,17 +2974,17 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, } } # ifdef PERFDEBUG - double clean_time = PIL_check_seconds_timer(); + double clean_time = BLI_check_seconds_timer(); std::cout << "cleaned, time = " << clean_time - start_time << "\n"; # endif Array tri_bb = calc_face_bounding_boxes(*tm_clean); # ifdef PERFDEBUG - double bb_calc_time = PIL_check_seconds_timer(); + double bb_calc_time = BLI_check_seconds_timer(); std::cout << "bbs calculated, time = " << bb_calc_time - clean_time << "\n"; # endif TriOverlaps tri_ov(*tm_clean, tri_bb, nshapes, shape_fn, use_self); # ifdef PERFDEBUG - double overlap_time = PIL_check_seconds_timer(); + double overlap_time = BLI_check_seconds_timer(); std::cout << "intersect overlaps calculated, time = " << overlap_time - bb_calc_time << "\n"; # endif Array tri_subdivided(tm_clean->face_size(), NoInitialization()); @@ -2998,7 +2997,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, } }); # ifdef PERFDEBUG - double plane_populate = PIL_check_seconds_timer(); + double plane_populate = BLI_check_seconds_timer(); std::cout << "planes populated, time = " << plane_populate - overlap_time << "\n"; # endif /* itt_map((a,b)) will hold the intersection value resulting from intersecting @@ -3007,7 +3006,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, itt_map.reserve(tri_ov.overlap().size()); calc_overlap_itts(itt_map, *tm_clean, tri_ov, arena); # ifdef PERFDEBUG - double itt_time = PIL_check_seconds_timer(); + double itt_time = BLI_check_seconds_timer(); std::cout << "itts found, time = " << itt_time - plane_populate << "\n"; # endif CoplanarClusterInfo clinfo = find_clusters(*tm_clean, tri_bb, itt_map); @@ -3015,7 +3014,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, std::cout << clinfo; } # ifdef PERFDEBUG - double find_cluster_time = PIL_check_seconds_timer(); + double find_cluster_time = BLI_check_seconds_timer(); std::cout << "clusters found, time = " << find_cluster_time - itt_time << "\n"; doperfmax(0, tm_in.face_size()); doperfmax(1, clinfo.tot_cluster()); @@ -3023,7 +3022,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, # endif calc_subdivided_non_cluster_tris(tri_subdivided, *tm_clean, itt_map, clinfo, tri_ov, arena); # ifdef PERFDEBUG - double subdivided_tris_time = PIL_check_seconds_timer(); + double subdivided_tris_time = BLI_check_seconds_timer(); std::cout << "subdivided non-cluster tris found, time = " << subdivided_tris_time - itt_time << "\n"; # endif @@ -3032,13 +3031,13 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, cluster_subdivided[c] = calc_cluster_subdivided(clinfo, c, *tm_clean, tri_ov, itt_map, arena); } # ifdef PERFDEBUG - double cluster_subdivide_time = PIL_check_seconds_timer(); + double cluster_subdivide_time = BLI_check_seconds_timer(); std::cout << "subdivided clusters found, time = " << cluster_subdivide_time - subdivided_tris_time << "\n"; # endif calc_cluster_tris(tri_subdivided, *tm_clean, clinfo, cluster_subdivided, arena); # ifdef PERFDEBUG - double extract_time = PIL_check_seconds_timer(); + double extract_time = BLI_check_seconds_timer(); std::cout << "subdivided cluster tris found, time = " << extract_time - cluster_subdivide_time << "\n"; # endif @@ -3048,7 +3047,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, std::cout << combined; } # ifdef PERFDEBUG - double end_time = PIL_check_seconds_timer(); + double end_time = BLI_check_seconds_timer(); std::cout << "triangles combined, time = " << end_time - extract_time << "\n"; std::cout << "trimesh_nary_intersect done, total time = " << end_time - start_time << "\n"; dump_perfdata(); diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index 6d70443b2fa..35d2e1e3a01 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -58,7 +58,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif typedef int8_t eSign; diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index 644d07e6c26..a7900f02165 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -18,6 +18,7 @@ #include "BLI_rand.h" #include "BLI_rand.hh" #include "BLI_threads.h" +#include "BLI_time.h" /* defines BLI_INLINE */ #include "BLI_compiler_compat.h" @@ -25,8 +26,6 @@ #include "BLI_strict_flags.h" #include "BLI_sys_types.h" -#include "PIL_time.h" - extern "C" uchar BLI_noise_hash_uchar_512[512]; /* `noise.cc` */ #define hash BLI_noise_hash_uchar_512 @@ -367,7 +366,7 @@ namespace blender { RandomNumberGenerator RandomNumberGenerator::from_random_seed() { - const double time = PIL_check_seconds_timer() * 1000000.0; + const double time = BLI_check_seconds_timer() * 1000000.0; return RandomNumberGenerator(*reinterpret_cast(&time)); } diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index fc9e3bae149..1ae433d51d4 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -17,8 +17,7 @@ #include "BLI_system.h" #include "BLI_task.h" #include "BLI_threads.h" - -#include "PIL_time.h" +#include "BLI_time.h" /* for checking system threads - BLI_system_thread_count */ #ifdef WIN32 @@ -64,7 +63,7 @@ * // tag job 'processed * BLI_threadpool_insert(&lb, job); * } - * else PIL_sleep_ms(50); + * else BLI_sleep_ms(50); * * // Find if a job is ready, this the do_something_func() should write in job somewhere. * cont = 0; @@ -688,7 +687,7 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms) void *work = nullptr; timespec timeout; - t = PIL_check_seconds_timer(); + t = BLI_check_seconds_timer(); wait_timeout(&timeout, ms); /* wait until there is work */ @@ -697,7 +696,7 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms) if (pthread_cond_timedwait(&queue->push_cond, &queue->mutex, &timeout) == ETIMEDOUT) { break; } - if (PIL_check_seconds_timer() - t >= ms * 0.001) { + if (BLI_check_seconds_timer() - t >= ms * 0.001) { break; } } diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c index 40a37efd220..2af01aea92a 100644 --- a/source/blender/blenlib/intern/time.c +++ b/source/blender/blenlib/intern/time.c @@ -6,13 +6,13 @@ * \ingroup bli */ -#include "PIL_time.h" +#include "BLI_time.h" #ifdef WIN32 # define WIN32_LEAN_AND_MEAN # include -double PIL_check_seconds_timer(void) +double BLI_check_seconds_timer(void) { static int hasperfcounter = -1; /* (-1 == unknown) */ static double perffreq; @@ -47,12 +47,12 @@ double PIL_check_seconds_timer(void) } } -long int PIL_check_seconds_timer_i(void) +long int BLI_check_seconds_timer_i(void) { - return (long int)PIL_check_seconds_timer(); + return (long int)BLI_check_seconds_timer(); } -void PIL_sleep_ms(int ms) +void BLI_sleep_ms(int ms) { Sleep(ms); } @@ -62,7 +62,7 @@ void PIL_sleep_ms(int ms) # include # include -double PIL_check_seconds_timer(void) +double BLI_check_seconds_timer(void) { struct timeval tv; struct timezone tz; @@ -72,7 +72,7 @@ double PIL_check_seconds_timer(void) return ((double)tv.tv_sec + tv.tv_usec / 1000000.0); } -long int PIL_check_seconds_timer_i(void) +long int BLI_check_seconds_timer_i(void) { struct timeval tv; struct timezone tz; @@ -82,7 +82,7 @@ long int PIL_check_seconds_timer_i(void) return tv.tv_sec; } -void PIL_sleep_ms(int ms) +void BLI_sleep_ms(int ms) { if (ms >= 1000) { sleep(ms / 1000); diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index 5eb4881c71f..5e4cf2fd167 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -7,7 +7,7 @@ #include "MEM_guardedalloc.h" #include "BLI_rand.h" -#include "PIL_time.h" +#include "BLI_time.h" #include #include @@ -1877,9 +1877,9 @@ void text_test( } in.epsilon = b_before_arcs_in.epsilon; in.need_ids = need_ids; - double tstart = PIL_check_seconds_timer(); + double tstart = BLI_check_seconds_timer(); CDT_result out = delaunay_2d_calc(in, otype); - double tend = PIL_check_seconds_timer(); + double tend = BLI_check_seconds_timer(); if (print_timing) { std::cout << "time = " << tend - tstart << "\n"; } @@ -2190,10 +2190,10 @@ void rand_delaunay_test(int test_kind, } /* Run the test. */ - double tstart = PIL_check_seconds_timer(); + double tstart = BLI_check_seconds_timer(); CDT_result out = delaunay_2d_calc(in, otype); EXPECT_NE(out.vert.size(), 0); - times[lg_size] += PIL_check_seconds_timer() - tstart; + times[lg_size] += BLI_check_seconds_timer() - tstart; if (DO_DRAW) { graph_draw(test_label, out.vert, out.edge, out.face); } diff --git a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc index b68375157ee..de51be79de8 100644 --- a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc +++ b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc @@ -8,13 +8,12 @@ #include #include -#include "PIL_time.h" - #include "BLI_array.hh" #include "BLI_math_mpq.hh" #include "BLI_math_vector_mpq_types.hh" #include "BLI_mesh_intersect.hh" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_vector.hh" #define DO_REGULAR_TESTS 1 @@ -981,7 +980,7 @@ static void spheresphere_test(int nrings, double y_offset, bool use_self) return; } BLI_task_scheduler_init(); /* Without this, no parallelism. */ - double time_start = PIL_check_seconds_timer(); + double time_start = BLI_check_seconds_timer(); IMeshArena arena; int nsegs = 2 * nrings; int sphere_verts_num; @@ -1010,7 +1009,7 @@ static void spheresphere_test(int nrings, double y_offset, bool use_self) sphere_verts_num, &arena); IMesh mesh(tris); - double time_create = PIL_check_seconds_timer(); + double time_create = BLI_check_seconds_timer(); // write_obj_mesh(mesh, "spheresphere_in"); IMesh out; if (use_self) { @@ -1021,7 +1020,7 @@ static void spheresphere_test(int nrings, double y_offset, bool use_self) out = trimesh_nary_intersect( mesh, 2, [nf](int t) { return t < nf ? 0 : 1; }, false, &arena); } - double time_intersect = PIL_check_seconds_timer(); + double time_intersect = BLI_check_seconds_timer(); std::cout << "Create time: " << time_create - time_start << "\n"; std::cout << "Intersect time: " << time_intersect - time_create << "\n"; std::cout << "Total time: " << time_intersect - time_start << "\n"; @@ -1121,7 +1120,7 @@ static void spheregrid_test(int nrings, int grid_level, double z_offset, bool us return; } BLI_task_scheduler_init(); /* Without this, no parallelism. */ - double time_start = PIL_check_seconds_timer(); + double time_start = BLI_check_seconds_timer(); IMeshArena arena; int sphere_verts_num; int sphere_tris_num; @@ -1155,7 +1154,7 @@ static void spheregrid_test(int nrings, int grid_level, double z_offset, bool us sphere_tris_num, &arena); IMesh mesh(tris); - double time_create = PIL_check_seconds_timer(); + double time_create = BLI_check_seconds_timer(); // write_obj_mesh(mesh, "spheregrid_in"); IMesh out; if (use_self) { @@ -1166,7 +1165,7 @@ static void spheregrid_test(int nrings, int grid_level, double z_offset, bool us out = trimesh_nary_intersect( mesh, 2, [nf](int t) { return t < nf ? 0 : 1; }, false, &arena); } - double time_intersect = PIL_check_seconds_timer(); + double time_intersect = BLI_check_seconds_timer(); std::cout << "Create time: " << time_create - time_start << "\n"; std::cout << "Intersect time: " << time_intersect - time_create << "\n"; std::cout << "Total time: " << time_intersect - time_start << "\n"; @@ -1188,7 +1187,7 @@ static void gridgrid_test(int x_level_1, /* Make two grids, each 4x4, with given subdivision levels in x and y, * and the second offset from the first by x_off, y_off, and rotated by rot_deg degrees. */ BLI_task_scheduler_init(); /* Without this, no parallelism. */ - double time_start = PIL_check_seconds_timer(); + double time_start = BLI_check_seconds_timer(); IMeshArena arena; int x_subdivs_1 = 1 << x_level_1; int y_subdivs_1 = 1 << y_level_1; @@ -1224,7 +1223,7 @@ static void gridgrid_test(int x_level_1, grid_tris_1_num, &arena); IMesh mesh(tris); - double time_create = PIL_check_seconds_timer(); + double time_create = BLI_check_seconds_timer(); // write_obj_mesh(mesh, "gridgrid_in"); IMesh out; if (use_self) { @@ -1235,7 +1234,7 @@ static void gridgrid_test(int x_level_1, out = trimesh_nary_intersect( mesh, 2, [nf](int t) { return t < nf ? 0 : 1; }, false, &arena); } - double time_intersect = PIL_check_seconds_timer(); + double time_intersect = BLI_check_seconds_timer(); std::cout << "Create time: " << time_create - time_start << "\n"; std::cout << "Intersect time: " << time_intersect - time_create << "\n"; std::cout << "Total time: " << time_intersect - time_start << "\n"; diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc index 5cd1f058428..8302eda3e68 100644 --- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc @@ -12,8 +12,8 @@ #include "BLI_ghash.h" #include "BLI_rand.h" #include "BLI_string.h" +#include "BLI_time_utildefines.h" #include "BLI_utildefines.h" -#include "PIL_time_utildefines.h" /* Using http://corpora.uni-leipzig.de/downloads/eng_wikipedia_2010_1M-text.tar.gz * (1 million of words, about 122MB of text) from diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc index 7779bd3fbe8..cf0db07b92b 100644 --- a/source/blender/blenloader/intern/readfile.cc +++ b/source/blender/blenloader/intern/readfile.cc @@ -56,8 +56,7 @@ #include "BLI_memarena.h" #include "BLI_mempool.h" #include "BLI_threads.h" - -#include "PIL_time.h" +#include "BLI_time.h" #include "BLT_translation.h" @@ -3723,7 +3722,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) } if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) { - fd->reports->duration.libraries = PIL_check_seconds_timer(); + fd->reports->duration.libraries = BLI_check_seconds_timer(); read_libraries(fd, &mainlist); blo_join_main(&mainlist); @@ -3738,7 +3737,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) read_undo_remap_noundo_data(fd); } - fd->reports->duration.libraries = PIL_check_seconds_timer() - fd->reports->duration.libraries; + fd->reports->duration.libraries = BLI_check_seconds_timer() - fd->reports->duration.libraries; /* Skip in undo case. */ if ((fd->flags & FD_FLAGS_IS_MEMFILE) == 0) { @@ -3796,7 +3795,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) * we can re-generate overrides from their references. */ if ((fd->flags & FD_FLAGS_IS_MEMFILE) == 0) { /* Do not apply in undo case! */ - fd->reports->duration.lib_overrides = PIL_check_seconds_timer(); + fd->reports->duration.lib_overrides = BLI_check_seconds_timer(); std::string cur_view_layer_name = bfd->cur_view_layer != nullptr ? bfd->cur_view_layer->name : @@ -3817,7 +3816,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) * Proper fix involves first addressing #90610. */ BKE_main_collections_parent_relations_rebuild(bfd->main); - fd->reports->duration.lib_overrides = PIL_check_seconds_timer() - + fd->reports->duration.lib_overrides = BLI_check_seconds_timer() - fd->reports->duration.lib_overrides; } diff --git a/source/blender/blenloader/intern/versioning_legacy.cc b/source/blender/blenloader/intern/versioning_legacy.cc index f605df85a24..b477c676a11 100644 --- a/source/blender/blenloader/intern/versioning_legacy.cc +++ b/source/blender/blenloader/intern/versioning_legacy.cc @@ -49,6 +49,7 @@ #include "BLI_blenlib.h" #include "BLI_math_matrix.h" #include "BLI_math_vector.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_action.h" @@ -74,8 +75,6 @@ #include "readfile.hh" -#include "PIL_time.h" - #include /* Make preferences read-only, use `versioning_userdef.cc`. */ @@ -2593,7 +2592,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) ob = static_cast(ob->id.next)) { if (ob->pd) { - ob->pd->seed = (uint(ceil(PIL_check_seconds_timer())) + 1) % 128; + ob->pd->seed = (uint(ceil(BLI_check_seconds_timer())) + 1) % 128; } } } diff --git a/source/blender/bmesh/tools/bmesh_beautify.cc b/source/blender/bmesh/tools/bmesh_beautify.cc index 4c2fd979be4..373d1643b19 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.cc +++ b/source/blender/bmesh/tools/bmesh_beautify.cc @@ -31,8 +31,8 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time.h" -# include "PIL_time_utildefines.h" +# include "BLI_time.h" +# include "BLI_time_utildefines.h" #endif /* -------------------------------------------------------------------- */ diff --git a/source/blender/bmesh/tools/bmesh_bevel.cc b/source/blender/bmesh/tools/bmesh_bevel.cc index cc7a9626c67..4cdc9b32370 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.cc +++ b/source/blender/bmesh/tools/bmesh_bevel.cc @@ -40,7 +40,7 @@ using blender::Vector; // #define BEVEL_DEBUG_TIME #ifdef BEVEL_DEBUG_TIME -# include "PIL_time.h" +# include "BLI_time.h" #endif #define BEVEL_EPSILON_D 1e-6 @@ -7764,7 +7764,7 @@ void BM_mesh_bevel(BMesh *bm, } #ifdef BEVEL_DEBUG_TIME - double start_time = PIL_check_seconds_timer(); + double start_time = BLI_check_seconds_timer(); #endif /* Disable the miters with the cutoff vertex mesh method, the combination isn't useful anyway. */ @@ -7932,7 +7932,7 @@ void BM_mesh_bevel(BMesh *bm, BLI_memarena_free(bp.mem_arena); #ifdef BEVEL_DEBUG_TIME - double end_time = PIL_check_seconds_timer(); + double end_time = BLI_check_seconds_timer(); printf("BMESH BEVEL TIME = %.3f\n", end_time - start_time); #endif } diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index 668acfb94cd..7d776390481 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -14,13 +14,12 @@ #include "BLI_math_mpq.hh" #include "BLI_mesh_boolean.hh" #include "BLI_mesh_intersect.hh" +#include "BLI_time.h" #include "bmesh.hh" #include "bmesh_boolean.hh" #include "bmesh_edgesplit.hh" -#include "PIL_time.h" - // #define PERF_DEBUG namespace blender::meshintersect { @@ -352,11 +351,11 @@ static bool bmesh_boolean(BMesh *bm, IMeshArena arena; IMesh m_triangulated; # ifdef PERF_DEBUG - double start_time = PIL_check_seconds_timer(); + double start_time = BLI_check_seconds_timer(); # endif IMesh m_in = mesh_from_bm(bm, looptris, looptris_tot, &m_triangulated, &arena); # ifdef PERF_DEBUG - double mesh_time = PIL_check_seconds_timer(); + double mesh_time = BLI_check_seconds_timer(); std::cout << "bmesh_boolean, imesh_from_bm done, time = " << mesh_time - start_time << "\n"; # endif std::function shape_fn; @@ -384,12 +383,12 @@ static bool bmesh_boolean(BMesh *bm, IMesh m_out = boolean_mesh( m_in, boolean_mode, nshapes, shape_fn, use_self, hole_tolerant, &m_triangulated, &arena); # ifdef PERF_DEBUG - double boolean_time = PIL_check_seconds_timer(); + double boolean_time = BLI_check_seconds_timer(); std::cout << "boolean done, time = " << boolean_time - mesh_time << "\n"; # endif bool any_change = apply_mesh_output_to_bmesh(bm, m_out, keep_hidden); # ifdef PERF_DEBUG - double apply_mesh_time = PIL_check_seconds_timer(); + double apply_mesh_time = BLI_check_seconds_timer(); std::cout << "applied boolean output to bmesh, time = " << apply_mesh_time - boolean_time << "\n"; # endif diff --git a/source/blender/bmesh/tools/bmesh_region_match.cc b/source/blender/bmesh/tools/bmesh_region_match.cc index 5e170a41993..8131ac4f258 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.cc +++ b/source/blender/bmesh/tools/bmesh_region_match.cc @@ -48,8 +48,8 @@ // #define DEBUG_PRINT #ifdef DEBUG_TIME -# include "PIL_time.h" -# include "PIL_time_utildefines.h" +# include "BLI_time.h" +# include "BLI_time_utildefines.h" #endif #include "BLI_strict_flags.h" diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index f65d01af3f9..f4b7ebb0f6a 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -13,11 +13,10 @@ #include "BLI_rand.hh" #include "BLI_string.h" +#include "BLI_time.h" #include "BLT_translation.h" -#include "PIL_time.h" - namespace blender::compositor { std::ostream &operator<<(std::ostream &os, const ExecutionGroupFlags &flags) @@ -305,7 +304,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph) } /** \note Early break out. */ uint chunk_index; - execution_start_time_ = PIL_check_seconds_timer(); + execution_start_time_ = BLI_check_seconds_timer(); chunks_finished_ = 0; bTree_ = bTree; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index 244601b2d1f..488b7c2fb9f 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -7,8 +7,7 @@ #include "COM_ConstantOperation.h" #include "BLI_rand.h" - -#include "PIL_time.h" +#include "BLI_time.h" namespace blender::compositor { @@ -74,7 +73,7 @@ void ScreenLensDistortionOperation::init_execution() input_program_ = this->get_input_socket_reader(0); this->init_mutex(); - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); rng_seed ^= uint(POINTER_AS_INT(input_program_)); rng_ = BLI_rng_new(rng_seed); } diff --git a/source/blender/depsgraph/intern/builder/pipeline.cc b/source/blender/depsgraph/intern/builder/pipeline.cc index 9b5ea8899df..dd75f4e216f 100644 --- a/source/blender/depsgraph/intern/builder/pipeline.cc +++ b/source/blender/depsgraph/intern/builder/pipeline.cc @@ -4,7 +4,7 @@ #include "pipeline.h" -#include "PIL_time.h" +#include "BLI_time.h" #include "BKE_global.h" @@ -29,7 +29,7 @@ void AbstractBuilderPipeline::build() { double start_time = 0.0; if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) { - start_time = PIL_check_seconds_timer(); + start_time = BLI_check_seconds_timer(); } build_step_sanity_check(); @@ -38,7 +38,7 @@ void AbstractBuilderPipeline::build() build_step_finalize(); if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) { - printf("Depsgraph built in %f seconds.\n", PIL_check_seconds_timer() - start_time); + printf("Depsgraph built in %f seconds.\n", BLI_check_seconds_timer() - start_time); } } diff --git a/source/blender/depsgraph/intern/debug/deg_debug.cc b/source/blender/depsgraph/intern/debug/deg_debug.cc index c593e3cde55..5f5cfc065f8 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug.cc @@ -11,10 +11,9 @@ #include "BLI_console.h" #include "BLI_hash.h" #include "BLI_string.h" +#include "BLI_time_utildefines.h" #include "BLI_utildefines.h" -#include "PIL_time_utildefines.h" - #include "BKE_global.h" #include "intern/depsgraph.hh" @@ -34,7 +33,7 @@ void DepsgraphDebug::begin_graph_evaluation() return; } - const double current_time = PIL_check_seconds_timer(); + const double current_time = BLI_check_seconds_timer(); graph_evaluation_start_time_ = current_time; } @@ -45,7 +44,7 @@ void DepsgraphDebug::end_graph_evaluation() return; } - const double graph_eval_end_time = PIL_check_seconds_timer(); + const double graph_eval_end_time = BLI_check_seconds_timer(); const double graph_eval_time = graph_eval_end_time - graph_evaluation_start_time_; if (name.empty()) { diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index c39f06e24da..8da3f80a223 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -13,8 +13,8 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" -#include "PIL_time.h" -#include "PIL_time_utildefines.h" +#include "BLI_time.h" +#include "BLI_time_utildefines.h" #include "DNA_cachefile_types.h" #include "DNA_collection_types.h" diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 552602c9837..218a6eccacf 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -10,12 +10,11 @@ #include "intern/eval/deg_eval.h" -#include "PIL_time.h" - #include "BLI_compiler_attrs.h" #include "BLI_function_ref.hh" #include "BLI_gsqueue.h" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_global.h" @@ -94,9 +93,9 @@ void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_nod BLI_assert_msg(!operation_node->is_noop(), "NOOP nodes should not actually be scheduled"); /* Perform operation. */ if (state->do_stats) { - const double start_time = PIL_check_seconds_timer(); + const double start_time = BLI_check_seconds_timer(); operation_node->evaluate(depsgraph); - operation_node->stats.current_time += PIL_check_seconds_timer() - start_time; + operation_node->stats.current_time += BLI_check_seconds_timer() - start_time; } else { operation_node->evaluate(depsgraph); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.cc b/source/blender/draw/engines/eevee/eevee_lightcache.cc index 8849ea8142a..ad1d9474d2f 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.cc +++ b/source/blender/draw/engines/eevee/eevee_lightcache.cc @@ -14,6 +14,7 @@ #include "BLI_endian_switch.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "DEG_depsgraph_build.hh" #include "DEG_depsgraph_query.hh" @@ -23,8 +24,6 @@ #include "DNA_collection_types.h" #include "DNA_lightprobe_types.h" -#include "PIL_time.h" - #include "eevee_lightcache.h" #include "eevee_private.h" @@ -1454,7 +1453,7 @@ void EEVEE_lightbake_job(void *custom_data, wmJobWorkerStatus *worker_status) * because this step is locking at this moment. */ /* TODO: remove this. */ if (lbake->delay) { - PIL_sleep_ms(lbake->delay); + BLI_sleep_ms(lbake->delay); } /* Render world irradiance and reflection first */ diff --git a/source/blender/draw/engines/eevee_next/eevee_lightcache.cc b/source/blender/draw/engines/eevee_next/eevee_lightcache.cc index a87f7e83aa3..420d403def0 100644 --- a/source/blender/draw/engines/eevee_next/eevee_lightcache.cc +++ b/source/blender/draw/engines/eevee_next/eevee_lightcache.cc @@ -18,12 +18,11 @@ #include "DNA_lightprobe_types.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "DEG_depsgraph_build.hh" #include "DEG_depsgraph_query.hh" -#include "PIL_time.h" - #include "GPU_capabilities.h" #include "GPU_context.h" @@ -143,7 +142,7 @@ class LightBake { DEG_evaluate_on_framechange(depsgraph_, frame_); if (delay_ms_ > 0) { - PIL_sleep_ms(delay_ms_); + BLI_sleep_ms(delay_ms_); } context_enable(); diff --git a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc index 85da26f1b19..710a19389d4 100644 --- a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc +++ b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc @@ -10,11 +10,12 @@ #include "BKE_paint.hh" #include "BLI_math_color.h" +#include "BLI_time.h" + #include "DRW_render.hh" #include "ED_view3d.hh" -#include "PIL_time.h" #include "UI_resources.hh" #include "overlay_private.hh" @@ -24,7 +25,7 @@ void OVERLAY_mode_transfer_cache_init(OVERLAY_Data *vedata) OVERLAY_PassList *psl = vedata->psl; OVERLAY_PrivateData *pd = vedata->stl->pd; - pd->mode_transfer.time = PIL_check_seconds_timer(); + pd->mode_transfer.time = BLI_check_seconds_timer(); for (int i = 0; i < 2; i++) { /* Non Meshes Pass (Camera, empties, lights ...) */ diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 9d50c76ba22..986801fbc92 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -35,7 +35,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif namespace blender::draw { @@ -692,7 +692,7 @@ void mesh_buffer_cache_create_requested(TaskGraph *task_graph, } #ifdef DEBUG_TIME - double rdata_start = PIL_check_seconds_timer(); + double rdata_start = BLI_check_seconds_timer(); #endif MeshRenderData *mr = mesh_render_data_create( @@ -703,7 +703,7 @@ void mesh_buffer_cache_create_requested(TaskGraph *task_graph, mr->use_simplify_normals = (scene->r.mode & R_SIMPLIFY) && (scene->r.mode & R_SIMPLIFY_NORMALS); #ifdef DEBUG_TIME - double rdata_end = PIL_check_seconds_timer(); + double rdata_end = BLI_check_seconds_timer(); #endif eMRIterType iter_type = extractors.iter_types(); @@ -757,7 +757,7 @@ void mesh_buffer_cache_create_requested(TaskGraph *task_graph, #ifdef DEBUG_TIME BLI_task_graph_work_and_wait(task_graph); - double end = PIL_check_seconds_timer(); + double end = BLI_check_seconds_timer(); static double avg = 0; static double avg_fps = 0; diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index f5d3a778d09..806181eeee7 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -24,10 +24,9 @@ #include "BLI_linklist.h" #include "BLI_string.h" #include "BLI_string_utils.hh" +#include "BLI_time.h" #include "BLI_virtual_array.hh" -#include "PIL_time.h" - #include "DRW_engine.hh" #include "DRW_render.hh" @@ -2324,7 +2323,7 @@ void DRW_create_subdivision(Object *ob, #undef TIME_SUBDIV #ifdef TIME_SUBDIV - const double begin_time = PIL_check_seconds_timer(); + const double begin_time = BLI_check_seconds_timer(); #endif if (!draw_subdiv_create_requested_buffers(ob, @@ -2346,7 +2345,7 @@ void DRW_create_subdivision(Object *ob, } #ifdef TIME_SUBDIV - const double end_time = PIL_check_seconds_timer(); + const double end_time = BLI_check_seconds_timer(); fprintf(stderr, "Time to update subdivision: %f\n", end_time - begin_time); fprintf(stderr, "Maximum FPS: %f\n", 1.0 / (end_time - begin_time)); #endif diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index e27fec1b830..cc970456aa7 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -53,24 +53,24 @@ struct CurvesUniformBufPool; #define USE_PROFILE #ifdef USE_PROFILE -# include "PIL_time.h" +# include "BLI_time.h" # define PROFILE_TIMER_FALLOFF 0.04 # define PROFILE_START(time_start) \ - double time_start = PIL_check_seconds_timer(); \ + double time_start = BLI_check_seconds_timer(); \ ((void)0) # define PROFILE_END_ACCUM(time_accum, time_start) \ { \ - time_accum += (PIL_check_seconds_timer() - time_start) * 1e3; \ + time_accum += (BLI_check_seconds_timer() - time_start) * 1e3; \ } \ ((void)0) /* exp average */ # define PROFILE_END_UPDATE(time_update, time_start) \ { \ - double _time_delta = (PIL_check_seconds_timer() - time_start) * 1e3; \ + double _time_delta = (BLI_check_seconds_timer() - time_start) * 1e3; \ time_update = (time_update * (1.0 - PROFILE_TIMER_FALLOFF)) + \ (_time_delta * PROFILE_TIMER_FALLOFF); \ } \ diff --git a/source/blender/draw/intern/draw_manager_c.cc b/source/blender/draw/intern/draw_manager_c.cc index c16c401c645..d8ce656d2be 100644 --- a/source/blender/draw/intern/draw_manager_c.cc +++ b/source/blender/draw/intern/draw_manager_c.cc @@ -978,7 +978,7 @@ void DRW_cache_free_old_batches(Main *bmain) using namespace blender::draw; Scene *scene; static int lasttime = 0; - int ctime = int(PIL_check_seconds_timer()); + int ctime = int(BLI_check_seconds_timer()); if (U.vbotimeout == 0 || (ctime - lasttime) < U.vbocollectrate || ctime == lasttime) { return; diff --git a/source/blender/draw/intern/draw_manager_shader.cc b/source/blender/draw/intern/draw_manager_shader.cc index 0e2dd7ee7ad..5dd2c53619b 100644 --- a/source/blender/draw/intern/draw_manager_shader.cc +++ b/source/blender/draw/intern/draw_manager_shader.cc @@ -10,12 +10,11 @@ #include "DNA_object_types.h" #include "DNA_world_types.h" -#include "PIL_time.h" - #include "BLI_dynstr.h" #include "BLI_listbase.h" #include "BLI_string_utils.hh" #include "BLI_threads.h" +#include "BLI_time.h" #include "BKE_context.hh" #include "BKE_global.h" @@ -271,7 +270,7 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) DRW_deferred_shader_remove(mat); /* Shaders could already be compiling. Have to wait for compilation to finish. */ while (GPU_material_status(mat) == GPU_MAT_QUEUED) { - PIL_sleep_ms(20); + BLI_sleep_ms(20); } if (GPU_material_status(mat) == GPU_MAT_CREATED) { GPU_material_compile(mat); @@ -569,7 +568,7 @@ void DRW_shader_queue_optimize_material(GPUMaterial *mat) DRW_deferred_shader_optimize_remove(mat); /* If optimization job had already started, wait for it to complete. */ while (GPU_material_optimization_status(mat) == GPU_MAT_OPTIMIZATION_QUEUED) { - PIL_sleep_ms(20); + BLI_sleep_ms(20); } } return; diff --git a/source/blender/editors/armature/pose_edit.cc b/source/blender/editors/armature/pose_edit.cc index fc2b1aac15f..b291d51340b 100644 --- a/source/blender/editors/armature/pose_edit.cc +++ b/source/blender/editors/armature/pose_edit.cc @@ -59,9 +59,9 @@ #undef DEBUG_TIME -#include "PIL_time.h" +#include "BLI_time.h" #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif Object *ED_pose_object_from_context(bContext *C) diff --git a/source/blender/editors/gpencil_legacy/annotate_paint.cc b/source/blender/editors/gpencil_legacy/annotate_paint.cc index b930f90dc46..d3293d70233 100644 --- a/source/blender/editors/gpencil_legacy/annotate_paint.cc +++ b/source/blender/editors/gpencil_legacy/annotate_paint.cc @@ -15,12 +15,11 @@ #include "MEM_guardedalloc.h" #include "BLI_math_matrix.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "BKE_callbacks.h" #include "BKE_context.hh" #include "BKE_global.h" @@ -2152,7 +2151,7 @@ static void annotation_draw_apply_event( } } - p->curtime = PIL_check_seconds_timer(); + p->curtime = BLI_check_seconds_timer(); /* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */ p->pressure = event->tablet.pressure; diff --git a/source/blender/editors/gpencil_legacy/gpencil_paint.cc b/source/blender/editors/gpencil_legacy/gpencil_paint.cc index 11130bb43c8..7752fa059a2 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_paint.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_paint.cc @@ -20,12 +20,11 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "DNA_brush_types.h" #include "DNA_gpencil_legacy_types.h" #include "DNA_material_types.h" @@ -2166,7 +2165,7 @@ static tGPsdata *gpencil_session_initpaint(bContext *C, wmOperator *op) } /* Random generator, only init once. */ - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); rng_seed ^= POINTER_AS_UINT(p); p->rng = BLI_rng_new(rng_seed); @@ -2967,7 +2966,7 @@ static void gpencil_draw_apply_event(bContext *C, } } - p->curtime = PIL_check_seconds_timer(); + p->curtime = BLI_check_seconds_timer(); /* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */ p->pressure = event->tablet.pressure; diff --git a/source/blender/editors/gpencil_legacy/gpencil_primitive.cc b/source/blender/editors/gpencil_legacy/gpencil_primitive.cc index 4c8c1c048a7..9a326abfb30 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_primitive.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_primitive.cc @@ -20,12 +20,11 @@ #include "BLI_math_matrix.h" #include "BLI_math_vector.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "DNA_brush_types.h" #include "DNA_gpencil_legacy_types.h" #include "DNA_meshdata_types.h" @@ -369,7 +368,7 @@ static void gpencil_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) gpencil_primitive_allocate_memory(tgpi); /* Random generator, only init once. */ - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); tgpi->rng = BLI_rng_new(rng_seed); DEG_id_tag_update(&tgpi->gpd->id, ID_RECALC_COPY_ON_WRITE); diff --git a/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc b/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc index 4f0e2e60bc7..c00ee913f93 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc @@ -22,10 +22,9 @@ #include "BLI_math_rotation.h" #include "BLI_math_vector.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BLT_translation.h" #include "DNA_gpencil_legacy_types.h" @@ -1171,7 +1170,7 @@ static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op) gso->settings = gpencil_sculpt_get_settings(scene); /* Random generator, only init once. */ - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); rng_seed ^= POINTER_AS_UINT(gso); gso->rng = BLI_rng_new(rng_seed); diff --git a/source/blender/editors/gpencil_legacy/gpencil_utils.cc b/source/blender/editors/gpencil_legacy/gpencil_utils.cc index 09e60f3d94a..a3b65d5bb6a 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_utils.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_utils.cc @@ -21,10 +21,10 @@ #include "BLI_math_color.h" #include "BLI_math_matrix.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "BLT_translation.h" -#include "PIL_time.h" +#include "BLT_translation.h" #include "DNA_brush_types.h" #include "DNA_collection_types.h" @@ -2841,7 +2841,7 @@ void ED_gpencil_init_random_settings(Brush *brush, const int mval[2], GpRandomSettings *random_settings) { - int seed = (uint(ceil(PIL_check_seconds_timer())) + 1) % 128; + int seed = (uint(ceil(BLI_check_seconds_timer())) + 1) % 128; /* Use mouse position to get randomness. */ int ix = mval[0] * seed; int iy = mval[1] * seed; @@ -2887,7 +2887,7 @@ static void gpencil_sbuffer_vertex_color_random( { BrushGpencilSettings *brush_settings = brush->gpencil_settings; if (brush_settings->flag & GP_BRUSH_GROUP_RANDOM) { - int seed = (uint(ceil(PIL_check_seconds_timer())) + 1) % 128; + int seed = (uint(ceil(BLI_check_seconds_timer())) + 1) % 128; int ix = int(tpt->m_xy[0] * seed); int iy = int(tpt->m_xy[1] * seed); diff --git a/source/blender/editors/include/ED_scene.hh b/source/blender/editors/include/ED_scene.hh index cf9d4e331bb..208743e794f 100644 --- a/source/blender/editors/include/ED_scene.hh +++ b/source/blender/editors/include/ED_scene.hh @@ -54,7 +54,7 @@ struct SceneFPS_State { /** * Update frame rate info for viewport drawing. * \param ltime: Time since the last update, - * compatible with the result of #PIL_check_seconds_timer. + * compatible with the result of #BLI_check_seconds_timer. */ void ED_scene_fps_average_accumulate(Scene *scene, short fps_samples, double ltime) ATTR_NONNULL(1); diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index 8ce95d56502..030f7402dbf 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -30,10 +30,9 @@ #include "BLI_string.h" #include "BLI_string_cursor_utf8.h" #include "BLI_string_utf8.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BKE_animsys.h" #include "BKE_blender_undo.h" #include "BKE_brush.hh" @@ -4399,7 +4398,7 @@ static void ui_block_open_end(bContext *C, uiBut *but, uiHandleButtonData *data) but->editval = nullptr; but->editvec = nullptr; - but->block->auto_open_last = PIL_check_seconds_timer(); + but->block->auto_open_last = BLI_check_seconds_timer(); } if (data->menu) { @@ -8648,7 +8647,7 @@ static void button_activate_init(bContext *C, * want to allow auto opening adjacent menus even if no button is activated * in between going over to the other button, but only for a short while */ if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == true) { - if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer()) { + if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < BLI_check_seconds_timer()) { but->block->auto_open = false; } } @@ -8694,7 +8693,7 @@ static void button_activate_init(bContext *C, if (UI_but_has_tooltip_label(but)) { /* Show a label for this button. */ bScreen *screen = WM_window_get_active_screen(data->window); - if ((PIL_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) { + if ((BLI_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) { WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, region, ui_but_tooltip_init); if (screen->tool_tip) { screen->tool_tip->pass = 1; @@ -9975,7 +9974,7 @@ static void ui_mouse_motion_towards_init_ex(uiPopupBlockHandle *menu, menu->towardstime = DBL_MAX; /* unlimited time */ } else { - menu->towardstime = PIL_check_seconds_timer(); + menu->towardstime = BLI_check_seconds_timer(); } } } @@ -10055,7 +10054,7 @@ static bool ui_mouse_motion_towards_check(uiBlock *block, } /* 1 second timer */ - if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH) { + if (BLI_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH) { menu->dotowards = false; } diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc index b8c5dfabc96..611482defa6 100644 --- a/source/blender/editors/interface/interface_panel.cc +++ b/source/blender/editors/interface/interface_panel.cc @@ -16,9 +16,8 @@ #include "MEM_guardedalloc.h" -#include "PIL_time.h" - #include "BLI_blenlib.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -1792,7 +1791,7 @@ static void ui_do_animate(bContext *C, Panel *panel) uiHandlePanelData *data = static_cast(panel->activedata); ARegion *region = CTX_wm_region(C); - float fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME; + float fac = (BLI_check_seconds_timer() - data->starttime) / ANIMATION_TIME; fac = min_ff(sqrtf(fac), 1.0f); if (uiAlignPanelStep(region, fac, false)) { @@ -2650,7 +2649,7 @@ static void panel_handle_data_ensure(const bContext *C, data->startofsy = panel->ofsy; data->start_cur_xmin = region->v2d.cur.xmin; data->start_cur_ymin = region->v2d.cur.ymin; - data->starttime = PIL_check_seconds_timer(); + data->starttime = BLI_check_seconds_timer(); } /** diff --git a/source/blender/editors/interface/interface_region_menu_pie.cc b/source/blender/editors/interface/interface_region_menu_pie.cc index 88a59114bc5..9d30ef3a4af 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.cc +++ b/source/blender/editors/interface/interface_region_menu_pie.cc @@ -17,10 +17,9 @@ #include "DNA_userdef_types.h" #include "BLI_blenlib.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BKE_context.hh" #include "BKE_screen.hh" @@ -194,7 +193,7 @@ void UI_pie_menu_end(bContext *C, uiPieMenu *pie) menu = ui_popup_block_create(C, nullptr, nullptr, nullptr, ui_block_func_PIE, pie, nullptr); menu->popup = true; - menu->towardstime = PIL_check_seconds_timer(); + menu->towardstime = BLI_check_seconds_timer(); UI_popup_handlers_add(C, &window->modalhandlers, menu, WM_HANDLER_ACCEPT_DBL_CLICK); WM_event_add_mousemove(window); diff --git a/source/blender/editors/interface/interface_templates.cc b/source/blender/editors/interface/interface_templates.cc index c7a1f6616ec..b6f88f89dda 100644 --- a/source/blender/editors/interface/interface_templates.cc +++ b/source/blender/editors/interface/interface_templates.cc @@ -36,6 +36,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_string_utils.hh" +#include "BLI_time.h" #include "BLI_timecode.h" #include "BLI_utildefines.h" @@ -101,8 +102,6 @@ #include "UI_view2d.hh" #include "interface_intern.hh" -#include "PIL_time.h" - /* we may want to make this optional, disable for now. */ // #define USE_OP_RESET_BUT @@ -6150,7 +6149,7 @@ static char *progress_tooltip_func(bContext * /*C*/, void *argN, const char * /* /* create tooltip text and associate it with the job */ char elapsed_str[32]; char remaining_str[32] = "Unknown"; - const double elapsed = PIL_check_seconds_timer() - WM_jobs_starttime(wm, owner); + const double elapsed = BLI_check_seconds_timer() - WM_jobs_starttime(wm, owner); BLI_timecode_string_from_time_simple(elapsed_str, sizeof(elapsed_str), elapsed); if (progress) { diff --git a/source/blender/editors/interface/view2d_edge_pan.cc b/source/blender/editors/interface/view2d_edge_pan.cc index c49c8737763..4d14e48303b 100644 --- a/source/blender/editors/interface/view2d_edge_pan.cc +++ b/source/blender/editors/interface/view2d_edge_pan.cc @@ -9,13 +9,12 @@ #include "BKE_context.hh" #include "BLI_rect.h" +#include "BLI_time.h" #include "ED_screen.hh" #include "MEM_guardedalloc.h" -#include "PIL_time.h" - #include "RNA_access.hh" #include "RNA_define.hh" @@ -100,7 +99,7 @@ void UI_view2d_edge_pan_reset(View2DEdgePanData *vpd) { vpd->edge_pan_start_time_x = 0.0; vpd->edge_pan_start_time_y = 0.0; - vpd->edge_pan_last_time = PIL_check_seconds_timer(); + vpd->edge_pan_last_time = BLI_check_seconds_timer(); vpd->initial_rect = vpd->region->v2d.cur; } @@ -252,7 +251,7 @@ void UI_view2d_edge_pan_apply(bContext *C, View2DEdgePanData *vpd, const int xy[ } } - const double current_time = PIL_check_seconds_timer(); + const double current_time = BLI_check_seconds_timer(); edge_pan_manage_delay_timers(vpd, pan_dir_x, pan_dir_y, current_time); /* Calculate the delta since the last time the operator was called. */ diff --git a/source/blender/editors/interface/view2d_ops.cc b/source/blender/editors/interface/view2d_ops.cc index 064458c7510..24117643cbb 100644 --- a/source/blender/editors/interface/view2d_ops.cc +++ b/source/blender/editors/interface/view2d_ops.cc @@ -16,6 +16,7 @@ #include "BLI_blenlib.h" #include "BLI_math_base.h" #include "BLI_math_vector.h" +#include "BLI_time.h" /* USER_ZOOM_CONTINUE */ #include "BLI_utildefines.h" #include "BKE_context.hh" @@ -31,8 +32,6 @@ #include "UI_interface.hh" #include "UI_view2d.hh" -#include "PIL_time.h" /* USER_ZOOM_CONTINUE */ - #include "view2d_intern.hh" /* -------------------------------------------------------------------- */ @@ -1033,7 +1032,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) /* Check if the 'timer' is initialized, as zooming with the trackpad * never uses the "Continuous" zoom method, and the 'timer' is not initialized. */ if ((U.viewzoom == USER_ZOOM_CONTINUE) && vzd->timer) { /* XXX store this setting as RNA prop? */ - const double time = PIL_check_seconds_timer(); + const double time = BLI_check_seconds_timer(); const float time_step = float(time - vzd->timer_lastdraw); dx *= time_step * 5.0f; @@ -1233,7 +1232,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vzd->timer = WM_event_timer_add(CTX_wm_manager(C), window, TIMER, 0.01f); - vzd->timer_lastdraw = PIL_check_seconds_timer(); + vzd->timer_lastdraw = BLI_check_seconds_timer(); } return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/mesh/editmesh_automerge.cc b/source/blender/editors/mesh/editmesh_automerge.cc index 0853837205e..c71bae4e9b9 100644 --- a/source/blender/editors/mesh/editmesh_automerge.cc +++ b/source/blender/editors/mesh/editmesh_automerge.cc @@ -21,7 +21,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time.h" +# include "BLI_time.h" #endif /* use bmesh operator flags for a few operators */ @@ -92,13 +92,13 @@ void EDBM_automerge_and_split(Object *obedit, #ifdef DEBUG_TIME em->bm = BM_mesh_copy(bm); - double t1 = PIL_check_seconds_timer(); + double t1 = BLI_check_seconds_timer(); EDBM_automerge(obedit, false, hflag, dist); - t1 = PIL_check_seconds_timer() - t1; + t1 = BLI_check_seconds_timer() - t1; BM_mesh_free(em->bm); em->bm = bm; - double t2 = PIL_check_seconds_timer(); + double t2 = BLI_check_seconds_timer(); #endif BMOperator weldop; @@ -118,7 +118,7 @@ void EDBM_automerge_and_split(Object *obedit, BMO_op_finish(bm, &weldop); #ifdef DEBUG_TIME - t2 = PIL_check_seconds_timer() - t2; + t2 = BLI_check_seconds_timer() - t2; printf("t1: %lf; t2: %lf; fac: %lf\n", t1, t2, t1 / t2); #endif diff --git a/source/blender/editors/mesh/editmesh_undo.cc b/source/blender/editors/mesh/editmesh_undo.cc index 58a3bf0ba88..c52d0cb0480 100644 --- a/source/blender/editors/mesh/editmesh_undo.cc +++ b/source/blender/editors/mesh/editmesh_undo.cc @@ -50,7 +50,7 @@ // # define DEBUG_PRINT // # define DEBUG_TIME # ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" # endif # include "BLI_array_store.h" diff --git a/source/blender/editors/object/object_bake.cc b/source/blender/editors/object/object_bake.cc index aa194d7990b..aff6dbc8f52 100644 --- a/source/blender/editors/object/object_bake.cc +++ b/source/blender/editors/object/object_bake.cc @@ -19,6 +19,7 @@ #include "DNA_world_types.h" #include "BLI_blenlib.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_DerivedMesh.hh" @@ -42,8 +43,6 @@ #include "RE_pipeline.h" #include "RE_texture.h" -#include "PIL_time.h" - #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/editors/object/object_bake_simulation.cc b/source/blender/editors/object/object_bake_simulation.cc index 6164a55b8d3..df93a2bf6be 100644 --- a/source/blender/editors/object/object_bake_simulation.cc +++ b/source/blender/editors/object/object_bake_simulation.cc @@ -13,10 +13,9 @@ #include "BLI_serialize.hh" #include "BLI_string.h" #include "BLI_string_utils.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "WM_api.hh" #include "WM_types.hh" diff --git a/source/blender/editors/object/object_modes.cc b/source/blender/editors/object/object_modes.cc index 490de25e908..b22c11a2275 100644 --- a/source/blender/editors/object/object_modes.cc +++ b/source/blender/editors/object/object_modes.cc @@ -15,10 +15,9 @@ #include "DNA_workspace_types.h" #include "BLI_kdopbvh.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BLT_translation.h" #include "BKE_context.hh" @@ -444,7 +443,7 @@ static void object_overlay_mode_transfer_animation_start(bContext *C, Object *ob { Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Object *ob_dst_eval = DEG_get_evaluated_object(depsgraph, ob_dst); - ob_dst_eval->runtime->overlay_mode_transfer_start_time = PIL_check_seconds_timer(); + ob_dst_eval->runtime->overlay_mode_transfer_start_time = BLI_check_seconds_timer(); } static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base_dst) diff --git a/source/blender/editors/physics/dynamicpaint_ops.cc b/source/blender/editors/physics/dynamicpaint_ops.cc index 340f145e835..62c20643b11 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.cc +++ b/source/blender/editors/physics/dynamicpaint_ops.cc @@ -14,6 +14,7 @@ #include "BLI_blenlib.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -46,8 +47,6 @@ #include "RNA_define.hh" #include "RNA_enum_types.hh" -#include "PIL_time.h" - #include "WM_api.hh" #include "WM_types.hh" @@ -328,7 +327,7 @@ static void dpaint_bake_endjob(void *customdata) if (job->success) { /* Show bake info */ WM_reportf( - RPT_INFO, "DynamicPaint: Bake complete! (%.2f)", PIL_check_seconds_timer() - job->start); + RPT_INFO, "DynamicPaint: Bake complete! (%.2f)", BLI_check_seconds_timer() - job->start); } else { if (strlen(canvas->error)) { /* If an error occurred */ @@ -439,7 +438,7 @@ static void dpaint_bake_startjob(void *customdata, wmJobWorkerStatus *worker_sta job->stop = &worker_status->stop; job->do_update = &worker_status->do_update; job->progress = &worker_status->progress; - job->start = PIL_check_seconds_timer(); + job->start = BLI_check_seconds_timer(); job->success = 1; G.is_break = false; diff --git a/source/blender/editors/physics/particle_edit.cc b/source/blender/editors/physics/particle_edit.cc index d3ed2c89364..c3b06b3c762 100644 --- a/source/blender/editors/physics/particle_edit.cc +++ b/source/blender/editors/physics/particle_edit.cc @@ -26,6 +26,7 @@ #include "BLI_rand.h" #include "BLI_rect.h" #include "BLI_task.h" +#include "BLI_time_utildefines.h" #include "BLI_utildefines.h" #include "BKE_bvhutils.hh" @@ -70,8 +71,6 @@ #include "DEG_depsgraph_query.hh" -#include "PIL_time_utildefines.h" - #include "physics_intern.h" #include "particle_edit_utildefines.h" @@ -550,7 +549,7 @@ static void PE_free_shape_tree(PEData *data) static void PE_create_random_generator(PEData *data) { - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); rng_seed ^= POINTER_AS_UINT(data->ob); rng_seed ^= POINTER_AS_UINT(data->edit); data->rng = BLI_rng_new(rng_seed); diff --git a/source/blender/editors/physics/physics_fluid.cc b/source/blender/editors/physics/physics_fluid.cc index c580c39a553..79f181801f2 100644 --- a/source/blender/editors/physics/physics_fluid.cc +++ b/source/blender/editors/physics/physics_fluid.cc @@ -19,6 +19,7 @@ #include "BLI_blenlib.h" #include "BLI_path_util.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -35,7 +36,6 @@ #include "ED_object.hh" #include "ED_screen.hh" -#include "PIL_time.h" #include "WM_api.hh" #include "WM_types.hh" @@ -338,7 +338,7 @@ static void fluid_bake_endjob(void *customdata) if (job->success) { /* Show bake info. */ WM_reportf( - RPT_INFO, "Fluid: %s complete! (%.2f)", job->name, PIL_check_seconds_timer() - job->start); + RPT_INFO, "Fluid: %s complete! (%.2f)", job->name, BLI_check_seconds_timer() - job->start); } else { if (fds->error[0] != '\0') { @@ -361,7 +361,7 @@ static void fluid_bake_startjob(void *customdata, wmJobWorkerStatus *worker_stat job->stop = &worker_status->stop; job->do_update = &worker_status->do_update; job->progress = &worker_status->progress; - job->start = PIL_check_seconds_timer(); + job->start = BLI_check_seconds_timer(); job->success = 1; G.is_break = false; @@ -446,7 +446,7 @@ static void fluid_free_endjob(void *customdata) if (job->success) { /* Show free job info */ WM_reportf( - RPT_INFO, "Fluid: %s complete! (%.2f)", job->name, PIL_check_seconds_timer() - job->start); + RPT_INFO, "Fluid: %s complete! (%.2f)", job->name, BLI_check_seconds_timer() - job->start); } else { if (fds->error[0] != '\0') { @@ -466,7 +466,7 @@ static void fluid_free_startjob(void *customdata, wmJobWorkerStatus *worker_stat job->stop = &worker_status->stop; job->do_update = &worker_status->do_update; job->progress = &worker_status->progress; - job->start = PIL_check_seconds_timer(); + job->start = BLI_check_seconds_timer(); job->success = 1; G.is_break = false; diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc index 0cabb0974ea..28c51496dc1 100644 --- a/source/blender/editors/render/render_internal.cc +++ b/source/blender/editors/render/render_internal.cc @@ -17,11 +17,10 @@ #include "BLI_string.h" #include "BLI_string_utils.hh" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_timecode.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BLT_translation.h" #include "DNA_object_types.h" @@ -461,7 +460,7 @@ static void make_renderinfo_string(const RenderStats *rs, info_time = info_buffers.time_elapsed; BLI_timecode_string_from_time_simple(info_buffers.time_elapsed, sizeof(info_buffers.time_elapsed), - PIL_check_seconds_timer() - rs->starttime); + BLI_check_seconds_timer() - rs->starttime); } ret_array[i++] = RPT_("Time:"); diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc index 0abb1d7f1c0..dacdab0571f 100644 --- a/source/blender/editors/render/render_opengl.cc +++ b/source/blender/editors/render/render_opengl.cc @@ -79,7 +79,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time.h" +# include "BLI_time.h" #endif /* TODO(sergey): Find better approximation of the scheduled frames. @@ -860,7 +860,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) BLI_condition_init(&oglrender->task_condition); #ifdef DEBUG_TIME - oglrender->time_start = PIL_check_seconds_timer(); + oglrender->time_start = BLI_check_seconds_timer(); #endif return true; @@ -896,7 +896,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) BLI_condition_end(&oglrender->task_condition); #ifdef DEBUG_TIME - printf("Total render time: %f\n", PIL_check_seconds_timer() - oglrender->time_start); + printf("Total render time: %f\n", BLI_check_seconds_timer() - oglrender->time_start); #endif MEM_SAFE_FREE(oglrender->render_frames); diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index c8d699b85d9..f2cf3c113b3 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -23,10 +23,9 @@ #include "BLI_blenlib.h" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BLO_readfile.h" #include "DNA_brush_types.h" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc index 521e173efc5..f30a13ed027 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc @@ -10,10 +10,9 @@ #include "BLI_math_geom.h" #include "BLI_math_matrix.hh" #include "BLI_rand.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "BKE_attribute_math.hh" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc index 2316887d53b..1e941f46b1d 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc @@ -10,10 +10,9 @@ #include "BLI_math_geom.h" #include "BLI_math_matrix_types.hh" #include "BLI_rand.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "DEG_depsgraph_query.hh" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc index a3ec1f65259..1d008d0ae0e 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc @@ -10,10 +10,9 @@ #include "BLI_math_geom.h" #include "BLI_math_matrix_types.hh" #include "BLI_rand.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "BKE_attribute_math.hh" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc index e55e23b326c..faed3f758b5 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc @@ -27,8 +27,7 @@ #include "BLI_kdtree.h" #include "BLI_rand.hh" #include "BLI_task.hh" - -#include "PIL_time.h" +#include "BLI_time.h" #include "GEO_add_curves_on_mesh.hh" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_pinch.cc b/source/blender/editors/sculpt_paint/curves_sculpt_pinch.cc index 95450144103..055ae33d7c7 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_pinch.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_pinch.cc @@ -8,10 +8,9 @@ #include "BLI_math_matrix_types.hh" #include "BLI_task.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "BKE_brush.hh" diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc b/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc index 7516937da13..cca02a5a3a1 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc @@ -11,10 +11,9 @@ #include "BLI_math_geom.h" #include "BLI_math_matrix_types.hh" #include "BLI_rand.hh" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "BKE_attribute.hh" diff --git a/source/blender/editors/sculpt_paint/paint_stroke.cc b/source/blender/editors/sculpt_paint/paint_stroke.cc index 4e33844de66..016ac13aaa5 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.cc +++ b/source/blender/editors/sculpt_paint/paint_stroke.cc @@ -14,10 +14,9 @@ #include "BLI_listbase.h" #include "BLI_math_matrix.h" #include "BLI_rand.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "DNA_brush_types.h" #include "DNA_curve_types.h" #include "DNA_object_types.h" @@ -49,7 +48,7 @@ // #define DEBUG_TIME #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif struct PaintSample { @@ -460,7 +459,7 @@ static bool paint_brush_update(bContext *C, if ((do_random || do_random_mask) && stroke->rng == nullptr) { /* Lazy initialization. */ - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); rng_seed ^= uint(POINTER_AS_INT(brush)); stroke->rng = BLI_rng_new(rng_seed); } diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.cc b/source/blender/editors/sculpt_paint/sculpt_detail.cc index 1bec42e215d..77214e225c8 100644 --- a/source/blender/editors/sculpt_paint/sculpt_detail.cc +++ b/source/blender/editors/sculpt_paint/sculpt_detail.cc @@ -12,6 +12,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.hh" +#include "BLI_time.h" #include "BLT_translation.h" @@ -41,8 +42,6 @@ #include "RNA_access.hh" #include "RNA_define.hh" -#include "PIL_time.h" - #include "CLG_log.h" #include @@ -116,7 +115,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op) undo::push_begin(ob, op); undo::push_node(ob, nullptr, undo::Type::Position); - const double start_time = PIL_check_seconds_timer(); + const double start_time = BLI_check_seconds_timer(); while (bke::pbvh::bmesh_update_topology( ss->pbvh, PBVH_Collapse | PBVH_Subdivide, center, nullptr, size, false, false)) @@ -126,7 +125,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op) } } - CLOG_INFO(&LOG, 2, "Detail flood fill took %f seconds.", PIL_check_seconds_timer() - start_time); + CLOG_INFO(&LOG, 2, "Detail flood fill took %f seconds.", BLI_check_seconds_timer() - start_time); undo::push_end(ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_init.cc b/source/blender/editors/sculpt_paint/sculpt_mask_init.cc index e66fecf116a..3273bccebe3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_mask_init.cc +++ b/source/blender/editors/sculpt_paint/sculpt_mask_init.cc @@ -10,8 +10,7 @@ #include "BLI_hash.h" #include "BLI_task.h" - -#include "PIL_time.h" +#include "BLI_time.h" #include "DNA_brush_types.h" #include "DNA_mesh_types.h" @@ -106,7 +105,7 @@ static int sculpt_mask_init_exec(bContext *C, wmOperator *op) SCULPT_topology_islands_ensure(ob); } - const int mask_init_seed = PIL_check_seconds_timer(); + const int mask_init_seed = BLI_check_seconds_timer(); const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ss); threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) { diff --git a/source/blender/editors/space_clip/clip_editor.cc b/source/blender/editors/space_clip/clip_editor.cc index e38a163f1cd..8a16c81b2b3 100644 --- a/source/blender/editors/space_clip/clip_editor.cc +++ b/source/blender/editors/space_clip/clip_editor.cc @@ -26,6 +26,7 @@ #include "BLI_listbase.h" #include "BLI_rect.h" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_context.hh" @@ -52,8 +53,6 @@ #include "clip_intern.h" /* own include */ -#include "PIL_time.h" - /* -------------------------------------------------------------------- */ /** \name Operator Poll Functions * \{ */ diff --git a/source/blender/editors/space_clip/clip_ops.cc b/source/blender/editors/space_clip/clip_ops.cc index 6eb97d05824..6180117131a 100644 --- a/source/blender/editors/space_clip/clip_ops.cc +++ b/source/blender/editors/space_clip/clip_ops.cc @@ -28,6 +28,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -57,8 +58,6 @@ #include "UI_view2d.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "DEG_depsgraph_build.hh" @@ -557,7 +556,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event) if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_timer_add(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); - vpd->timer_lastdraw = PIL_check_seconds_timer(); + vpd->timer_lastdraw = BLI_check_seconds_timer(); } vpd->x = event->xy[0]; @@ -649,7 +648,7 @@ static void view_zoom_apply( if (U.viewzoom == USER_ZOOM_CONTINUE) { SpaceClip *sclip = CTX_wm_space_clip(C); - double time = PIL_check_seconds_timer(); + double time = BLI_check_seconds_timer(); float time_step = float(time - vpd->timer_lastdraw); float zfac; diff --git a/source/blender/editors/space_clip/tracking_ops_track.cc b/source/blender/editors/space_clip/tracking_ops_track.cc index 88a524913d2..91bed25ea3d 100644 --- a/source/blender/editors/space_clip/tracking_ops_track.cc +++ b/source/blender/editors/space_clip/tracking_ops_track.cc @@ -9,6 +9,7 @@ #include "MEM_guardedalloc.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -28,8 +29,6 @@ #include "RNA_access.hh" #include "RNA_define.hh" -#include "PIL_time.h" - #include "DEG_depsgraph.hh" #include "clip_intern.h" /* own include */ @@ -219,15 +218,15 @@ static void track_markers_startjob(void *tmv, wmJobWorkerStatus *worker_status) * exec_time for "Fastest" tracking */ - double start_time = PIL_check_seconds_timer(), exec_time; + double start_time = BLI_check_seconds_timer(), exec_time; if (!BKE_autotrack_context_step(tmj->context)) { break; } - exec_time = PIL_check_seconds_timer() - start_time; + exec_time = BLI_check_seconds_timer() - start_time; if (tmj->delay > float(exec_time)) { - PIL_sleep_ms(tmj->delay - float(exec_time)); + BLI_sleep_ms(tmj->delay - float(exec_time)); } } else if (!BKE_autotrack_context_step(tmj->context)) { diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc index 0442dc482a4..63d174163bf 100644 --- a/source/blender/editors/space_file/filelist.cc +++ b/source/blender/editors/space_file/filelist.cc @@ -41,6 +41,7 @@ #include "BLI_string_utils.hh" #include "BLI_task.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_uuid.h" @@ -71,8 +72,6 @@ #include "IMB_imbuf_types.h" #include "IMB_thumbs.h" -#include "PIL_time.h" - #include "WM_api.hh" #include "WM_types.hh" diff --git a/source/blender/editors/space_image/image_draw.cc b/source/blender/editors/space_image/image_draw.cc index 4b849f791db..cb30b4e79b5 100644 --- a/source/blender/editors/space_image/image_draw.cc +++ b/source/blender/editors/space_image/image_draw.cc @@ -21,12 +21,11 @@ #include "DNA_space_types.h" #include "DNA_view2d_types.h" -#include "PIL_time.h" - #include "BLI_listbase.h" #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "IMB_colormanagement.h" diff --git a/source/blender/editors/space_image/image_ops.cc b/source/blender/editors/space_image/image_ops.cc index 57aec2ade0c..941318b69bc 100644 --- a/source/blender/editors/space_image/image_ops.cc +++ b/source/blender/editors/space_image/image_ops.cc @@ -23,6 +23,7 @@ #include "BLI_fileops.h" #include "BLI_ghash.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -82,8 +83,6 @@ #include "WM_api.hh" #include "WM_types.hh" -#include "PIL_time.h" - #include "RE_engine.h" #include "image_intern.hh" @@ -540,7 +539,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_timer_add(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); - vpd->timer_lastdraw = PIL_check_seconds_timer(); + vpd->timer_lastdraw = BLI_check_seconds_timer(); } vpd->sima = sima; @@ -650,7 +649,7 @@ static void image_zoom_apply(ViewZoomData *vpd, } if (viewzoom == USER_ZOOM_CONTINUE) { - double time = PIL_check_seconds_timer(); + double time = BLI_check_seconds_timer(); float time_step = float(time - vpd->timer_lastdraw); float zfac; zfac = 1.0f + ((delta / 20.0f) * time_step); diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 64a31aa9e3f..95080bffdfe 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -20,10 +20,9 @@ #include "BLI_rand.hh" #include "BLI_set.hh" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "BLT_translation.h" #include "BKE_action.h" diff --git a/source/blender/editors/space_text/text_ops.cc b/source/blender/editors/space_text/text_ops.cc index 133c1a12d81..47025682e07 100644 --- a/source/blender/editors/space_text/text_ops.cc +++ b/source/blender/editors/space_text/text_ops.cc @@ -19,11 +19,10 @@ #include "BLI_math_vector.h" #include "BLI_string_cursor_utf8.h" #include "BLI_string_utf8.h" +#include "BLI_time.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "BKE_context.hh" #include "BKE_lib_id.hh" #include "BKE_main.hh" @@ -3520,7 +3519,7 @@ static int text_line_number_invoke(bContext *C, wmOperator * /*op*/, const wmEve return OPERATOR_PASS_THROUGH; } - time = PIL_check_seconds_timer(); + time = BLI_check_seconds_timer(); if (last_jump < time - 1) { jump_to = 0; } diff --git a/source/blender/editors/space_text/text_undo.cc b/source/blender/editors/space_text/text_undo.cc index 858b647248a..e9e2cab5932 100644 --- a/source/blender/editors/space_text/text_undo.cc +++ b/source/blender/editors/space_text/text_undo.cc @@ -15,11 +15,10 @@ #include "BLI_array_store.h" #include "BLI_array_utils.h" +#include "BLI_time.h" #include "BLT_translation.h" -#include "PIL_time.h" - #include "BKE_context.hh" #include "BKE_main.hh" #include "BKE_report.h" diff --git a/source/blender/editors/space_view3d/view3d_navigate_fly.cc b/source/blender/editors/space_view3d/view3d_navigate_fly.cc index de2e8cc73b8..31679d44d43 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_fly.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_fly.cc @@ -25,6 +25,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_rect.h" +#include "BLI_time.h" /* Smooth-view. */ #include "BKE_context.hh" #include "BKE_lib_id.hh" @@ -38,8 +39,6 @@ #include "ED_screen.hh" #include "ED_space_api.hh" -#include "PIL_time.h" /* Smooth-view. */ - #include "UI_interface.hh" #include "UI_resources.hh" @@ -372,7 +371,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent fly->ndof = nullptr; #endif - fly->time_lastdraw = fly->time_lastwheel = PIL_check_seconds_timer(); + fly->time_lastdraw = fly->time_lastwheel = BLI_check_seconds_timer(); fly->draw_handle_pixel = ED_region_draw_cb_activate( fly->region->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL); @@ -519,7 +518,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) fly->ndof = nullptr; } /* Update the time else the view will jump when 2D mouse/timer resume. */ - fly->time_lastdraw = PIL_check_seconds_timer(); + fly->time_lastdraw = BLI_check_seconds_timer(); break; } default: { @@ -567,7 +566,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) fly->speed = fabsf(fly->speed); } - time_currwheel = PIL_check_seconds_timer(); + time_currwheel = BLI_check_seconds_timer(); time_wheel = float(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; /* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast). */ @@ -592,7 +591,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) fly->speed = -fabsf(fly->speed); } - time_currwheel = PIL_check_seconds_timer(); + time_currwheel = BLI_check_seconds_timer(); time_wheel = float(time_currwheel - fly->time_lastwheel); fly->time_lastwheel = time_currwheel; /* 0-0.5 -> 0-5.0 */ @@ -849,7 +848,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) #ifdef NDOF_FLY_DRAW_TOOMUCH fly->redraw = 1; #endif - time_current = PIL_check_seconds_timer(); + time_current = BLI_check_seconds_timer(); time_redraw = float(time_current - fly->time_lastdraw); /* Clamp redraw time to avoid jitter in roll correction. */ @@ -1023,7 +1022,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) } else { /* We're not redrawing but we need to update the time else the view will jump. */ - fly->time_lastdraw = PIL_check_seconds_timer(); + fly->time_lastdraw = BLI_check_seconds_timer(); } /* End drawing. */ copy_v3_v3(fly->dvec_prev, dvec); diff --git a/source/blender/editors/space_view3d/view3d_navigate_view_zoom.cc b/source/blender/editors/space_view3d/view3d_navigate_view_zoom.cc index 52cac636ec1..d22da117cfa 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_view_zoom.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_view_zoom.cc @@ -8,6 +8,7 @@ #include "BLI_math_vector.h" #include "BLI_rect.h" +#include "BLI_time.h" #include "BKE_context.hh" #include "BKE_screen.hh" @@ -20,8 +21,6 @@ #include "ED_screen.hh" -#include "PIL_time.h" - #include "view3d_intern.h" #include "view3d_navigate.hh" /* own include */ @@ -163,7 +162,7 @@ static float viewzoom_scale_value(const rcti *winrct, float zfac; if (viewzoom == USER_ZOOM_CONTINUE) { - double time = PIL_check_seconds_timer(); + double time = BLI_check_seconds_timer(); float time_step = float(time - *r_timer_lastdraw); float fac; @@ -516,7 +515,7 @@ static int viewzoom_invoke_impl(bContext *C, if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vod->timer = WM_event_timer_add(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); - vod->prev.time = PIL_check_seconds_timer(); + vod->prev.time = BLI_check_seconds_timer(); } return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.cc b/source/blender/editors/space_view3d/view3d_navigate_walk.cc index 636350118e3..ddcd34623da 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_walk.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_walk.cc @@ -22,6 +22,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_rect.h" +#include "BLI_time.h" /* Smooth-view. */ #include "BLI_utildefines.h" #include "BKE_context.hh" @@ -38,8 +39,6 @@ #include "ED_space_api.hh" #include "ED_transform_snap_object_context.hh" -#include "PIL_time.h" /* Smooth-view. */ - #include "UI_interface.hh" #include "UI_resources.hh" @@ -624,7 +623,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const int walk->need_rotation_keyframe = false; walk->need_translation_keyframe = false; - walk->time_lastdraw = PIL_check_seconds_timer(); + walk->time_lastdraw = BLI_check_seconds_timer(); walk->draw_handle_pixel = ED_region_draw_cb_activate( walk->region->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL); @@ -765,7 +764,7 @@ static void walkEvent(WalkInfo *walk, const wmEvent *event) } /* Update the time else the view will jump when 2D mouse/timer resume. */ - walk->time_lastdraw = PIL_check_seconds_timer(); + walk->time_lastdraw = BLI_check_seconds_timer(); break; } @@ -886,7 +885,7 @@ static void walkEvent(WalkInfo *walk, const wmEvent *event) float t; /* Delta time. */ - t = float(PIL_check_seconds_timer() - walk->teleport.initial_time); + t = float(BLI_check_seconds_timer() - walk->teleport.initial_time); /* Reduce the velocity, if JUMP wasn't hold for long enough. */ t = min_ff(t, JUMP_TIME_MAX); @@ -911,7 +910,7 @@ static void walkEvent(WalkInfo *walk, const wmEvent *event) walk->gravity_state = WALK_GRAVITY_STATE_JUMP; walk->speed_jump = JUMP_SPEED_MAX; - walk->teleport.initial_time = PIL_check_seconds_timer(); + walk->teleport.initial_time = BLI_check_seconds_timer(); copy_v3_v3(walk->teleport.origin, walk->rv3d->viewinv[3]); /* Using previous vector because WASD keys are not called when SPACE is. */ @@ -939,7 +938,7 @@ static void walkEvent(WalkInfo *walk, const wmEvent *event) teleport->navigation_mode = walk->navigation_mode; } teleport->state = WALK_TELEPORT_STATE_ON; - teleport->initial_time = PIL_check_seconds_timer(); + teleport->initial_time = BLI_check_seconds_timer(); teleport->duration = U.walk_navigation.teleport_time; walk_navigation_mode_set(walk, WALK_MODE_FREE); @@ -1088,7 +1087,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) #ifdef NDOF_WALK_DRAW_TOOMUCH walk->redraw = true; #endif - time_current = PIL_check_seconds_timer(); + time_current = BLI_check_seconds_timer(); time_redraw = float(time_current - walk->time_lastdraw); /* Clamp redraw time to avoid jitter in roll correction. */ @@ -1331,7 +1330,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) } else { /* Hijack the teleport variables. */ - walk->teleport.initial_time = PIL_check_seconds_timer(); + walk->teleport.initial_time = BLI_check_seconds_timer(); walk->gravity_state = WALK_GRAVITY_STATE_ON; walk->teleport.duration = 0.0f; @@ -1344,7 +1343,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) if (ELEM(walk->gravity_state, WALK_GRAVITY_STATE_ON, WALK_GRAVITY_STATE_JUMP)) { float ray_distance, difference = -100.0f; /* Delta time. */ - const float t = float(PIL_check_seconds_timer() - walk->teleport.initial_time); + const float t = float(BLI_check_seconds_timer() - walk->teleport.initial_time); /* Keep moving if we were moving. */ copy_v2_v2(dvec, walk->teleport.direction); @@ -1387,7 +1386,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) float cur_loc[3]; /* Linear interpolation. */ - t = float(PIL_check_seconds_timer() - walk->teleport.initial_time); + t = float(BLI_check_seconds_timer() - walk->teleport.initial_time); t /= walk->teleport.duration; /* Clamp so we don't go past our limit. */ @@ -1418,7 +1417,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) } else { /* We're not redrawing but we need to update the time else the view will jump. */ - walk->time_lastdraw = PIL_check_seconds_timer(); + walk->time_lastdraw = BLI_check_seconds_timer(); } /* End drawing. */ copy_v3_v3(walk->dvec_prev, dvec); diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index 3ffcbbc20eb..aa2ffe1b15f 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -104,7 +104,7 @@ #include "view3d_intern.h" /* own include */ -// #include "PIL_time_utildefines.h" +// #include "BLI_time_utildefines.h" /* -------------------------------------------------------------------- */ /** \name Public Utilities diff --git a/source/blender/editors/transform/transform_generics.cc b/source/blender/editors/transform/transform_generics.cc index 40d5a29c659..2c0663a60ca 100644 --- a/source/blender/editors/transform/transform_generics.cc +++ b/source/blender/editors/transform/transform_generics.cc @@ -16,8 +16,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_rand.h" - -#include "PIL_time.h" +#include "BLI_time.h" #include "BLT_translation.h" @@ -1329,7 +1328,7 @@ void calculatePropRatio(TransInfo *t) case PROP_RANDOM: if (t->rng == nullptr) { /* Lazy initialization. */ - uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX); + uint rng_seed = uint(BLI_check_seconds_timer_i() & UINT_MAX); t->rng = BLI_rng_new(rng_seed); } td->factor = BLI_rng_get_float(t->rng) * dist; diff --git a/source/blender/editors/transform/transform_snap.cc b/source/blender/editors/transform/transform_snap.cc index e8733c125f1..7cbb54fe9ab 100644 --- a/source/blender/editors/transform/transform_snap.cc +++ b/source/blender/editors/transform/transform_snap.cc @@ -8,13 +8,12 @@ #include -#include "PIL_time.h" - #include "DNA_windowmanager_types.h" #include "BLI_blenlib.h" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "GPU_immediate.h" @@ -569,7 +568,7 @@ void transform_snap_mixed_apply(TransInfo *t, float *vec) } if (t->tsnap.mode & ~(SCE_SNAP_TO_INCREMENT | SCE_SNAP_TO_GRID)) { - double current = PIL_check_seconds_timer(); + double current = BLI_check_seconds_timer(); /* Time base quirky code to go around find-nearest slowness. */ /* TODO: add exception for object mode, no need to slow it down then. */ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc index ac1449d7c29..fa8171010d8 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc @@ -29,6 +29,7 @@ #include "BLI_math_vector.h" #include "BLI_memarena.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_uvproject.h" #include "BLI_vector.hh" @@ -55,8 +56,6 @@ #include "GEO_uv_pack.hh" #include "GEO_uv_parametrizer.hh" -#include "PIL_time.h" - #include "UI_interface.hh" #include "UI_resources.hh" #include "UI_view2d.hh" @@ -806,7 +805,7 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op) ms->iterations = RNA_int_get(op->ptr, "iterations"); ms->i = 0; ms->handle = construct_param_handle_multi(scene, objects, objects_len, &options); - ms->lasttime = PIL_check_seconds_timer(); + ms->lasttime = BLI_check_seconds_timer(); blender::geometry::uv_parametrizer_stretch_begin(ms->handle); if (ms->blend != 0.0f) { @@ -832,7 +831,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac ms->i++; RNA_int_set(op->ptr, "iterations", ms->i); - if (interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) { + if (interactive && (BLI_check_seconds_timer() - ms->lasttime > 0.5)) { char str[UI_MAX_DRAW_STR]; blender::geometry::uv_parametrizer_flush(ms->handle); @@ -843,7 +842,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac ED_workspace_status_text(C, RPT_("Press + and -, or scroll wheel to set blending")); } - ms->lasttime = PIL_check_seconds_timer(); + ms->lasttime = BLI_check_seconds_timer(); for (uint ob_index = 0; ob_index < ms->objects_len; ob_index++) { Object *obedit = ms->objects_edit[ob_index]; @@ -971,11 +970,11 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev break; case TIMER: if (ms->timer == event->customdata) { - double start = PIL_check_seconds_timer(); + double start = BLI_check_seconds_timer(); do { minimize_stretch_iteration(C, op, true); - } while (PIL_check_seconds_timer() - start < 0.01); + } while (BLI_check_seconds_timer() - start < 0.01); } break; } diff --git a/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_cpu.cc b/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_cpu.cc index 0eafec01c98..35e8ce7e168 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_cpu.cc +++ b/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_cpu.cc @@ -16,11 +16,10 @@ #include "BLI_math_rotation.h" #include "BLI_sort.hh" #include "BLI_task.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLI_vector.hh" -#include "PIL_time.h" - #include "BKE_attribute.hh" #include "BKE_camera.h" #include "BKE_collection.h" @@ -2572,7 +2571,7 @@ void lineart_main_load_geometries(Depsgraph *depsgraph, double t_start; if (G.debug_value == 4000) { - t_start = PIL_check_seconds_timer(); + t_start = BLI_check_seconds_timer(); } int thread_count = ld->thread_count; @@ -2682,7 +2681,7 @@ void lineart_main_load_geometries(Depsgraph *depsgraph, } if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art loading time: %lf\n", t_elapsed); printf("Discarded %d object from bound box check\n", bound_box_discard_count); } @@ -4716,7 +4715,7 @@ void lineart_main_add_triangles(LineartData *ld) { double t_start; if (G.debug_value == 4000) { - t_start = PIL_check_seconds_timer(); + t_start = BLI_check_seconds_timer(); } /* Initialize per-thread data for thread task scheduling information and storing intersection @@ -4739,7 +4738,7 @@ void lineart_main_add_triangles(LineartData *ld) lineart_destroy_isec_thread(&d); if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art intersection time: %f\n", t_elapsed); } } @@ -5006,7 +5005,7 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, double t_start; if (G.debug_value == 4000) { - t_start = PIL_check_seconds_timer(); + t_start = BLI_check_seconds_timer(); } bool use_render_camera_override = false; @@ -5180,7 +5179,7 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, if (G.debug_value == 4000) { lineart_count_and_print_render_buffer_memory(ld); - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art total time: %lf\n", t_elapsed); } diff --git a/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_shadow.cc b/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_shadow.cc index e621a94736e..eec9a8594e8 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_shadow.cc +++ b/source/blender/gpencil_modifiers_legacy/intern/lineart/lineart_shadow.cc @@ -20,6 +20,8 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" +#include "BLI_task.h" +#include "BLI_time.h" #include "DEG_depsgraph_query.hh" @@ -32,9 +34,6 @@ #include "MEM_guardedalloc.h" -#include "BLI_task.h" -#include "PIL_time.h" - /* Shadow loading etc. ================== */ LineartElementLinkNode *lineart_find_matching_eln(ListBase *shadow_elns, int obindex) @@ -1152,7 +1151,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph, double t_start; if (G.debug_value == 4000) { - t_start = PIL_check_seconds_timer(); + t_start = BLI_check_seconds_timer(); } bool is_persp = true; @@ -1284,7 +1283,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph, } if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art shadow stage 1 time: %f\n", t_elapsed); } @@ -1368,7 +1367,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld) { double t_start; if (G.debug_value == 4000) { - t_start = PIL_check_seconds_timer(); + t_start = BLI_check_seconds_timer(); } if (shadow_ld || ld->conf.shadow_use_silhouette) { @@ -1379,7 +1378,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld) } if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art shadow stage 2 cast and silhouette time: %f\n", t_elapsed); } @@ -1428,7 +1427,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld) lineart_shadow_register_enclosed_shapes(ld, shadow_ld); if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; + double t_elapsed = BLI_check_seconds_timer() - t_start; printf("Line art shadow stage 2 total time: %f\n", t_elapsed); } } diff --git a/source/blender/gpu/intern/gpu_codegen.cc b/source/blender/gpu/intern/gpu_codegen.cc index 2e813fc3174..da6060a4a72 100644 --- a/source/blender/gpu/intern/gpu_codegen.cc +++ b/source/blender/gpu/intern/gpu_codegen.cc @@ -20,10 +20,9 @@ #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" -#include "PIL_time.h" - #include "BKE_cryptomatte.hh" #include "BKE_material.h" @@ -953,7 +952,7 @@ void GPU_pass_release(GPUPass *pass) void GPU_pass_cache_garbage_collect() { const int shadercollectrate = 60; /* hardcoded for now. */ - int ctime = int(PIL_check_seconds_timer()); + int ctime = int(BLI_check_seconds_timer()); BLI_spin_lock(&pass_cache_spin); GPUPass *next, **prev_pass = &pass_cache; diff --git a/source/blender/gpu/intern/gpu_material.cc b/source/blender/gpu/intern/gpu_material.cc index a45d9a779d8..99700c62a8e 100644 --- a/source/blender/gpu/intern/gpu_material.cc +++ b/source/blender/gpu/intern/gpu_material.cc @@ -20,6 +20,7 @@ #include "BLI_listbase.h" #include "BLI_math_vector.h" #include "BLI_string.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_main.hh" @@ -35,8 +36,6 @@ #include "DRW_engine.hh" -#include "PIL_time.h" - #include "gpu_codegen.h" #include "gpu_node_graph.h" @@ -747,7 +746,7 @@ void GPU_material_optimization_status_set(GPUMaterial *mat, eGPUMaterialOptimiza mat->optimization_status = status; if (mat->optimization_status == GPU_MAT_OPTIMIZATION_READY) { /* Reset creation timer to delay optimization pass. */ - mat->creation_time = PIL_check_seconds_timer(); + mat->creation_time = BLI_check_seconds_timer(); } } @@ -761,7 +760,7 @@ bool GPU_material_optimization_ready(GPUMaterial *mat) * to do this quickly to avoid build-up and improve runtime performance. * The threshold just prevents compilations being queued frame after frame. */ const double optimization_time_threshold_s = 1.2; - return ((PIL_check_seconds_timer() - mat->creation_time) >= optimization_time_threshold_s); + return ((BLI_check_seconds_timer() - mat->creation_time) >= optimization_time_threshold_s); } void GPU_material_set_default(GPUMaterial *material, GPUMaterial *default_material) diff --git a/source/blender/gpu/metal/mtl_context.mm b/source/blender/gpu/metal/mtl_context.mm index e2a3b79fa12..63f80822567 100644 --- a/source/blender/gpu/metal/mtl_context.mm +++ b/source/blender/gpu/metal/mtl_context.mm @@ -29,7 +29,7 @@ #include "GPU_vertex_buffer.h" #include "intern/gpu_matrix_private.h" -#include "PIL_time.h" +#include "BLI_time.h" #include #include @@ -2678,7 +2678,7 @@ void present(MTLRenderPassDescriptor *blit_descriptor, } while (MTLContext::max_drawables_in_flight > min_ii(perf_max_drawables, MTL_MAX_DRAWABLES)) { - PIL_sleep_ms(1); + BLI_sleep_ms(1); } /* Present is submitted in its own CMD Buffer to ensure drawable reference released as early as diff --git a/source/blender/gpu/metal/mtl_shader.mm b/source/blender/gpu/metal/mtl_shader.mm index 3c88b1f986a..41a038b009d 100644 --- a/source/blender/gpu/metal/mtl_shader.mm +++ b/source/blender/gpu/metal/mtl_shader.mm @@ -8,7 +8,7 @@ #include "BKE_global.h" -#include "PIL_time.h" +#include "BLI_time.h" #include "BLI_string.h" #include diff --git a/source/blender/gpu/metal/mtl_storage_buffer.mm b/source/blender/gpu/metal/mtl_storage_buffer.mm index 95cf507dc65..b38a5610e57 100644 --- a/source/blender/gpu/metal/mtl_storage_buffer.mm +++ b/source/blender/gpu/metal/mtl_storage_buffer.mm @@ -7,6 +7,7 @@ */ #include "BLI_string.h" +#include "BLI_time.h" #include "GPU_state.h" #include "gpu_backend.hh" @@ -20,8 +21,6 @@ #include "mtl_uniform_buffer.hh" #include "mtl_vertex_buffer.hh" -#include "PIL_time.h" - namespace blender::gpu { /* -------------------------------------------------------------------- */ @@ -431,7 +430,7 @@ void MTLStorageBuf::read(void *data) if (gpu_write_fence_ != nil) { /* Ensure the GPU updates are visible to the host before reading. */ while (gpu_write_fence_.signaledValue < host_read_signal_value_) { - PIL_sleep_ms(1); + BLI_sleep_ms(1); } } diff --git a/source/blender/imbuf/intern/indexer.cc b/source/blender/imbuf/intern/indexer.cc index 1c7c02964b2..01e406e993e 100644 --- a/source/blender/imbuf/intern/indexer.cc +++ b/source/blender/imbuf/intern/indexer.cc @@ -19,13 +19,12 @@ #include "BLI_string.h" #include "BLI_string_utils.hh" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #ifdef _WIN32 # include "BLI_winstuff.h" #endif -#include "PIL_time.h" - #include "IMB_anim.h" #include "IMB_imbuf.h" #include "IMB_indexer.h" @@ -1127,7 +1126,7 @@ static int indexer_performance_get_decode_rate(FFmpegIndexBuilderContext *contex AVFrame *in_frame = av_frame_alloc(); AVPacket *packet = av_packet_alloc(); - const double start = PIL_check_seconds_timer(); + const double start = BLI_check_seconds_timer(); int frames_decoded = 0; while (av_read_frame(context->iFormatCtx, packet) >= 0) { @@ -1153,7 +1152,7 @@ static int indexer_performance_get_decode_rate(FFmpegIndexBuilderContext *contex frames_decoded++; } - const double end = PIL_check_seconds_timer(); + const double end = BLI_check_seconds_timer(); if (end > start + time_period) { break; diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index 2ba700ee8ad..9042699d13b 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -23,8 +23,7 @@ #include "DNA_object_types.h" #include "BLI_math_geom.h" - -#include "PIL_time.h" +#include "BLI_time.h" using Alembic::Abc::IV3fArrayProperty; using Alembic::Abc::PropertyHeader; @@ -243,13 +242,13 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe /* ********************** */ ScopeTimer::ScopeTimer(const char *message) - : m_message(message), m_start(PIL_check_seconds_timer()) + : m_message(message), m_start(BLI_check_seconds_timer()) { } ScopeTimer::~ScopeTimer() { - fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start); + fprintf(stderr, "%s: %fs\n", m_message, BLI_check_seconds_timer() - m_start); } /* ********************** */ diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index 3c601a2cfd7..7e05873715f 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -29,7 +29,7 @@ // #define DEBUG_OVERRIDE_TIMEIT #ifdef DEBUG_OVERRIDE_TIMEIT -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" # include #endif @@ -656,7 +656,7 @@ bool RNA_struct_override_matches(Main *bmain, if (!root_path) { _delta_time_diffing = 0.0f; _num_delta_time_diffing = 0; - _timeit_time_global = PIL_check_seconds_timer(); + _timeit_time_global = BLI_check_seconds_timer(); } #endif @@ -788,7 +788,7 @@ bool RNA_struct_override_matches(Main *bmain, #ifdef DEBUG_OVERRIDE_TIMEIT if (!root_path) { - _timeit_time_diffing = PIL_check_seconds_timer(); + _timeit_time_diffing = BLI_check_seconds_timer(); } #endif @@ -805,7 +805,7 @@ bool RNA_struct_override_matches(Main *bmain, #ifdef DEBUG_OVERRIDE_TIMEIT if (!root_path) { - const float _delta_time = float(PIL_check_seconds_timer() - _timeit_time_diffing); + const float _delta_time = float(BLI_check_seconds_timer() - _timeit_time_diffing); _delta_time_diffing += _delta_time; _num_delta_time_diffing++; } @@ -936,7 +936,7 @@ bool RNA_struct_override_matches(Main *bmain, #ifdef DEBUG_OVERRIDE_TIMEIT if (!root_path) { - const float _delta_time = float(PIL_check_seconds_timer() - _timeit_time_global); + const float _delta_time = float(BLI_check_seconds_timer() - _timeit_time_global); _sum_time_global += _delta_time; _num_time_global++; _sum_time_diffing += _delta_time_diffing; diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.cc b/source/blender/modifiers/intern/MOD_correctivesmooth.cc index a5ac6f10762..8702accc85b 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.cc +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.cc @@ -48,9 +48,9 @@ // #define DEBUG_TIME -#include "PIL_time.h" +#include "BLI_time.h" #ifdef DEBUG_TIME -# include "PIL_time_utildefines.h" +# include "BLI_time_utildefines.h" #endif diff --git a/source/blender/modifiers/intern/MOD_decimate.cc b/source/blender/modifiers/intern/MOD_decimate.cc index 080da680993..df125979f05 100644 --- a/source/blender/modifiers/intern/MOD_decimate.cc +++ b/source/blender/modifiers/intern/MOD_decimate.cc @@ -40,8 +40,8 @@ // #define USE_TIMEIT #ifdef USE_TIMEIT -# include "PIL_time.h" -# include "PIL_time_utildefines.h" +# include "BLI_time.h" +# include "BLI_time_utildefines.h" #endif #include "MOD_ui_common.hh" diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.cc b/source/blender/modifiers/intern/MOD_weightvgproximity.cc index 3c6668431d3..efde71c4194 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.cc +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.cc @@ -60,8 +60,8 @@ // #define USE_TIMEIT #ifdef USE_TIMEIT -# include "PIL_time.h" -# include "PIL_time_utildefines.h" +# include "BLI_time.h" +# include "BLI_time_utildefines.h" #endif /************************************** diff --git a/source/blender/python/intern/bpy_app_timers.cc b/source/blender/python/intern/bpy_app_timers.cc index decd0a838ec..b1fa37bff13 100644 --- a/source/blender/python/intern/bpy_app_timers.cc +++ b/source/blender/python/intern/bpy_app_timers.cc @@ -6,9 +6,10 @@ * \ingroup pythonintern */ +#include "BLI_time.h" #include "BLI_timer.h" #include "BLI_utildefines.h" -#include "PIL_time.h" + #include #include "BPY_extern.h" diff --git a/source/blender/python/intern/bpy_interface.cc b/source/blender/python/intern/bpy_interface.cc index 5df6674fc72..dfc0b9b75a8 100644 --- a/source/blender/python/intern/bpy_interface.cc +++ b/source/blender/python/intern/bpy_interface.cc @@ -87,7 +87,7 @@ static bool py_use_system_env = false; // #define TIME_PY_RUN /* Simple python tests. prints on exit. */ #ifdef TIME_PY_RUN -# include "PIL_time.h" +# include "BLI_time.h" static int bpy_timer_count = 0; /** Time since python starts. */ static double bpy_timer; @@ -126,10 +126,10 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) #ifdef TIME_PY_RUN if (bpy_timer_count == 0) { /* Record time from the beginning. */ - bpy_timer = PIL_check_seconds_timer(); + bpy_timer = BLI_check_seconds_timer(); bpy_timer_run = bpy_timer_run_tot = 0.0; } - bpy_timer_run = PIL_check_seconds_timer(); + bpy_timer_run = BLI_check_seconds_timer(); bpy_timer_count++; #endif @@ -155,7 +155,7 @@ void bpy_context_clear(bContext * /*C*/, const PyGILState_STATE *gilstate) #endif #ifdef TIME_PY_RUN - bpy_timer_run_tot += PIL_check_seconds_timer() - bpy_timer_run; + bpy_timer_run_tot += BLI_check_seconds_timer() - bpy_timer_run; bpy_timer_count++; #endif } @@ -590,7 +590,7 @@ void BPY_python_end(const bool do_python_exit) #ifdef TIME_PY_RUN /* Measure time since Python started. */ - bpy_timer = PIL_check_seconds_timer() - bpy_timer; + bpy_timer = BLI_check_seconds_timer() - bpy_timer; printf("*bpy stats* - "); printf("tot exec: %d, ", bpy_timer_count); diff --git a/source/blender/render/hydra/final_engine.cc b/source/blender/render/hydra/final_engine.cc index 1fc5d85b5e4..c580273e0da 100644 --- a/source/blender/render/hydra/final_engine.cc +++ b/source/blender/render/hydra/final_engine.cc @@ -10,8 +10,8 @@ #include "DNA_scene_types.h" +#include "BLI_time.h" #include "BLI_timecode.h" -#include "PIL_time.h" #include "BKE_lib_id.hh" @@ -72,7 +72,7 @@ void FinalEngine::render() engine_->Execute(render_index_.get(), &t); char elapsed_time[32]; - double time_begin = PIL_check_seconds_timer(); + double time_begin = BLI_check_seconds_timer(); float percent_done = 0.0; while (true) { @@ -82,7 +82,7 @@ void FinalEngine::render() percent_done = renderer_percent_done(); BLI_timecode_string_from_time_simple( - elapsed_time, sizeof(elapsed_time), PIL_check_seconds_timer() - time_begin); + elapsed_time, sizeof(elapsed_time), BLI_check_seconds_timer() - time_begin); notify_status(percent_done / 100.0, std::string(scene_name) + ": " + view_layer->name, std::string("Render Time: ") + elapsed_time + diff --git a/source/blender/render/hydra/viewport_engine.cc b/source/blender/render/hydra/viewport_engine.cc index 2432ba7bbca..4449b947770 100644 --- a/source/blender/render/hydra/viewport_engine.cc +++ b/source/blender/render/hydra/viewport_engine.cc @@ -16,8 +16,8 @@ #include "DNA_view3d_types.h" #include "BLI_math_matrix.h" +#include "BLI_time.h" #include "BLI_timecode.h" -#include "PIL_time.h" #include "BKE_camera.h" #include "BKE_context.hh" @@ -251,13 +251,13 @@ void ViewportEngine::render() GPU_shader_unbind(); if (renderer_percent_done() == 0.0f) { - time_begin_ = PIL_check_seconds_timer(); + time_begin_ = BLI_check_seconds_timer(); } char elapsed_time[32]; BLI_timecode_string_from_time_simple( - elapsed_time, sizeof(elapsed_time), PIL_check_seconds_timer() - time_begin_); + elapsed_time, sizeof(elapsed_time), BLI_check_seconds_timer() - time_begin_); float percent_done = renderer_percent_done(); if (!render_task_delegate_->is_converged()) { diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc index 634d3ded276..bef4c7d5346 100644 --- a/source/blender/render/intern/pipeline.cc +++ b/source/blender/render/intern/pipeline.cc @@ -35,6 +35,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_timecode.h" #include "BLI_vector.hh" @@ -77,7 +78,6 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_metadata.h" -#include "PIL_time.h" #include "RE_engine.h" #include "RE_pipeline.h" @@ -202,7 +202,7 @@ static void stats_background(void * /*arg*/, RenderStats *rs) megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); BLI_timecode_string_from_time_simple( - info_time_str, sizeof(info_time_str), PIL_check_seconds_timer() - rs->starttime); + info_time_str, sizeof(info_time_str), BLI_check_seconds_timer() - rs->starttime); /* Compositor calls this from multiple threads, mutex lock to ensure we don't * get garbled output. */ @@ -791,7 +791,7 @@ void RE_InitState(Render *re, re->ok = true; /* maybe flag */ - re->i.starttime = PIL_check_seconds_timer(); + re->i.starttime = BLI_check_seconds_timer(); /* copy render data and render layers for thread safety */ render_copy_renderdata(&re->r, rd); @@ -1461,7 +1461,7 @@ static void do_render_full_pipeline(Render *re) BKE_scene_camera_switch_update(re->scene); - re->i.starttime = PIL_check_seconds_timer(); + re->i.starttime = BLI_check_seconds_timer(); /* ensure no images are in memory from previous animated sequences */ BKE_image_all_free_anim_ibufs(re->main, re->r.cfra); @@ -1484,7 +1484,7 @@ static void do_render_full_pipeline(Render *re) do_render_compositor(re); } - re->i.lastframetime = PIL_check_seconds_timer() - re->i.starttime; + re->i.lastframetime = BLI_check_seconds_timer() - re->i.starttime; re->stats_draw(&re->i); @@ -2159,7 +2159,7 @@ static bool do_write_image_or_movie(Render *re, } render_time = re->i.lastframetime; - re->i.lastframetime = PIL_check_seconds_timer() - re->i.starttime; + re->i.lastframetime = BLI_check_seconds_timer() - re->i.starttime; BLI_timecode_string_from_time_simple(filepath, sizeof(filepath), re->i.lastframetime); printf("Time: %s", filepath); diff --git a/source/blender/simulation/intern/implicit_blender.cc b/source/blender/simulation/intern/implicit_blender.cc index 670d86a4470..fed6298ec94 100644 --- a/source/blender/simulation/intern/implicit_blender.cc +++ b/source/blender/simulation/intern/implicit_blender.cc @@ -39,7 +39,7 @@ // #define DEBUG_TIME # ifdef DEBUG_TIME -# include "PIL_time.h" +# include "BLI_time.h" # endif static float I[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; @@ -964,7 +964,7 @@ static int cg_filtered_pre(lfVector *dv, delta0 = deltaNew * sqrt(conjgrad_epsilon); # ifdef DEBUG_TIME - double start = PIL_check_seconds_timer(); + double start = BLI_check_seconds_timer(); # endif while ((deltaNew > delta0) && (iterations < conjgrad_looplimit)) { @@ -992,7 +992,7 @@ static int cg_filtered_pre(lfVector *dv, } # ifdef DEBUG_TIME - double end = PIL_check_seconds_timer(); + double end = BLI_check_seconds_timer(); printf("cg_filtered_pre time: %f\n", float(end - start)); # endif @@ -1073,7 +1073,7 @@ static int cg_filtered_pre(lfVector *dv, # endif # ifdef DEBUG_TIME - double start = PIL_check_seconds_timer(); + double start = BLI_check_seconds_timer(); # endif tol = (0.01 * 0.2); @@ -1103,7 +1103,7 @@ static int cg_filtered_pre(lfVector *dv, } # ifdef DEBUG_TIME - double end = PIL_check_seconds_timer(); + double end = BLI_check_seconds_timer(); printf("cg_filtered_pre time: %f\n", float(end - start)); # endif @@ -1136,7 +1136,7 @@ bool SIM_mass_spring_solve_velocities(Implicit_Data *data, float dt, ImplicitSol add_lfvectorS_lfvectorS(data->B, data->F, dt, dFdXmV, (dt * dt), numverts); # ifdef DEBUG_TIME - double start = PIL_check_seconds_timer(); + double start = BLI_check_seconds_timer(); # endif /* Conjugate gradient algorithm to solve Ax=b. */ @@ -1145,7 +1145,7 @@ bool SIM_mass_spring_solve_velocities(Implicit_Data *data, float dt, ImplicitSol // cg_filtered_pre(id->dV, id->A, id->B, id->z, id->S, id->P, id->Pinv, id->bigI); # ifdef DEBUG_TIME - double end = PIL_check_seconds_timer(); + double end = BLI_check_seconds_timer(); printf("cg_filtered calc time: %f\n", float(end - start)); # endif diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 9a46b8bfad9..13141962f94 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -40,12 +40,11 @@ #include "BLI_math_time.h" #include "BLI_system.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_timer.h" #include "BLI_utildefines.h" #include BLI_SYSTEM_PID_H -#include "PIL_time.h" - #include "BLO_readfile.h" #include "BLT_translation.h" @@ -1022,7 +1021,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) BlendFileReadReport bf_reports{}; bf_reports.reports = reports; - bf_reports.duration.whole = PIL_check_seconds_timer(); + bf_reports.duration.whole = BLI_check_seconds_timer(); BlendFileData *bfd = BKE_blendfile_read(filepath, ¶ms, &bf_reports); if (bfd != nullptr) { wm_file_read_pre(use_data, use_userdef); @@ -1069,7 +1068,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) read_file_post_params.is_alloc = false; wm_file_read_post(C, filepath, &read_file_post_params); - bf_reports.duration.whole = PIL_check_seconds_timer() - bf_reports.duration.whole; + bf_reports.duration.whole = BLI_check_seconds_timer() - bf_reports.duration.whole; file_read_reports_finalize(&bf_reports); success = true; diff --git a/source/blender/windowmanager/intern/wm_jobs.cc b/source/blender/windowmanager/intern/wm_jobs.cc index b5aef41cc03..9a201383c44 100644 --- a/source/blender/windowmanager/intern/wm_jobs.cc +++ b/source/blender/windowmanager/intern/wm_jobs.cc @@ -16,6 +16,7 @@ #include "BLI_blenlib.h" #include "BLI_threads.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_context.hh" @@ -29,8 +30,6 @@ #include "wm.hh" #include "wm_event_types.hh" -#include "PIL_time.h" - /* * Add new job * - register in WM @@ -498,7 +497,7 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job) wm_job->wt = WM_event_timer_add(wm, wm_job->win, TIMERJOBS, time_step); } - wm_job->start_time = PIL_check_seconds_timer(); + wm_job->start_time = BLI_check_seconds_timer(); } else { printf("job fails, not initialized\n"); @@ -680,7 +679,7 @@ void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt) if (G.debug & G_DEBUG_JOBS) { printf("Job '%s' finished in %f seconds\n", wm_job->name, - PIL_check_seconds_timer() - wm_job->start_time); + BLI_check_seconds_timer() - wm_job->start_time); } wm_job->running = false; diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index 749004deff2..e9554a5764d 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -35,14 +35,13 @@ #include "BLT_translation.h" -#include "PIL_time.h" - #include "BLI_blenlib.h" #include "BLI_dial_2d.h" #include "BLI_dynstr.h" /* For #WM_operator_pystring. */ #include "BLI_math_rotation.h" #include "BLI_math_vector_types.hh" #include "BLI_string_utils.hh" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_anim_data.h" @@ -3660,7 +3659,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) WM_cursor_wait(true); - double time_start = PIL_check_seconds_timer(); + double time_start = BLI_check_seconds_timer(); wm_window_make_drawable(wm, win); @@ -3670,14 +3669,14 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) iter_steps += 1; if (time_limit != 0.0) { - if ((PIL_check_seconds_timer() - time_start) > time_limit) { + if ((BLI_check_seconds_timer() - time_start) > time_limit) { break; } a = 0; } } - double time_delta = (PIL_check_seconds_timer() - time_start) * 1000; + double time_delta = (BLI_check_seconds_timer() - time_start) * 1000; RNA_enum_description(redraw_timer_type_items, type, &infostr); diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index 29eb433ea99..fa63da98d83 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -28,8 +28,6 @@ #endif #include "MEM_guardedalloc.h" -#include "PIL_time.h" - #include "CLG_log.h" #include "BLI_fileops.h" @@ -39,6 +37,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_system.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "IMB_colormanagement.h" @@ -487,7 +486,7 @@ static int pupdate_time() { static double time_last; - double time = PIL_check_seconds_timer(); + double time = BLI_check_seconds_timer(); g_playanim.total_time += (time - time_last); time_last = time; @@ -2023,7 +2022,7 @@ static bool wm_main_playanim_intern(int argc, const char **argv, PlayArgs *args_ #endif while (pupdate_time()) { - PIL_sleep_ms(1); + BLI_sleep_ms(1); } g_playanim.total_time -= g_playanim.swap_time; playanim_toscreen(&ps, ps.picture, ibuf); @@ -2054,7 +2053,7 @@ static bool wm_main_playanim_intern(int argc, const char **argv, PlayArgs *args_ } playanim_change_frame(&ps); if (!has_event) { - PIL_sleep_ms(1); + BLI_sleep_ms(1); } if (ps.wait) { continue; diff --git a/source/blender/windowmanager/intern/wm_tooltip.cc b/source/blender/windowmanager/intern/wm_tooltip.cc index 3e8995f71a3..8f0605a8543 100644 --- a/source/blender/windowmanager/intern/wm_tooltip.cc +++ b/source/blender/windowmanager/intern/wm_tooltip.cc @@ -11,6 +11,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math_vector.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BKE_context.hh" @@ -22,8 +23,6 @@ #include "WM_api.hh" #include "WM_types.hh" -#include "PIL_time.h" - static double g_tooltip_time_closed; double WM_tooltip_time_closed() { @@ -89,7 +88,7 @@ void WM_tooltip_clear(bContext *C, wmWindow *win) if (screen->tool_tip->region) { UI_tooltip_free(C, screen, screen->tool_tip->region); screen->tool_tip->region = nullptr; - g_tooltip_time_closed = PIL_check_seconds_timer(); + g_tooltip_time_closed = BLI_check_seconds_timer(); } MEM_freeN(screen->tool_tip); screen->tool_tip = nullptr; diff --git a/source/blender/windowmanager/intern/wm_window.cc b/source/blender/windowmanager/intern/wm_window.cc index 3b9d8fd4d18..9e7e6e3eacb 100644 --- a/source/blender/windowmanager/intern/wm_window.cc +++ b/source/blender/windowmanager/intern/wm_window.cc @@ -28,6 +28,7 @@ #include "BLI_blenlib.h" #include "BLI_system.h" +#include "BLI_time.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -71,8 +72,6 @@ #include "UI_interface.hh" #include "UI_interface_icons.hh" -#include "PIL_time.h" - #include "BLF_api.h" #include "GPU_batch.h" #include "GPU_batch_presets.h" @@ -1727,7 +1726,7 @@ static bool wm_window_timers_process(const bContext *C, int *sleep_us_p) { Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); - const double time = PIL_check_seconds_timer(); + const double time = BLI_check_seconds_timer(); bool has_event = false; const int sleep_us = *sleep_us_p; @@ -1834,11 +1833,11 @@ void wm_window_events_process(const bContext *C) * events are typically generated from a timer that runs in the main loop. */ if ((has_event == false) && (sleep_us != 0) && !(G.f & G_FLAG_EVENT_SIMULATE)) { if (sleep_us == sleep_us_default) { - /* NOTE(@ideasman42): prefer #PIL_sleep_ms over `sleep_for(..)` in the common case + /* NOTE(@ideasman42): prefer #BLI_sleep_ms over `sleep_for(..)` in the common case * because this function uses lower resolution (millisecond) resolution sleep timers * which are tried & true for the idle loop. We could move to C++ `sleep_for(..)` * if this works well on all platforms but this needs further testing. */ - PIL_sleep_ms(sleep_us_default / 1000); + BLI_sleep_ms(sleep_us_default / 1000); } else { /* The time was shortened to resume for the upcoming timer, use a high resolution sleep. @@ -2099,7 +2098,7 @@ wmTimer *WM_event_timer_add(wmWindowManager *wm, wmWindow *win, int event_type, BLI_assert(time_step >= 0.0f); wt->event_type = event_type; - wt->time_last = PIL_check_seconds_timer(); + wt->time_last = BLI_check_seconds_timer(); wt->time_next = wt->time_last + time_step; wt->time_start = wt->time_last; wt->time_step = time_step; @@ -2119,7 +2118,7 @@ wmTimer *WM_event_timer_add_notifier(wmWindowManager *wm, BLI_assert(time_step >= 0.0f); wt->event_type = TIMERNOTIFIER; - wt->time_last = PIL_check_seconds_timer(); + wt->time_last = BLI_check_seconds_timer(); wt->time_next = wt->time_last + time_step; wt->time_start = wt->time_last; wt->time_step = time_step; diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.cc b/source/blender/windowmanager/xr/intern/wm_xr_operators.cc index ad6b951ac59..a10251a2f6b 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_operators.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.cc @@ -15,6 +15,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" +#include "BLI_time.h" #include "BKE_context.hh" #include "BKE_global.h" @@ -35,8 +36,6 @@ #include "MEM_guardedalloc.h" -#include "PIL_time.h" - #include "RNA_access.hh" #include "RNA_define.hh" @@ -799,7 +798,7 @@ static void wm_xr_fly_init(wmOperator *op, const wmXrData *xr) op->customdata = MEM_callocN(sizeof(XrFlyData), __func__)); WM_xr_session_state_viewer_pose_rotation_get(xr, data->viewer_rot); - data->time_prev = PIL_check_seconds_timer(); + data->time_prev = BLI_check_seconds_timer(); } static void wm_xr_fly_uninit(wmOperator *op) @@ -953,7 +952,7 @@ static int wm_xr_navigation_fly_modal(bContext *C, wmOperator *op, const wmEvent GHOST_XrPose nav_pose; float nav_mat[4][4], delta[4][4], out[4][4]; - const double time_now = PIL_check_seconds_timer(); + const double time_now = BLI_check_seconds_timer(); mode = (eXrFlyMode)RNA_enum_get(op->ptr, "mode"); turn = ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.cc b/source/blender/windowmanager/xr/intern/wm_xr_session.cc index 0542082c4a4..fac8484085b 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.cc @@ -19,6 +19,7 @@ #include "BLI_math_rotation.h" #include "BLI_math_vector.h" #include "BLI_string.h" +#include "BLI_time.h" #include "DEG_depsgraph.hh" #include "DEG_depsgraph_query.hh" @@ -38,8 +39,6 @@ #include "MEM_guardedalloc.h" -#include "PIL_time.h" - #include "WM_api.hh" #include "WM_types.hh" @@ -1115,7 +1114,7 @@ static void wm_xr_session_events_dispatch(wmXrData *xr, return; } - const int64_t time_now = int64_t(PIL_check_seconds_timer() * 1000); + const int64_t time_now = int64_t(BLI_check_seconds_timer() * 1000); ListBase *active_modal_actions = &action_set->active_modal_actions; ListBase *active_haptic_actions = &action_set->active_haptic_actions;