Remove the few performance counters that depend on runloop_ctl

This commit is contained in:
twinaphex 2017-01-25 18:15:58 +01:00
parent 44ef975e7a
commit 374fd57270
9 changed files with 5 additions and 89 deletions

View file

@ -41,7 +41,6 @@
#include <compat/strl.h>
#include "../camera_driver.h"
#include "../../performance_counters.h"
#include "../../verbosity.h"
struct buffer
@ -66,16 +65,6 @@ typedef struct video4linux
char dev_name[255];
} video4linux_t;
static void process_image(video4linux_t *v4l, const uint8_t *buffer_yuv)
{
static struct retro_perf_counter yuv_convert_direct = {0};
performance_counter_init(yuv_convert_direct, "yuv_convert_direct");
performance_counter_start(yuv_convert_direct);
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, buffer_yuv);
performance_counter_stop(yuv_convert_direct);
}
static int xioctl(int fd, int request, void *args)
{
int r;
@ -385,7 +374,7 @@ static bool preprocess_image(void *data)
retro_assert(buf.index < v4l->n_buffers);
process_image(v4l, (const uint8_t*)v4l->buffers[buf.index].start);
scaler_ctx_scale(&v4l->scaler, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start);
if (xioctl(v4l->fd, (uint8_t)VIDIOC_QBUF, &buf) == -1)
RARCH_ERR("VIDIOC_QBUF\n");

View file

@ -29,7 +29,6 @@
#include "vulkan_common.h"
#include "../../configuration.h"
#include "../../performance_counters.h"
static dylib_t vulkan_library;
static VkInstance cached_instance;
@ -2239,12 +2238,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
if (*next_fence != VK_NULL_HANDLE)
{
static struct retro_perf_counter fence_wait = {0};
performance_counter_init(fence_wait, "fence_wait");
performance_counter_start(fence_wait);
vkWaitForFences(vk->context.device, 1, next_fence, true, UINT64_MAX);
performance_counter_stop(fence_wait);
vkResetFences(vk->context.device, 1, next_fence);
}

View file

@ -36,7 +36,6 @@
#include "render_chain_driver.h"
#include "../../video_driver.h"
#include "../../../performance_counters.h"
#include "../../../configuration.h"
#include "../../../verbosity.h"
@ -1526,13 +1525,9 @@ static bool cg_d3d9_renderchain_read_viewport(void *data, uint8_t *buffer)
bool ret = true;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
static struct retro_perf_counter d3d_read_viewport = {0};
video_driver_get_size(&width, &height);
performance_counter_init(d3d_read_viewport, "d3d_read_viewport");
performance_counter_start(d3d_read_viewport);
(void)data;
(void)buffer;
@ -1583,7 +1578,6 @@ static bool cg_d3d9_renderchain_read_viewport(void *data, uint8_t *buffer)
ret = false;
end:
performance_counter_stop(d3d_read_viewport);
if (target)
target->Release();
if (dest)

View file

@ -980,8 +980,6 @@ static struct video_shader *gl_get_current_shader(void *data)
#if defined(HAVE_GL_ASYNC_READBACK)
static void gl_pbo_async_readback(gl_t *gl)
{
static struct retro_perf_counter async_readback = {0};
glBindBuffer(GL_PIXEL_PACK_BUFFER,
gl->pbo_readback[gl->pbo_readback_index++]);
gl->pbo_readback_index &= 3;
@ -994,8 +992,6 @@ static void gl_pbo_async_readback(gl_t *gl)
video_pixel_get_alignment(gl->vp.width * sizeof(uint32_t)));
/* Read asynchronously into PBO buffer. */
performance_counter_init(async_readback, "async_readback");
performance_counter_start(async_readback);
glReadBuffer(GL_BACK);
#ifdef HAVE_OPENGLES3
glReadPixels(gl->vp.x, gl->vp.y,
@ -1006,7 +1002,6 @@ static void gl_pbo_async_readback(gl_t *gl)
gl->vp.width, gl->vp.height,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
#endif
performance_counter_stop(async_readback);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
}
@ -2364,7 +2359,6 @@ static void gl_viewport_info(void *data, struct video_viewport *vp)
static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
#ifndef NO_GL_READ_PIXELS
static struct retro_perf_counter read_viewport = {0};
unsigned num_pixels = 0;
gl_t *gl = (gl_t*)data;
@ -2373,9 +2367,6 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle)
context_bind_hw_render(false);
performance_counter_init(read_viewport, "read_viewport");
performance_counter_start(read_viewport);
num_pixels = gl->vp.width * gl->vp.height;
#ifdef HAVE_GL_ASYNC_READBACK
@ -2439,10 +2430,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle)
gl->readback_buffer_screenshot = malloc(num_pixels * sizeof(uint32_t));
if (!gl->readback_buffer_screenshot)
{
performance_counter_stop(read_viewport);
goto error;
}
if (!is_idle)
video_driver_cached_frame();
@ -2456,7 +2444,6 @@ static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle)
gl->readback_buffer_screenshot = NULL;
}
performance_counter_stop(read_viewport);
context_bind_hw_render(true);
return true;

View file

@ -345,13 +345,9 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
|| target->rgb32 != rgb32 || target->pitch != pitch)
{
unsigned format;
static struct retro_perf_counter sdl_create_texture = {0};
sdl_tex_zero(target);
performance_counter_init(sdl_create_texture, "sdl_create_texture");
performance_counter_start(sdl_create_texture);
if (menu)
format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGBA4444;
else /* this assumes the frontend will convert 0RGB1555 to RGB565 */
@ -364,8 +360,6 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32,
target->tex = SDL_CreateTexture(vid->renderer, format,
SDL_TEXTUREACCESS_STREAMING, width, height);
performance_counter_stop(sdl_create_texture);
if (!target->tex)
{
RARCH_ERR("Failed to create %s texture: %s\n", menu ? "menu" : "main",
@ -630,10 +624,6 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
SDL_Surface *surf = NULL, *bgr24 = NULL;
sdl2_video_t *vid = (sdl2_video_t*)data;
static struct retro_perf_counter sdl2_gfx_read_viewport = {0};
performance_counter_init(sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport");
performance_counter_start(sdl2_gfx_read_viewport);
if (!is_idle)
video_driver_cached_frame();
@ -649,8 +639,6 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
memcpy(buffer, bgr24->pixels, bgr24->h * bgr24->pitch);
performance_counter_stop(sdl2_gfx_read_viewport);
return true;
}
@ -700,21 +688,14 @@ static void sdl2_poke_apply_state_changes(void *data)
static void sdl2_poke_set_texture_frame(void *data, const void *frame, bool rgb32,
unsigned width, unsigned height, float alpha)
{
sdl2_video_t *vid = (sdl2_video_t*)data;
if (frame)
{
static struct retro_perf_counter copy_texture_frame = {0};
sdl2_video_t *vid = (sdl2_video_t*)data;
sdl_refresh_input_size(vid, true, rgb32, width, height,
width * (rgb32 ? 4 : 2));
performance_counter_init(copy_texture_frame, "copy_texture_frame");
performance_counter_start(copy_texture_frame);
width * (rgb32 ? 4 : 2));
SDL_UpdateTexture(vid->menu.tex, NULL, frame, vid->menu.pitch);
performance_counter_stop(copy_texture_frame);
}
}

View file

@ -2275,14 +2275,10 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
if (vk->readback.streamed)
{
const uint8_t *src;
static struct retro_perf_counter stream_readback = {0};
if (staging->memory == VK_NULL_HANDLE)
return false;
performance_counter_init(stream_readback, "stream_readback");
performance_counter_start(stream_readback);
buffer += 3 * (vk->vp.height - 1) * vk->vp.width;
vkMapMemory(vk->context->device, staging->memory,
staging->offset, staging->size, 0, (void**)&src);
@ -2294,8 +2290,6 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
scaler_ctx_scale(&vk->readback.scaler, buffer, src);
vkUnmapMemory(vk->context->device, staging->memory);
performance_counter_stop(stream_readback);
}
else
{

View file

@ -2050,11 +2050,6 @@ void video_driver_frame(const void *data, unsigned width,
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) &&
(data != RETRO_HW_FRAME_BUFFER_VALID))
{
static struct retro_perf_counter video_frame_conv = {0};
performance_counter_init(video_frame_conv, "video_frame_conv");
performance_counter_start(video_frame_conv);
if (video_pixel_frame_scale(
video_driver_scaler_ptr->scaler,
video_driver_scaler_ptr->scaler_out,
@ -2063,7 +2058,6 @@ void video_driver_frame(const void *data, unsigned width,
data = video_driver_scaler_ptr->scaler_out;
pitch = video_driver_scaler_ptr->scaler->out_stride;
}
performance_counter_stop(video_frame_conv);
}

View file

@ -28,7 +28,6 @@
#include "../msg_hash.h"
#include "../movie.h"
#include "../core.h"
#include "../performance_counters.h"
#include "../verbosity.h"
#include "../audio/audio_driver.h"
@ -534,13 +533,12 @@ static void state_manager_push_where(state_manager_t *state, void **data)
static void state_manager_push_do(state_manager_t *state)
{
uint8_t *swap = NULL;
#if STRICT_BUF_SIZE
memcpy(state->nextblock, state->debugblock, state->debugsize);
#endif
static struct retro_perf_counter gen_deltas = {0};
uint8_t *swap = NULL;
if (state->thisblock_valid)
{
const uint8_t *oldb, *newb;
@ -563,9 +561,6 @@ recheckcapacity:;
goto recheckcapacity;
}
performance_counter_init(gen_deltas, "gen_deltas");
performance_counter_start(gen_deltas);
oldb = state->thisblock;
newb = state->nextblock;
compressed = state->head + sizeof(size_t);
@ -583,8 +578,6 @@ recheckcapacity:;
compressed += sizeof(size_t);
write_size_t(state->head, compressed-state->data);
state->head = compressed;
performance_counter_stop(gen_deltas);
}
else
state->thisblock_valid = true;
@ -760,21 +753,15 @@ bool state_manager_check_rewind(bool pressed,
if ((cnt == 0) || bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
{
retro_ctx_serialize_info_t serial_info;
static struct retro_perf_counter rewind_serialize = {0};
void *state = NULL;
state_manager_push_where(rewind_state.state, &state);
performance_counter_init(rewind_serialize, "rewind_serialize");
performance_counter_start(rewind_serialize);
serial_info.data = state;
serial_info.size = rewind_state.size;
core_serialize(&serial_info);
performance_counter_stop(rewind_serialize);
state_manager_push_do(rewind_state.state);
}
}

View file

@ -24,8 +24,6 @@
#include <libretro.h>
#include <features/features_cpu.h>
#include "runloop.h"
RETRO_BEGIN_DECLS
#ifndef MAX_COUNTERS
@ -81,7 +79,6 @@ void rarch_perf_register(struct retro_perf_counter *perf);
*
* Start performance counter.
**/
#define performance_counter_start(perf) performance_counter_start_internal(runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL), perf)
#define performance_counter_start_plus(is_perfcnt_enable, perf) performance_counter_start_internal(is_perfcnt_enable, perf)
/**
@ -90,7 +87,6 @@ void rarch_perf_register(struct retro_perf_counter *perf);
*
* Stop performance counter.
**/
#define performance_counter_stop(perf) performance_counter_stop_internal(runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL), perf)
#define performance_counter_stop_plus(is_perfcnt_enable, perf) performance_counter_stop_internal(is_perfcnt_enable, perf)
void rarch_timer_tick(rarch_timer_t *timer);