mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-02 02:06:46 +00:00
Implement scr.fps
This commit is contained in:
parent
1a2223ba07
commit
7d2da2201e
@ -2625,6 +2625,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETICB ("scr.linesleep", 0, &cb_scrlinesleep, "Flush sleeping some ms in every line");
|
||||
SETICB ("scr.pagesize", 1, &cb_scrpagesize, "Flush in pages when scr.linesleep is != 0");
|
||||
SETCB ("scr.flush", "false", &cb_scrflush, "Force flush to console in realtime (breaks scripting)");
|
||||
SETPREF ("scr.fps", "false", "Display FPS in visual title");
|
||||
/* TODO: rename to asm.color.ops ? */
|
||||
SETPREF ("scr.zoneflags", "true", "Show zoneflags in visual mode before the title (see fz?)");
|
||||
SETPREF ("scr.color.ops", "true", "Colorize numbers and registers in opcodes");
|
||||
|
@ -9,6 +9,10 @@ static void visual_refresh(RCore *core);
|
||||
|
||||
#define KEY_ALTQ 0xc5
|
||||
|
||||
static ut64 ts = UT64_MAX;
|
||||
static int tsFPS = 0;
|
||||
static int oldFPS = 0;
|
||||
|
||||
static const char *printfmtSingle[] = {
|
||||
"xc", "pd $r",
|
||||
"pxw 64@r:SP;dr=;pd $r",
|
||||
@ -2451,6 +2455,17 @@ R_API void r_core_visual_title(RCore *core, int color) {
|
||||
if (!oldpc) {
|
||||
oldpc = r_debug_reg_get (core->dbg, "PC");
|
||||
}
|
||||
if (r_config_get_i (core->config, "scr.fps")) {
|
||||
ut64 now = r_sys_now ();
|
||||
st64 diff = now - ts;
|
||||
if (diff < 10000000) {
|
||||
ut32 newFPS = (100000.0 / diff) * 10;
|
||||
tsFPS = (tsFPS + newFPS + oldFPS) / 3;
|
||||
oldFPS = newFPS;
|
||||
}
|
||||
ts = now;
|
||||
r_cons_printf ("(fps %d) ", tsFPS);
|
||||
}
|
||||
/* automatic block size */
|
||||
int pc, hexcols = r_config_get_i (core->config, "hex.cols");
|
||||
if (autoblocksize) {
|
||||
|
Loading…
Reference in New Issue
Block a user