- Add initial tracing calls adapting to new Ghoul change of adding a

loglevel of ‘Trace’
- Adapt js and css files to show trace files in log
This commit is contained in:
Alexander Bock
2017-02-14 18:10:28 -05:00
parent 8456087cf5
commit efe205c209
9 changed files with 73 additions and 5 deletions
+24 -3
View File
@@ -168,9 +168,10 @@ int main(int argc, char** argv) {
}
// Main loop
LDEBUG("Starting rendering loop");
try {
LDEBUG("Starting rendering loop");
_sgctEngine->render();
LDEBUG("Ending rendering loop");
}
catch (const ghoul::RuntimeError& e) {
// Write out all of the information about the exception, flush the logs, and throw
@@ -207,6 +208,7 @@ int main(int argc, char** argv) {
}
void mainInitFunc() {
LTRACE("main::mainInitFunc(begin)");
//is this node the master? (must be set after call to _sgctEngine->init())
OsEng.setMaster(_sgctEngine->isMaster());
@@ -237,12 +239,14 @@ void mainInitFunc() {
p->setClearColor(glm::vec4(0.f, 0.f, 0.f, 1.f));
}
}
LTRACE("main::mainInitFunc(end)");
}
void mainPreSyncFunc() {
LTRACE("main::mainPreSyncFunc(begin)");
OsEng.setRunTime(sgct::Engine::getTime());
OsEng.preSynchronization();
LTRACE("main::mainPreSyncFunc(end)");
}
volatile bool busyWaitDecode = false;
@@ -252,10 +256,13 @@ void mainPostSyncPreDrawFunc() {
// std::this_thread::sleep_for(std::chrono::microseconds(10));
// }
// }
LTRACE("main::postSynchronizationPreDraw(begin)");
OsEng.postSynchronizationPreDraw();
LTRACE("main::postSynchronizationPreDraw(end)");
}
void mainRenderFunc() {
LTRACE("main::mainRenderFunc(begin)");
using glm::mat4;
using glm::translate;
//not the most efficient, but for clarity @JK
@@ -270,10 +277,13 @@ void mainRenderFunc() {
mat4 projectionMatrix = _sgctEngine->getCurrentProjectionMatrix();
OsEng.render(projectionMatrix, viewMatrix);
LTRACE("main::mainRenderFunc(end)");
}
void mainPostDrawFunc() {
LTRACE("main::mainPostDrawFunc(begin)");
OsEng.postDraw();
LTRACE("main::mainPostDrawFunc(end)");
// if (OsEng.logSGCTOutOfOrderErrors()) {
// if (sgct::Engine::instance()->isMaster()) {
@@ -290,11 +300,15 @@ void mainPostDrawFunc() {
}
void mainExternalControlCallback(const char* receivedChars, int size) {
if (OsEng.isMaster())
LTRACE("main::mainExternalControlCallback(begin)");
if (OsEng.isMaster()) {
OsEng.externalControlCallback(receivedChars, size, 0);
}
LTRACE("main::mainExternalControlCallback(end)");
}
void mainKeyboardCallback(int key, int, int action, int mods) {
LTRACE("main::mainKeyboardCallback(begin)");
if (OsEng.isMaster()) {
OsEng.keyboardCallback(
openspace::Key(key),
@@ -302,15 +316,18 @@ void mainKeyboardCallback(int key, int, int action, int mods) {
openspace::KeyAction(action)
);
}
LTRACE("main::mainKeyboardCallback(begin)");
}
void mainMouseButtonCallback(int key, int action) {
LTRACE("main::mainMouseButtonCallback(begin)");
if (OsEng.isMaster()) {
OsEng.mouseButtonCallback(
openspace::MouseButton(key),
openspace::MouseAction(action)
);
}
LTRACE("main::mainMouseButtonCallback(end)");
}
void mainMousePosCallback(double x, double y) {
@@ -329,11 +346,15 @@ void mainCharCallback(unsigned int codepoint, int mods) {
}
void mainEncodeFun() {
LTRACE("main::mainEncodeFun(begin)");
OsEng.encode();
LTRACE("main::mainEncodeFun(end)");
}
void mainDecodeFun() {
LTRACE("main::mainDecodeFun(begin)");
OsEng.decode();
LTRACE("main::mainDecodeFun(end)");
}
void mainLogCallback(const char* msg) {
+1 -1
View File
@@ -1,4 +1,4 @@
var levels = ['debug', 'info', 'warning', 'error', 'fatal'];
var levels = ['trace', 'debug', 'info', 'warning', 'error', 'fatal'];
var filterLevel = 0;
function insertAfter(newNode, referenceNode) {
+9
View File
@@ -27,6 +27,15 @@ label {
margin-right: 0.5em;
}
.log-level-trace {
color: #eeeeee;
background-color: #aaaaaa;
border-bottom: 1px solid #eaeaea;
}
.log-level-trace td:first-child {
border-left: 10px solid #eaeaea;
}
.log-level-debug {
background-color: #bbdda9;
border-bottom: 1px solid #7bc142;
+11
View File
@@ -822,6 +822,17 @@ void OpenSpaceEngine::configureLogging() {
LogMgr.addLog(std::make_unique<VisualStudioOutputLog>());
}
#endif // WIN32
#ifndef GHOUL_LOGGING_ENABLE_TRACE
std::string logLevel;
configurationManager().getValue(KeyLogLevel, logLevel);
LogLevel level = ghoul::logging::levelFromString(logLevel);
if (level == ghoul::logging::LogLevel::Trace) {
LWARNING("Desired logging level is set to 'Trace' but application was " <<
"compiled without Trace support");
}
#endif // GHOUL_LOGGING_ENABLE_TRACE
}
bool OpenSpaceEngine::initializeGL() {
+5
View File
@@ -362,6 +362,7 @@ bool RenderEngine::initializeGL() {
}
void RenderEngine::updateSceneGraph() {
LTRACE("RenderEngine::updateSceneGraph(begin)");
_sceneGraph->update({
glm::dvec3(0),
glm::dmat3(1),
@@ -380,6 +381,8 @@ void RenderEngine::updateSceneGraph() {
//if (const SceneGraphNode* node = OsEng.ref().interactionHandler().focusNode()){
//node->updateCamera(_mainCamera);
//}
LTRACE("RenderEngine::updateSceneGraph(end)");
}
void RenderEngine::updateShaderPrograms() {
@@ -466,6 +469,7 @@ void RenderEngine::updateFade() {
}
void RenderEngine::render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix){
LTRACE("RenderEngine::render(begin)");
_mainCamera->sgctInternal.setViewMatrix(viewMatrix);
_mainCamera->sgctInternal.setProjectionMatrix(projectionMatrix);
@@ -494,6 +498,7 @@ void RenderEngine::render(const glm::mat4& projectionMatrix, const glm::mat4& vi
if (screenSpaceRenderable->isEnabled() && screenSpaceRenderable->isReady())
screenSpaceRenderable->render();
}
LTRACE("RenderEngine::render(end)");
}
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
+4
View File
@@ -144,7 +144,9 @@ void Scene::update(const UpdateData& data) {
for (SceneGraphNode* node : _graph.nodes()) {
try {
LTRACE("Scene::update(begin '" + node->name() + "')");
node->update(data);
LTRACE("Scene::update(end '" + node->name() + "')");
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.what());
@@ -160,7 +162,9 @@ void Scene::evaluate(Camera* camera) {
void Scene::render(const RenderData& data, RendererTasks& tasks) {
for (SceneGraphNode* node : _graph.nodes()) {
LTRACE("Scene::render(begin '" + node->name() + "')");
node->render(data, tasks);
LTRACE("Scene::render(end '" + node->name() + "')");
}
}
+7
View File
@@ -369,6 +369,13 @@ void ScriptEngine::addBaseLibrary() {
LuaLibrary lib = {
"",
{
{
"printTrace",
&luascriptfunctions::printTrace,
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Trace'"
},
{
"printDebug",
&luascriptfunctions::printDebug,
+11
View File
@@ -59,6 +59,17 @@ namespace luascriptfunctions {
return 0;
}
/**
* \ingroup LuaScripts
* printTrace(*):
* Logs the passed value to the installed LogManager with a LogLevel of 'Trace'.
* For Boolean, numbers, and strings, the internal values are printed, for all other
* types, the type is printed instead
*/
int printTrace(lua_State* L) {
return printInternal(ghoul::logging::LogLevel::Trace, L);
}
/**
* \ingroup LuaScripts
* printDebug(*):