X-Git-Url: http://git.tdb.fi/?p=gldbg.git;a=blobdiff_plain;f=source%2Fcommandinterpreter.cpp;h=c684979bae2061b49f9fddd06a8cead8c381e9d6;hp=abc9dda60b07bc83d5125eac1612f8096d5e25eb;hb=ca49785159e6a7cfd2d999a99041fa1567575a24;hpb=2f49929fc383eab718b5fb64d966535b753e7024 diff --git a/source/commandinterpreter.cpp b/source/commandinterpreter.cpp index abc9dda..c684979 100644 --- a/source/commandinterpreter.cpp +++ b/source/commandinterpreter.cpp @@ -57,6 +57,11 @@ CommandInterpreter::CommandInterpreter(GlDbg &d): "trace end\n" " Terminate trace, closing the file.\n"); + commands["profile"] = Command(&CommandInterpreter::cmd_profile, + "Profiles GL usage and performance", + "profile {on|off}\n" + " Enables or disables profiling\n"); + commands["state"] = Command(&CommandInterpreter::cmd_state, "Inspects general GL state", "state vertex\n" @@ -202,6 +207,17 @@ void CommandInterpreter::cmd_trace(const string &args) } } +void CommandInterpreter::cmd_profile(const string &args) +{ + Profiler &profiler = gldbg.get_profiler(); + if(args.empty() || args=="on") + profiler.enable(); + else if(args=="off") + profiler.disable(); + else + throw InvalidParameterValue("Invalid argument"); +} + void CommandInterpreter::cmd_state(const string &args) { const GlState &glstate = gldbg.get_glstate();