Benchmark option to disable video rendering fully
Jeffrey Pfau jeffrey@endrift.com
Thu, 24 Jul 2014 03:23:41 -0700
1 files changed,
14 insertions(+),
6 deletions(-)
jump to
M
src/platform/perf-main.c
→
src/platform/perf-main.c
@@ -7,18 +7,20 @@ #include <fcntl.h>
#include <signal.h> #include <sys/time.h> -#define PERF_OPTIONS "S:" +#define PERF_OPTIONS "NS:" #define PERF_USAGE \ "\nBenchmark options:\n" \ + " -N Disable video rendering entirely" \ " -S SEC Run for SEC in-game seconds before exiting" struct PerfOpts { + bool noVideo; int duration; }; static void _GBAPerfRunloop(struct GBAThread* context, int* frames); static void _GBAPerfShutdown(int signal); -static int _parsePerfOpts(struct SubParser* parser, int option, const char* arg); +static bool _parsePerfOpts(struct SubParser* parser, int option, const char* arg); static struct GBAThread* _thread;@@ -28,7 +30,7 @@
struct GBAVideoSoftwareRenderer renderer; GBAVideoSoftwareRendererCreate(&renderer); - struct PerfOpts perfOpts = { 0 }; + struct PerfOpts perfOpts = { false, 0 }; struct SubParser subparser = { .usage = PERF_USAGE, .parse = _parsePerfOpts,@@ -46,11 +48,14 @@ renderer.outputBuffer = malloc(256 * 256 * 4);
renderer.outputBufferStride = 256; struct GBAThread context = { - .renderer = &renderer.d, .sync.videoFrameWait = 0, .sync.audioWait = 0 }; _thread = &context; + + if (!perfOpts.noVideo) { + context.renderer = &renderer.d; + } context.debugger = createDebugger(&opts);@@ -113,13 +118,16 @@ _thread->state = THREAD_EXITING;
pthread_mutex_unlock(&_thread->stateMutex); } -static int _parsePerfOpts(struct SubParser* parser, int option, const char* arg) { +static bool _parsePerfOpts(struct SubParser* parser, int option, const char* arg) { struct PerfOpts* opts = parser->opts; switch (option) { + case 'N': + opts->noVideo = true; + return true; case 'S': opts->duration = strtol(arg, 0, 10); return !errno; default: - return 0; + return false; } }