mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-30 13:35:07 +00:00
(Menu) Add Performance Counters Option. TODO - when in Performance
Counters menu, should update values in real-time
This commit is contained in:
parent
2fdc3a72ce
commit
df53c6b6e7
@ -425,6 +425,22 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
file_list_push(rgui->selection_buf, "Menu Driver", RGUI_SETTINGS_DRIVER_MENU, 0);
|
||||
#endif
|
||||
break;
|
||||
case RGUI_SETTINGS_PERFORMANCE_COUNTERS:
|
||||
file_list_clear(rgui->selection_buf);
|
||||
{
|
||||
#ifdef PERF_TEST
|
||||
const struct retro_perf_counter **counters = (const struct retro_perf_counter**)perf_counters_rarch;
|
||||
unsigned num = perf_ptr_rarch;
|
||||
|
||||
if (!counters || num == 0)
|
||||
break;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
if (counters[i] && counters[i]->ident)
|
||||
file_list_push(rgui->selection_buf, counters[i]->ident, RGUI_SETTINGS_PERF_COUNTERS_BEGIN + i, 0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case RGUI_SETTINGS:
|
||||
file_list_clear(rgui->selection_buf);
|
||||
|
||||
@ -449,6 +465,9 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
file_list_push(rgui->selection_buf, "Core Information", RGUI_SETTINGS_CORE_INFO, 0);
|
||||
file_list_push(rgui->selection_buf, "Settings", RGUI_SETTINGS_OPTIONS, 0);
|
||||
file_list_push(rgui->selection_buf, "Drivers", RGUI_SETTINGS_DRIVERS, 0);
|
||||
#ifdef PERF_TEST
|
||||
file_list_push(rgui->selection_buf, "Performance Counters", RGUI_SETTINGS_PERFORMANCE_COUNTERS, 0);
|
||||
#endif
|
||||
|
||||
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
||||
{
|
||||
@ -1238,6 +1257,7 @@ static unsigned menu_common_type_is(unsigned type)
|
||||
type == RGUI_SETTINGS_NETPLAY_OPTIONS ||
|
||||
type == RGUI_SETTINGS_OPTIONS ||
|
||||
type == RGUI_SETTINGS_DRIVERS ||
|
||||
type == RGUI_SETTINGS_PERFORMANCE_COUNTERS ||
|
||||
(type == RGUI_SETTINGS_INPUT_OPTIONS);
|
||||
|
||||
if (type_found)
|
||||
@ -1423,6 +1443,7 @@ static int menu_settings_iterate(unsigned action)
|
||||
|| menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS
|
||||
|| menu_type == RGUI_SETTINGS_OPTIONS
|
||||
|| menu_type == RGUI_SETTINGS_DRIVERS
|
||||
|| menu_type == RGUI_SETTINGS_PERFORMANCE_COUNTERS
|
||||
|| menu_type == RGUI_SETTINGS_CORE_INFO
|
||||
|| menu_type == RGUI_SETTINGS_CORE_OPTIONS
|
||||
|| menu_type == RGUI_SETTINGS_AUDIO_OPTIONS
|
||||
@ -4686,6 +4707,12 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PERF_LOG_FMT "%I64u ticks, %I64u runs."
|
||||
#else
|
||||
#define PERF_LOG_FMT "%llu ticks, %llu runs."
|
||||
#endif
|
||||
|
||||
static void menu_common_setting_set_label(char *type_str, size_t type_str_size, unsigned *w, unsigned type)
|
||||
{
|
||||
switch (type)
|
||||
@ -4982,6 +5009,7 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size,
|
||||
case RGUI_SETTINGS_NETPLAY_OPTIONS:
|
||||
case RGUI_SETTINGS_PRIVACY_OPTIONS:
|
||||
case RGUI_SETTINGS_OPTIONS:
|
||||
case RGUI_SETTINGS_PERFORMANCE_COUNTERS:
|
||||
case RGUI_SETTINGS_DRIVERS:
|
||||
case RGUI_SETTINGS_CUSTOM_BIND_ALL:
|
||||
case RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
||||
@ -5211,6 +5239,89 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size,
|
||||
case RGUI_SETTINGS_LOAD_DUMMY_ON_CORE_SHUTDOWN:
|
||||
snprintf(type_str, type_str_size, g_settings.load_dummy_on_core_shutdown ? "ON" : "OFF");
|
||||
break;
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 1:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 2:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 3:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 4:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 5:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 6:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 7:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 8:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 9:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 10:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 11:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 12:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 13:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 14:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 15:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 16:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 17:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 18:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 19:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 20:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 21:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 22:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 23:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 24:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 25:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 26:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 27:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 28:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 29:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 30:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 31:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 32:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 33:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 34:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 35:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 36:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 37:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 38:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 39:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 40:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 41:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 42:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 43:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 44:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 45:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 46:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 47:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 48:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 49:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 50:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 51:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 52:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 53:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 54:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 55:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 56:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 57:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 58:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 59:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 60:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 61:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_BEGIN + 62:
|
||||
case RGUI_SETTINGS_PERF_COUNTERS_END:
|
||||
{
|
||||
#ifdef PERF_TEST
|
||||
const struct retro_perf_counter **counters = (const struct retro_perf_counter**)perf_counters_rarch;
|
||||
unsigned num = perf_ptr_rarch;
|
||||
|
||||
if (counters[type] && counters[type]->ident && counters[type]->call_cnt && counters[type]->total)
|
||||
{
|
||||
snprintf(type_str, type_str_size, PERF_LOG_FMT,
|
||||
(unsigned long long)counters[type]->total / (unsigned long long)counters[type]->call_cnt,
|
||||
(unsigned long long)counters[type]->call_cnt);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*type_str = '\0';
|
||||
*w = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*type_str = '\0';
|
||||
*w = 0;
|
||||
|
@ -23,6 +23,10 @@
|
||||
#define GFX_MAX_PARAMETERS 64
|
||||
#endif
|
||||
|
||||
#ifndef MAX_COUNTERS
|
||||
#define MAX_COUNTERS 64
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Shader stuff
|
||||
@ -95,6 +99,7 @@ typedef enum
|
||||
RGUI_SETTINGS_PRIVACY_OPTIONS,
|
||||
RGUI_SETTINGS_OPTIONS,
|
||||
RGUI_SETTINGS_DRIVERS,
|
||||
RGUI_SETTINGS_PERFORMANCE_COUNTERS,
|
||||
RGUI_SETTINGS_REWIND_ENABLE,
|
||||
RGUI_SETTINGS_LIBRETRO_LOG_LEVEL,
|
||||
RGUI_SETTINGS_LOGGING_VERBOSITY,
|
||||
@ -235,6 +240,8 @@ typedef enum
|
||||
RGUI_SETTINGS_CUSTOM_BIND_ALL,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
|
||||
RGUI_SETTINGS_ONSCREEN_KEYBOARD_ENABLE,
|
||||
RGUI_SETTINGS_PERF_COUNTERS_BEGIN,
|
||||
RGUI_SETTINGS_PERF_COUNTERS_END = RGUI_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS-1),
|
||||
RGUI_SETTINGS_BIND_LAST = RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
|
||||
} rgui_settings_t;
|
||||
|
||||
|
@ -317,6 +317,8 @@ static void rgui_render(void)
|
||||
strlcpy(title, "SETTINGS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_DRIVERS)
|
||||
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_PERFORMANCE_COUNTERS)
|
||||
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
else if (menu_type == RGUI_SETTINGS_SHADER_OPTIONS)
|
||||
strlcpy(title, "SHADER OPTIONS", sizeof(title));
|
||||
|
@ -169,6 +169,8 @@ static void rmenu_render(void)
|
||||
strlcpy(title, "VIDEO OPTIONS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_DRIVERS)
|
||||
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_PERFORMANCE_COUNTERS)
|
||||
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
else if (menu_type == RGUI_SETTINGS_SHADER_OPTIONS)
|
||||
strlcpy(title, "SHADER OPTIONS", sizeof(title));
|
||||
|
@ -417,6 +417,8 @@ static void rmenu_xui_render(void)
|
||||
strlcpy(title, "SETTINGS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_DRIVERS)
|
||||
strlcpy(title, "DRIVER OPTIONS", sizeof(title));
|
||||
else if (menu_type == RGUI_SETTINGS_PERFORMANCE_COUNTERS)
|
||||
strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title));
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
else if (menu_type == RGUI_SETTINGS_SHADER_OPTIONS)
|
||||
strlcpy(title, "SHADER OPTIONS", sizeof(title));
|
||||
|
@ -77,11 +77,10 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_COUNTERS 64
|
||||
static const struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS];
|
||||
static const struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS];
|
||||
static unsigned perf_ptr_rarch;
|
||||
static unsigned perf_ptr_libretro;
|
||||
const struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS];
|
||||
const struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS];
|
||||
unsigned perf_ptr_rarch;
|
||||
unsigned perf_ptr_libretro;
|
||||
|
||||
void rarch_perf_register(struct retro_perf_counter *perf)
|
||||
{
|
||||
|
@ -35,6 +35,15 @@ extern "C" {
|
||||
#include "libretro.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_COUNTERS 64
|
||||
|
||||
#ifdef PERF_TEST
|
||||
extern const struct retro_perf_counter *perf_counters_rarch[MAX_COUNTERS];
|
||||
extern const struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS];
|
||||
extern unsigned perf_ptr_rarch;
|
||||
extern unsigned perf_ptr_libretro;
|
||||
#endif
|
||||
|
||||
retro_perf_tick_t rarch_get_perf_counter(void);
|
||||
retro_time_t rarch_get_time_usec(void);
|
||||
void rarch_perf_register(struct retro_perf_counter *perf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user