void writeJSON(Json::Output &jo) { #if !REGAL_NO_JSON jo.object("logging"); jo.object("enable"); jo.member("error", enableError); jo.member("warning", enableWarning); jo.member("info", enableInfo); jo.member("app", enableApp); jo.member("driver", enableDriver); jo.member("internal", enableInternal); jo.member("http", enableHttp); jo.end(); jo.member("maxLines", maxLines); jo.member("maxBytes", maxBytes); jo.member("once", once); jo.member("frameTime", frameTime); jo.member("pointers", pointers); jo.member("thread", thread); jo.member("process", process); jo.member("callback", callback); jo.member("log", log); jo.member("filename", logFilename); jo.member("json", json); jo.member("jsonFile", jsonFilename); jo.member("bufferLimit", bufferLimit); jo.end(); #endif }
Init::~Init() { // // Write out the Regal configuration file as JSON // #if !REGAL_NO_JSON if (Config::configFile.length()) { Json::Output jo; jo.object(); jo.object("regal"); Config::writeJSON(jo); Logging::writeJSON(jo); jo.end(); jo.end(); FILE *f = fopen(Config::configFile.c_str(),"wt"); if (f) { string tmp = jo.str(); fwrite(tmp.c_str(),1,tmp.length(),f); fclose(f); Info("Regal configuration written to ",Config::configFile); } else { Warning("Regal configuration could not be written to ",Config::configFile); } } #endif // // Shutdown... // Http::Stop(); Logging::Cleanup(); delete sc2rcMutex; delete th2rcMutex; sc2rcMutex = NULL; th2rcMutex = NULL; }
void writeJSON(Json::Output &jo) { #if !REGAL_NO_JSON jo.object("config"); jo.member("configFile", configFile); jo.object("system"); jo.member("ES1", sysES1); jo.member("ES2", sysES2); jo.member("GL", sysGL); jo.member("GLX", sysGLX); jo.member("EGL", sysEGL); jo.end(); jo.object("force"); jo.member("ES1", forceES1Profile); jo.member("ES2", forceES2Profile); jo.member("Core", forceCoreProfile); jo.end(); jo.object("dispatch"); jo.object("enable"); jo.member("debug", enableDebug); jo.member("error", enableError); jo.member("code", enableCode); jo.member("statistics", enableStatistics); jo.member("emulation", enableEmulation); jo.member("trace", enableTrace); jo.member("log", enableLog); jo.member("driver", enableDriver); jo.end(); jo.object("force"); jo.member("emulation", forceEmulation); jo.end(); jo.object("emulation"); jo.object("enable"); jo.member("hint", enableEmuHint); jo.member("ppa", enableEmuPpa); jo.member("ppca", enableEmuPpca); jo.member("obj", enableEmuObj); jo.member("bin", enableEmuBin); jo.member("texsto", enableEmuTexSto); jo.member("xfer", enableEmuXfer); jo.member("dsa", enableEmuDsa); jo.member("path", enableEmuPath); jo.member("rect", enableEmuRect); jo.member("bv", enableEmuBaseVertex); jo.member("iff", enableEmuIff); jo.member("so", enableEmuSo); jo.member("vao", enableEmuVao); jo.member("texc", enableEmuTexC); jo.member("filter", enableEmuFilter); jo.end(); jo.object("force"); jo.member("hint", forceEmuHint); jo.member("ppa", forceEmuPpa); jo.member("ppca", forceEmuPpca); jo.member("obj", forceEmuObj); jo.member("bin", forceEmuBin); jo.member("texsto", forceEmuTexSto); jo.member("xfer", forceEmuXfer); jo.member("dsa", forceEmuDsa); jo.member("path", forceEmuPath); jo.member("rect", forceEmuRect); jo.member("bv", forceEmuBaseVertex); jo.member("iff", forceEmuIff); jo.member("so", forceEmuSo); jo.member("vao", forceEmuVao); jo.member("texc", forceEmuTexC); jo.member("filter", forceEmuFilter); jo.end(); jo.end(); jo.end(); jo.object("frame"); jo.member("limit", frameLimit); jo.object("md5"); jo.member("color", frameMd5Color); jo.member("stencil", frameMd5Stencil); jo.member("depth", frameMd5Depth); jo.object("mask"); jo.member("color", frameMd5ColorMask); jo.member("stencil", frameMd5StencilMask); jo.member("depth", frameMd5DepthMask); jo.end(); jo.end(); jo.object("save"); jo.object("enable"); jo.member("color", frameSaveColor); jo.member("stencil", frameSaveStencil); jo.member("depth", frameSaveDepth); jo.end(); jo.object("prefix"); jo.member("color", frameSaveColorPrefix); jo.member("stencil", frameSaveStencilPrefix); jo.member("depth", frameSaveDepthPrefix); jo.end(); jo.end(); jo.end(); jo.object("cache"); jo.member("enable", cache); jo.member("shader", cacheShader); jo.member("shaderWrite", cacheShaderWrite); jo.member("shaderRead", cacheShaderRead); jo.member("texture", cacheShader); jo.member("textureWrite", cacheShaderWrite); jo.member("textureRead", cacheShaderRead); jo.member("directory", cacheDirectory); jo.end(); jo.object("trace"); jo.member("file", traceFile); jo.end(); jo.end(); #endif // !REGAL_NO_JSON }
inline string jsonObject(const char *prefix, const char *name, const string &str) { #if REGAL_NO_JSON return string(); #else // // http://www.altdevblogaday.com/2012/08/21/using-chrometracing-to-view-your-inline-profiling-data/ // // object { // "cat": "MY_SUBSYSTEM", // catagory // "pid": 4260, // process ID // "tid": 4776, // thread ID // "ts": 2168627922668, // time-stamp of this event // "ph": "B", // Begin sample // "name": "doSomethingCostly", // name of this event // "args": { } //arguments associated with this event. // } // Json::Output jo; jo.object(); jo.member("cat",prefix); jo.member("pid",Thread::procId()); jo.member("tid",Thread::threadId()%(1<<16)); jo.member("ts", timer.now()); // Unnamed logging events such as error, warning and info ones if (!name) { jo.member("ph", "I"); jo.member("name",str); jo.object("args"); jo.end(); } // begin/end groupings else if (!strcmp(name,"glBegin")) { jo.member("ph", "B"); jo.member("name","glBegin"); jo.object("args"); jo.member("inputs",str); jo.end(); } else if (!strcmp(name,"glEnd")) { jo.member("ph", "E"); jo.member("name","glBegin"); jo.object("args"); jo.end(); } else if (!strcmp(name,"glPushMatrix")) { jo.member("ph", "B"); jo.member("name","glPushMatrix"); jo.object("args"); jo.member("inputs",str); jo.end(); } else if (!strcmp(name,"glPopMatrix")) { jo.member("ph", "E"); jo.member("name","glPushMatrix"); jo.object("args"); jo.end(); } else if (!strcmp(name,"glPushGroupMarkerEXT")) { jo.member("ph", "B"); jo.member("name","glPushGroupMarkerExt"); jo.object("args"); jo.member("inputs",str); jo.end(); } else if (!strcmp(name,"glPopGroupMarkerEXT")) { jo.member("ph", "E"); jo.member("name","glPushGroupMarkerExt"); jo.object("args"); jo.end(); } // Generic named events else { jo.member("ph", "I"); jo.member("name",name ? name : ""); jo.object("args"); jo.member("inputs",str); jo.end(); } jo.end(); return jo.str(); #endif // REGAL_NO_JSON }