Jump to content

[SOLVED] Using profiler to graph values over time - specifying color causes nothing to show


photo

Recommended Posts

In flush tick:

Unigine::Math::vec3 force = getMyForce();
Unigine::Profiler::get()->setValue("Force Z", "", force.z, 60.f,NULL);

In console:

show_profiler 2

"Force Z" is included in profiler widget but without line graph. I would like to include it in the graph. C++ Profiler documentation says float* arg5 is to be used for color. So I change my code to the following:

float color=.9f;
Unigine::Math::vec3 force = getMyForce();
Unigine::Profiler::get()->setValue("Force Z", "", force.z, 60.f,&color);

Now, there is empty line in profiler widget where "Force Z" should be, and still no graph. What is wrong?

 

Also, I see in WidgetProfiler::setValue that the const float *color value is used to construct a vec4 used for the color, which means that even if everything else works, it would only be possible to graph things in different greyscale shades? 

Link to comment

Sorry, I made a mistake. Value is indeed graphed when non-null color is passed to setValue. I didn't see before. But still, I have questions.

 

Create new Unigine C++ VS2013 project with SDK browser.

Replace source/AppWorldLogic.cpp with attached file.

Build and run project in visual studio

Open console, show_profiler 2

 

Notice that "Random value 1" is printed in text in lower left but not included in graph (NULL was passed as color argument).

Notice that "Random value 2" is not printed, but there is a large empty space where it should be. It is graphed in a dark red. (pointer to float of .5f was passed as color argument)

 

So, my questions are:

 

1) How can I get the same value to show in profiler in both in text and in graph?

2) How can I specify the color of the graph? Altering the float only seems to change the hue of red. How can I be explicit about RGB values? It seems to me like the setValue function should take a vec4* as color argument instead of float.

3) How can I specify the color of the text?

4) Is it possible to remove existing profiler values and see only the ones I need? (remove execution time for Update, Render, Interface...)

AppWorldLogic.cpp

Link to comment

Hi Adam,

 

Thank you for the test scene. Here is the corrected variant:

int AppWorldLogic::update() {
	Unigine::Math::vec4 color(.9f);
	
	float randomvalue1=static_cast<float>(rand())/static_cast<float>(RAND_MAX);
	float randomvalue2=static_cast<float>(rand())/static_cast<float>(RAND_MAX);
 
	Unigine::Profiler::get()->setValue("Random value 1 (This will print text only)", "", randomvalue1, 1.f, NULL);
	Unigine::Profiler::get()->setValue("Random value 2 (This will not print text but will create empty line in profiler widget, and will print graph)", "", 1+randomvalue2, 10.f, color);
 
	return 1;
}

We will fix the API and docs ASAP, it seems that something wrong is going on here.

 

1, 2) You need to specify color (vec4). See the code above;

3) There is no possibility to have separate colors for graph and text;

4) I'm afraid, it's not possible without heavily modifying engine source code. You can try to remove calls (profile->setValue / profile->begin/end from the sources).

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...