simple profiler added
[libpicofe.git] / common / emu.c
index 23e90eb..f86526c 100644 (file)
@@ -1347,6 +1347,8 @@ void emu_init(void)
        mkdir_path(path, pos, "srm");\r
        mkdir_path(path, pos, "brm");\r
 \r
+       pprof_init();\r
+\r
        make_config_cfg(path);\r
        config_readlrom(path);\r
 \r
@@ -1373,6 +1375,8 @@ void emu_finish(void)
 #endif\r
        }\r
 \r
+       pprof_finish();\r
+\r
        PicoExit();\r
 }\r
 \r
@@ -1432,6 +1436,8 @@ void emu_loop(void)
                unsigned int timestamp;\r
                int diff, diff_lim;\r
 \r
+               pprof_start(main);\r
+\r
                timestamp = get_ticks();\r
                if (reset_timing) {\r
                        reset_timing = 0;\r
@@ -1535,6 +1541,9 @@ void emu_loop(void)
 \r
                emu_update_input();\r
                PicoFrame();\r
+               pemu_finalize_frame(fpsbuff, notice_msg);\r
+\r
+               // plat_video_flip();\r
 \r
                /* frame limiter */\r
                if (!reset_timing && !(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT)))\r
@@ -1552,9 +1561,13 @@ void emu_loop(void)
                        }\r
                }\r
 \r
-               pemu_update_display(fpsbuff, notice_msg);\r
+               // XXX: for some plats it might be better to flip before vsync\r
+               // (due to shadow registers in display hw)\r
+               plat_video_flip();\r
 \r
                pframes_done++; frames_done++; frames_shown++;\r
+\r
+               pprof_end(main);\r
        }\r
 \r
        emu_set_fastforward(0);\r