00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "vlib.h"
00027
00028
00029
00030
00031
00032 void fps() {
00033
00034 curFps++;
00035 sceRtcGetCurrentTick ( &fpsTickNow );
00036
00037 if ( ( ( fpsTickNow - fpsTickLast ) / ( ( float ) tickResolution ) ) >= 1.0f ) {
00038 fpsTickLast = fpsTickNow;
00039 lastFps = curFps;
00040 curFps = 0;
00041 }
00042
00043 pspDebugScreenSetOffset ( ( int ) fbp0 );
00044 pspDebugScreenSetXY ( 0, 0 );
00045 pspDebugScreenPrintf ( "FPS: %d", ( int ) lastFps );
00046 }
00047
00048 void fpsX ( const char *format, ... ) {
00049 va_list opt = 0;
00050 char buff[2048];
00051 va_start ( opt, format );
00052 vsnprintf ( buff, ( size_t ) sizeof ( buff ), format, opt );
00053
00054
00055 curFps++;
00056 sceRtcGetCurrentTick ( &fpsTickNow );
00057
00058 if ( ( ( fpsTickNow - fpsTickLast ) / ( ( float ) tickResolution ) ) >= 1.0f ) {
00059 fpsTickLast = fpsTickNow;
00060 lastFps = curFps;
00061 curFps = 0;
00062 }
00063
00064 pspDebugScreenSetOffset ( ( int ) fbp0 );
00065 pspDebugScreenSetXY ( 0, 0 );
00066 pspDebugScreenPrintf ( "FPS: %d\n%s", ( int ) lastFps, buff );
00067 }
00068
00069 void sysmon() {
00070
00071 curFps++;
00072 sceRtcGetCurrentTick ( &fpsTickNow );
00073
00074 if ( ( ( fpsTickNow - fpsTickLast ) / ( ( float ) tickResolution ) ) >= 1.0f ) {
00075 fpsTickLast = fpsTickNow;
00076 lastFps = curFps;
00077 curFps = 0;
00078 }
00079
00080 pspDebugScreenSetOffset ( ( int ) fbp0 );
00081 pspDebugScreenSetXY ( 0, 0 );
00082 pspDebugScreenPrintf ( "FPS: %d Ram: %d Vram: %d Graphics Mem: %d", ( int ) lastFps, sceKernelMaxFreeMemSize(), vmemavail(), 262144 - sceGuCheckList() );
00083 }
00084
00085 void sysmonX ( const char *format, ... ) {
00086 va_list opt = 0;
00087 char buff[2048];
00088 va_start ( opt, format );
00089 vsnprintf ( buff, ( size_t ) sizeof ( buff ), format, opt );
00090
00091
00092 curFps++;
00093 sceRtcGetCurrentTick ( &fpsTickNow );
00094
00095 if ( ( ( fpsTickNow - fpsTickLast ) / ( ( float ) tickResolution ) ) >= 1.0f ) {
00096 fpsTickLast = fpsTickNow;
00097 lastFps = curFps;
00098 curFps = 0;
00099 }
00100
00101 pspDebugScreenSetOffset ( ( int ) fbp0 );
00102 pspDebugScreenSetXY ( 0, 0 );
00103 pspDebugScreenPrintf ( "FPS: %d Mem: %d Vram: %d Graphics Mem: %d\n%s", ( int ) lastFps, sceKernelMaxFreeMemSize(), vmemavail(), 262144 - sceGuCheckList(), buff );
00104 }
00105
00106 u64 epoch = 0;
00107 u64 timeTaken = 0;
00108
00109 void start_ticker() {
00110 sceRtcGetCurrentTick ( &epoch );
00111 }
00112
00113 int end_ticker() {
00114 sceRtcGetCurrentTick ( &timeTaken );
00115 timeTaken -= epoch;
00116 return timeTaken;
00117 }