diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 082635318d..65d8fbb86c 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -613,7 +613,7 @@ static bool ctr_frame(void* data, const void* frame, fflush(stdout); performance_counter_init(ctrframe_f, "ctrframe_f"); - performance_counter_start(ctrframe_f); + performance_counter_start_plus(video_info->is_perfcnt_enable, ctrframe_f); if (ctr->should_resize) ctr_update_viewport(ctr); @@ -842,7 +842,7 @@ static bool ctr_frame(void* data, const void* frame, ctr->current_buffer_top ^= 1; ctr->p3d_event_pending = true; ctr->ppf_event_pending = true; - performance_counter_stop(ctrframe_f); + performance_counter_stop_plus(video_info->is_perfcnt_enable, ctrframe_f); return true; } diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index a4642de862..a7ad7b53de 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -1388,7 +1388,7 @@ static bool d3d_frame(void *data, const void *frame, return true; performance_counter_init(d3d_frame, "d3d_frame"); - performance_counter_start(d3d_frame); + performance_counter_start_plus(video_info->is_perfcnt_enable, d3d_frame); /* We cannot recover in fullscreen. */ if (d3d->needs_restore) @@ -1467,7 +1467,7 @@ static bool d3d_frame(void *data, const void *frame, video_context_driver_update_window_title(video_info); - performance_counter_stop(d3d_frame); + performance_counter_stop_plus(video_info->is_perfcnt_enable, d3d_frame); video_context_driver_swap_buffers(video_info); diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 4a20f27c6f..d92615aa75 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -690,7 +690,7 @@ static INLINE void gl_copy_frame(gl_t *gl, static struct retro_perf_counter copy_frame = {0}; performance_counter_init(copy_frame, "copy_frame"); - performance_counter_start(copy_frame); + performance_counter_start_plus(video_info->is_perfcnt_enable, copy_frame); #if defined(HAVE_PSGL) { @@ -820,7 +820,7 @@ static INLINE void gl_copy_frame(gl_t *gl, glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } #endif - performance_counter_stop(copy_frame); + performance_counter_stop_plus(video_info->is_perfcnt_enable, copy_frame); } static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned idx) @@ -1102,7 +1102,7 @@ static bool gl_frame(void *data, const void *frame, unsigned height = video_info->height; performance_counter_init(frame_run, "frame_run"); - performance_counter_start(frame_run); + performance_counter_start_plus(video_info->is_perfcnt_enable, frame_run); if (!gl) return false; @@ -1293,7 +1293,7 @@ static bool gl_frame(void *data, const void *frame, video_context_driver_update_window_title(video_info); - performance_counter_stop(frame_run); + performance_counter_stop_plus(video_info->is_perfcnt_enable, frame_run); #ifdef HAVE_FBO /* Reset state which could easily mess up libretro core. */ @@ -1354,7 +1354,8 @@ static bool gl_frame(void *data, const void *frame, static struct retro_perf_counter gl_fence = {0}; performance_counter_init(gl_fence, "gl_fence"); - performance_counter_start(gl_fence); + performance_counter_start_plus(video_info->is_perfcnt_enable, + gl_fence); glClear(GL_COLOR_BUFFER_BIT); gl->fences[gl->fence_count++] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); @@ -1370,7 +1371,8 @@ static bool gl_frame(void *data, const void *frame, gl->fence_count * sizeof(GLsync)); } - performance_counter_stop(gl_fence); + performance_counter_stop_plus(video_info->is_perfcnt_enable, + gl_fence); } #endif diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index 81b52901f7..c72670cf7f 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -1452,7 +1452,7 @@ static bool gx_frame(void *data, const void *frame, fps_text_buf[0] = '\0'; performance_counter_init(gx_frame, "gx_frame"); - performance_counter_start(gx_frame); + performance_counter_start_plus(video_info->is_perfcnt_enable, gx_frame); if(!gx || (!frame && !gx->menu_texture_enable)) return true; @@ -1488,7 +1488,7 @@ static bool gx_frame(void *data, const void *frame, static struct retro_perf_counter gx_frame_convert = {0}; performance_counter_init(gx_frame_convert, "gx_frame_convert"); - performance_counter_start(gx_frame_convert); + performance_counter_start_plus(video_info->is_perfcnt_enable, gx_frame_convert); if (gx->rgb32) convert_texture32(frame, g_tex.data, width, height, pitch); @@ -1498,7 +1498,7 @@ static bool gx_frame(void *data, const void *frame, convert_texture16(frame, g_tex.data, width, height, pitch); DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1))); - performance_counter_stop(gx_frame_convert); + performance_counter_stop_plus(video_info->is_perfcnt_enable, gx_frame_convert); } if (gx->menu_texture_enable && gx->menu_data) @@ -1580,7 +1580,7 @@ static bool gx_frame(void *data, const void *frame, VIDEO_SetNextFramebuffer(gx->framebuf[g_current_framebuf]); VIDEO_Flush(); - performance_counter_stop(gx_frame); + performance_counter_stop_plus(video_info->is_perfcnt_enable, gx_frame); return true; } diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index b6fbe757a0..09893d8628 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -535,7 +535,7 @@ static bool psp_frame(void *data, const void *frame, psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers()); performance_counter_init(psp_frame_run, "psp_frame_run"); - performance_counter_start(psp_frame_run); + performance_counter_start_plus(video_info->is_perfcnt_enable, psp_frame_run); if (psp->should_resize) psp_update_viewport(psp, video_info); @@ -568,7 +568,7 @@ static bool psp_frame(void *data, const void *frame, sceGuFinish(); - performance_counter_stop(psp_frame_run); + performance_counter_stop_plus(video_info->is_perfcnt_enable, psp_frame_run); #ifdef HAVE_MENU menu_driver_frame(video_info); diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 95a4b7fcf8..58d0f6a837 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -514,11 +514,11 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, sdl_refresh_input_size(vid, false, vid->video.rgb32, width, height, pitch); performance_counter_init(sdl_copy_frame, "sdl_copy_frame"); - performance_counter_start(sdl_copy_frame); + performance_counter_start_plus(video_info->is_perfcnt_enable, sdl_copy_frame); SDL_UpdateTexture(vid->frame.tex, NULL, frame, pitch); - performance_counter_stop(sdl_copy_frame); + performance_counter_stop_plus(video_info->is_perfcnt_enable, sdl_copy_frame); } SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE); diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 4f78a5f2c9..7f1f0d829c 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -354,7 +354,7 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, SDL_LockSurface(vid->screen); performance_counter_init(sdl_scale, "sdl_scale"); - performance_counter_start(sdl_scale); + performance_counter_start_plus(video_info->is_perfcnt_enable, sdl_scale); video_frame_scale( &vid->scaler, @@ -367,7 +367,7 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, width, height, pitch); - performance_counter_stop(sdl_scale); + performance_counter_stop_plus(video_info->is_perfcnt_enable, sdl_scale); #ifdef HAVE_MENU menu_driver_frame(video_info); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 2f963d5c64..d3802bd60c 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -391,7 +391,7 @@ static bool vg_frame(void *data, const void *frame, unsigned height = video_info->height; performance_counter_init(vg_fr, "vg_fr"); - performance_counter_start(vg_fr); + performance_counter_start_plus(video_info->is_perfcnt_enable, vg_fr); if ( frame_width != vg->mRenderWidth || frame_height != vg->mRenderHeight @@ -416,9 +416,9 @@ static bool vg_frame(void *data, const void *frame, vgSeti(VG_SCISSORING, VG_TRUE); performance_counter_init(vg_image, "vg_image"); - performance_counter_start(vg_image); + performance_counter_start_plus(video_info->is_perfcnt_enable, vg_image); vg_copy_frame(vg, frame, frame_width, frame_height, pitch); - performance_counter_stop(vg_image); + performance_counter_stop_plus(video_info->is_perfcnt_enable, vg_image); #ifdef HAVE_MENU menu_driver_frame(video_info); @@ -433,7 +433,7 @@ static bool vg_frame(void *data, const void *frame, video_context_driver_update_window_title(video_info); - performance_counter_stop(vg_fr); + performance_counter_stop_plus(video_info->is_perfcnt_enable, vg_fr); video_context_driver_swap_buffers(video_info); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 46ae6c0d0d..b6f5b0d1ad 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1554,7 +1554,8 @@ static bool vulkan_frame(void *data, const void *frame, performance_counter_init(begin_cmd, "begin_command"); performance_counter_init(build_cmd, "build_command"); performance_counter_init(end_cmd, "end_command"); - performance_counter_start(frame_run); + + performance_counter_start_plus(video_info->is_perfcnt_enable, frame_run); /* Bookkeeping on start of frame. */ chain = &vk->swapchain[frame_index]; @@ -1564,14 +1565,14 @@ static bool vulkan_frame(void *data, const void *frame, vulkan_buffer_chain_discard(&chain->vbo); vulkan_buffer_chain_discard(&chain->ubo); - performance_counter_start(begin_cmd); + performance_counter_start_plus(video_info->is_perfcnt_enable, begin_cmd); /* Start recording the command buffer. */ vk->cmd = chain->cmd; begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkResetCommandBuffer(vk->cmd, 0); vkBeginCommandBuffer(vk->cmd, &begin_info); - performance_counter_stop(begin_cmd); + performance_counter_stop_plus(video_info->is_perfcnt_enable, begin_cmd); memset(&vk->tracker, 0, sizeof(vk->tracker)); @@ -1596,7 +1597,7 @@ static bool vulkan_frame(void *data, const void *frame, } /* Upload texture */ - performance_counter_start(copy_frame); + performance_counter_start_plus(video_info->is_perfcnt_enable, copy_frame); if (frame && !vk->hw.enable) { unsigned y; @@ -1647,13 +1648,13 @@ static bool vulkan_frame(void *data, const void *frame, vk->last_valid_index = frame_index; } - performance_counter_stop(copy_frame); + performance_counter_stop_plus(video_info->is_perfcnt_enable, copy_frame); /* Notify filter chain about the new sync index. */ vulkan_filter_chain_notify_sync_index((vulkan_filter_chain_t*)vk->filter_chain, frame_index); vulkan_filter_chain_set_frame_count((vulkan_filter_chain_t*)vk->filter_chain, frame_count); - performance_counter_start(build_cmd); + performance_counter_start_plus(video_info->is_perfcnt_enable, build_cmd); /* Render offscreen filter chain passes. */ { /* Set the source texture in the filter chain */ @@ -1781,7 +1782,7 @@ static bool vulkan_frame(void *data, const void *frame, if (vk->overlay.enable) vulkan_render_overlay(vk, video_info); #endif - performance_counter_stop(build_cmd); + performance_counter_stop_plus(video_info->is_perfcnt_enable, build_cmd); /* End the render pass. We're done rendering to backbuffer now. */ vkCmdEndRenderPass(vk->cmd); @@ -1850,9 +1851,9 @@ static bool vulkan_frame(void *data, const void *frame, vk->context->graphics_queue_index, vk->hw.src_queue_family); } - performance_counter_start(end_cmd); + performance_counter_start_plus(video_info->is_perfcnt_enable, end_cmd); vkEndCommandBuffer(vk->cmd); - performance_counter_stop(end_cmd); + performance_counter_stop_plus(video_info->is_perfcnt_enable, end_cmd); /* Submit command buffers to GPU. */ @@ -1894,9 +1895,9 @@ static bool vulkan_frame(void *data, const void *frame, } submit_info.pSignalSemaphores = submit_info.signalSemaphoreCount ? signal_semaphores : NULL; - performance_counter_stop(frame_run); + performance_counter_stop_plus(video_info->is_perfcnt_enable, frame_run); - performance_counter_start(queue_submit); + performance_counter_start_plus(video_info->is_perfcnt_enable, queue_submit); #ifdef HAVE_THREADS slock_lock(vk->context->queue_lock); @@ -1906,11 +1907,11 @@ static bool vulkan_frame(void *data, const void *frame, #ifdef HAVE_THREADS slock_unlock(vk->context->queue_lock); #endif - performance_counter_stop(queue_submit); + performance_counter_stop_plus(video_info->is_perfcnt_enable, queue_submit); - performance_counter_start(swapbuffers); + performance_counter_start_plus(video_info->is_perfcnt_enable, swapbuffers); video_context_driver_swap_buffers(video_info); - performance_counter_stop(swapbuffers); + performance_counter_stop_plus(video_info->is_perfcnt_enable, swapbuffers); if (!vk->context->swap_interval_emulation_lock) video_context_driver_update_window_title(video_info); diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 0ab40aee6d..a07ad7c84a 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -618,7 +618,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame, static struct retro_perf_counter gfx_frame_perf = {0}; performance_counter_init(gfx_frame_perf, "gfx_frame"); - performance_counter_start(gfx_frame_perf); + performance_counter_start_plus(video_info->is_perfcnt_enable, gfx_frame_perf); if (wiiu->should_resize) wiiu_gfx_update_viewport(wiiu); @@ -702,7 +702,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame, GX2SwapScanBuffers(); GX2Flush(); - performance_counter_stop(gfx_frame_perf); + performance_counter_stop_plus(video_info->is_perfcnt_enable, gfx_frame_perf); return true; } diff --git a/gfx/video_driver.c b/gfx/video_driver.c index dfd13f914a..88d69eb559 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1102,11 +1102,11 @@ static bool video_driver_frame_filter( *output_pitch = (*output_width) * video_driver_state_out_bpp; - performance_counter_start(softfilter_process); + performance_counter_start_plus(video_info->is_perfcnt_enable, softfilter_process); rarch_softfilter_process(video_driver_state_filter, video_driver_state_buffer, *output_pitch, data, width, height, pitch); - performance_counter_stop(softfilter_process); + performance_counter_stop_plus(video_info->is_perfcnt_enable, softfilter_process); if (video_info->post_filter_record && recording_data) recording_dump_frame(video_driver_state_buffer,