Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -138,6 +138,11 @@ session = 60 ; Throttle FPS in running games (prevents 100% CPU workload). menu = 60 ; Throttle FPS in menus only. +[profiler2] +server = "127.0.0.1" ; Bind to localhost for security +server.port = 8000 ; Use a free port on your machine. If port is not 8000 js frontend in source/tools/profiler2 will not work +server.threads = 6 ; Enough for the browser's parallel connection limit + [hotkey] ; Each one of the specified keys will trigger the action on the left ; for multiple-key combinations, separate keys with '+'. Index: source/ps/Profiler2.h =================================================================== --- source/ps/Profiler2.h +++ source/ps/Profiler2.h @@ -413,7 +413,7 @@ /** * Call in any thread to save a JSONP representation of the buffers - * for all threads, to a file named profile2.jsonp in the logs directory. + * for all threads, to a file named profile2.json in the logs directory. */ void SaveToFile(); Index: source/ps/Profiler2.cpp =================================================================== --- source/ps/Profiler2.cpp +++ source/ps/Profiler2.cpp @@ -27,6 +27,7 @@ #include "lib/allocators/shared_ptr.h" #include "lib/os_path.h" #include "ps/CLogger.h" +#include "ps/ConfigDB.h" #include "ps/CStr.h" #include "ps/Profiler2GPU.h" #include "ps/Pyrogenesis.h" @@ -178,10 +179,17 @@ if (m_MgContext) return; - const char *options[] = { - "listening_ports", "127.0.0.1:8000", // bind to localhost for security - "num_threads", "6", // enough for the browser's parallel connection limit - NULL + CStr listeningPort; + CStr listeningServer; + CStr numThreads; + CFG_GET_VAL("profiler2.server.port", listeningPort); + CFG_GET_VAL("profiler2.server", listeningServer); + CFG_GET_VAL("profiler2.server.threads", numThreads); + std::string listening_ports = fmt::format("{0}:{1}", listeningServer, listeningPort); + const char* options[5] = { + "listening_ports", listening_ports.c_str(), + "num_threads", numThreads.c_str(), + nullptr }; m_MgContext = mg_start(MgCallback, this, options); ENSURE(m_MgContext); @@ -921,7 +929,8 @@ void CProfiler2::SaveToFile() { - OsPath path = psLogDir()/"profile2.jsonp"; + OsPath path = psLogDir()/"profile2.json"; + debug_printf("Writing profile data to: %ls \n", OsString(path).c_str()); std::ofstream stream(OsString(path).c_str(), std::ofstream::out | std::ofstream::trunc); ENSURE(stream.good());