summaryrefslogtreecommitdiff
path: root/indra/newview/llfasttimerview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfasttimerview.cpp')
-rw-r--r--indra/newview/llfasttimerview.cpp175
1 files changed, 103 insertions, 72 deletions
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 7c1ec514e5..e29d8fb40d 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -37,6 +37,7 @@
#include "llrect.h"
#include "llerror.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llmath.h"
#include "llfontgl.h"
@@ -56,20 +57,20 @@ static const S32 LINE_GRAPH_HEIGHT = 240;
struct ft_display_info {
int timer;
const char *desc;
- LLColor4 *color;
+ const LLColor4 *color;
S32 disabled; // initialized to 0
int level; // calculated based on desc
int parent; // calculated
};
-static LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f);
-static LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f);
-static LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f);
-static LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f);
+static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f);
+static const LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f);
+static const LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f);
+static const LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f);
-static LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f);
-static LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f);
-static LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f);
+static const LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f);
+static const LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f);
+static const LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f);
// green(6), blue, yellow, orange, pink(2), cyan
// red (5) magenta (4)
@@ -93,40 +94,14 @@ static struct ft_display_info ft_display_table[] =
{ LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 },
{ LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 },
{ LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 },
-// { LLFastTimer::FTM_TEMP1, " Blur", &LLColor4::red1, 0 },
- { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 },
- { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 },
- { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 },
- { LLFastTimer::FTM_OCCLUSION, " Object Occlude", &LLColor4::pink1, 0 },
- { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 },
- { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 },
- { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 },
- { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 0 },
- { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 },
- { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 },
- { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 },
- { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 },
- { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 },
- { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 },
- { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 },
- { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 },
- { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 },
- { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 },
- { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 },
- { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 },
- { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 },
- { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 },
- { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 },
- { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 },
- { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 },
+ { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 },
{ LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 0 },
{ LLFastTimer::FTM_AVATAR_UPDATE, " Avatars", &LLColor4::purple2, 0 },
{ LLFastTimer::FTM_JOINT_UPDATE, " Joints", &LLColor4::purple3, 0 },
{ LLFastTimer::FTM_ATTACHMENT_UPDATE, " Attachments", &LLColor4::purple4, 0 },
- { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 },
+ { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 },
{ LLFastTimer::FTM_FLEXIBLE_UPDATE, " Flex Update", &LLColor4::pink2, 0 },
{ LLFastTimer::FTM_LOD_UPDATE, " LOD Update", &LLColor4::magenta1, 0 },
-// { LLFastTimer::FTM_TEMP5, " Check", &LLColor4::red1, 1},
{ LLFastTimer::FTM_REGION_UPDATE, " Region Update", &LLColor4::cyan2, 0 },
{ LLFastTimer::FTM_NETWORK, " Network", &LLColor4::orange1, 1 },
{ LLFastTimer::FTM_IDLE_NETWORK, " Decode Msgs", &LLColor4::orange2, 0 },
@@ -145,23 +120,48 @@ static struct ft_display_info ft_display_table[] =
{ LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 },
// { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 },
{ LLFastTimer::FTM_RENDER, " Render", &green0, 1 },
- { LLFastTimer::FTM_REBUILD, " Rebuild", &LLColor4::green1, 1 },
- { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 },
- { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 },
- { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 },
- { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 },
- { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 },
- { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 },
- { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 },
- { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 },
- { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 },
- { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 },
- { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 },
- { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 },
- { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 },
- { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 },
- { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 },
- { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 },
+ { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 },
+ { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 },
+ { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 },
+ { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 },
+ { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 0 },
+ { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 },
+ { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 },
+ { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 },
+ { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 },
+ { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 },
+ { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 },
+ { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 },
+ { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 },
+ { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 },
+ { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 },
+ { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 },
+ { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 },
+ { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 },
+ { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 },
+ { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 },
+ { LLFastTimer::FTM_GEO_SKY, " Sky", &LLColor4::yellow3, 0 },
+ { LLFastTimer::FTM_UPDATE_WLPARAM, " Windlight Param",&LLColor4::magenta2, 0 },
+ { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 },
+ { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 },
+ { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 },
+ { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 },
+ { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 },
+ { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 },
+ { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 },
+ { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 },
+ { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 },
+ { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 },
+// { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 },
+// { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 },
+// { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 },
+ { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 },
+// { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 },
+// { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 },
+ { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 },
+// { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 },
+// { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 },
+ { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 },
{ LLFastTimer::FTM_POOLS, " Pools", &LLColor4::green3, 1 },
{ LLFastTimer::FTM_POOLRENDER, " RenderPool", &LLColor4::green4, 1 },
{ LLFastTimer::FTM_RENDER_TERRAIN, " Terrain", &LLColor4::green6, 0 },
@@ -179,13 +179,16 @@ static struct ft_display_info ft_display_table[] =
{ LLFastTimer::FTM_RENDER_ALPHA, " Alpha", &LLColor4::yellow6, 0 },
{ LLFastTimer::FTM_RENDER_HUD, " HUD", &LLColor4::yellow7, 0 },
{ LLFastTimer::FTM_RENDER_WATER, " Water", &LLColor4::yellow9, 0 },
+ { LLFastTimer::FTM_RENDER_WL_SKY, " WL Sky", &LLColor4::blue3, 0 },
+ { LLFastTimer::FTM_RENDER_FAKE_VBO_UPDATE," Fake VBO update", &LLColor4::red2, 0 },
+ { LLFastTimer::FTM_RENDER_BLOOM, " Bloom", &LLColor4::blue4, 0 },
+ { LLFastTimer::FTM_RENDER_BLOOM_FBO, " First FBO", &LLColor4::blue, 0 },
{ LLFastTimer::FTM_RENDER_UI, " UI", &LLColor4::cyan4, 1 },
{ LLFastTimer::FTM_RENDER_TIMER, " Timers", &LLColor4::cyan5, 1, 0 },
// { LLFastTimer::FTM_RENDER_FONTS, " Fonts", &LLColor4::pink1, 0 },
-// { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 },
{ LLFastTimer::FTM_SWAP, " Swap", &LLColor4::pink1, 0 },
{ LLFastTimer::FTM_CLIENT_COPY, " Client Copy", &LLColor4::red1, 1},
-
+
{ LLFastTimer::FTM_TEMP1, " Temp1", &LLColor4::red1, 0 },
{ LLFastTimer::FTM_TEMP2, " Temp2", &LLColor4::magenta1, 0 },
{ LLFastTimer::FTM_TEMP3, " Temp3", &LLColor4::red2, 0 },
@@ -211,6 +214,7 @@ LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect)
mMaxCountTotal = 0;
mDisplayCenter = 1;
mDisplayCalls = 0;
+ mDisplayHz = 0;
mScrollIndex = 0;
mHoverIndex = -1;
mHoverBarIndex = -1;
@@ -322,9 +326,17 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
else if (mask & MASK_ALT)
{
if (mask & MASK_SHIFT)
+ {
mSubtractHidden = !mSubtractHidden;
+ }
+ else if (mask & MASK_CONTROL)
+ {
+ mDisplayHz = !mDisplayHz;
+ }
else
+ {
mDisplayCalls = !mDisplayCalls;
+ }
}
else if (mask & MASK_SHIFT)
{
@@ -756,7 +768,7 @@ void LLFastTimerView::draw()
// Draw borders
{
LLGLSNoTexture gls_ui_no_texture;
- glColor4f(0.5f,0.5f,0.5f,0.5f);
+ gGL.color4f(0.5f,0.5f,0.5f,0.5f);
S32 by = y + 2;
@@ -921,7 +933,7 @@ void LLFastTimerView::draw()
color = lerp(color, LLColor4::grey, 0.8f);
}
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f);
F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f);
gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getWidth(), box_imagep->getHeight(), 16, start_fragment, end_fragment);
@@ -948,6 +960,8 @@ void LLFastTimerView::draw()
//display y-axis range
LLString tdesc = mDisplayCalls ?
llformat("%d calls", max_ticks) :
+ mDisplayHz ?
+ llformat("%d Hz", max_ticks) :
llformat("%4.2f ms", ms);
x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5;
@@ -955,7 +969,7 @@ void LLFastTimerView::draw()
LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
LLFontGL::LEFT, LLFontGL::TOP);
-
+
//highlight visible range
{
S32 first_frame = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex;
@@ -966,7 +980,7 @@ void LLFastTimerView::draw()
F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame;
F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame;
- glColor4f(0.5f,0.5f,0.5f,0.3f);
+ gGL.color4f(0.5f,0.5f,0.5f,0.3f);
gl_rect_2d((S32) left, graph_rect.mTop, (S32) right, graph_rect.mBottom);
if (mHoverBarIndex >= 0)
@@ -974,12 +988,12 @@ void LLFastTimerView::draw()
S32 bar_frame = first_frame - mHoverBarIndex;
F32 bar = (F32) graph_rect.mLeft + frame_delta*bar_frame;
- glColor4f(0.5f,0.5f,0.5f,1);
+ gGL.color4f(0.5f,0.5f,0.5f,1);
- glBegin(GL_LINES);
- glVertex2i((S32)bar, graph_rect.mBottom);
- glVertex2i((S32)bar, graph_rect.mTop);
- glEnd();
+ gGL.begin(GL_LINES);
+ gGL.vertex2i((S32)bar, graph_rect.mBottom);
+ gGL.vertex2i((S32)bar, graph_rect.mTop);
+ gGL.end();
}
}
@@ -994,10 +1008,11 @@ void LLFastTimerView::draw()
//fatten highlighted timer
if (mHoverIndex == idx)
{
+ gGL.flush();
glLineWidth(3);
}
- F32* col = ft_display_table[idx].color->mV;
+ const F32 * col = ft_display_table[idx].color->mV;
F32 alpha = 1.f;
@@ -1010,30 +1025,38 @@ void LLFastTimerView::draw()
}
}
- glColor4f(col[0], col[1], col[2], alpha);
- glBegin(GL_LINE_STRIP);
+ gGL.color4f(col[0], col[1], col[2], alpha);
+ gGL.begin(GL_LINE_STRIP);
for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++)
{
U64 ticks = ticks_sum[j+1][idx];
- if (mDisplayCalls)
+
+ if (mDisplayHz)
+ {
+ F64 tc = (F64) (ticks+1) * iclock_freq;
+ tc = 1000.f/tc;
+ ticks = llmin((U64) tc, (U64) 1024);
+ }
+ else if (mDisplayCalls)
{
S32 tidx = ft_display_table[idx].timer;
S32 hidx = (LLFastTimer::sLastFrameIndex + j) % LLFastTimer::FTM_HISTORY_NUM;
ticks = (S32)LLFastTimer::sCallHistory[hidx][tidx];
}
-
+
if (alpha == 1.f)
{ //normalize to highlighted timer
cur_max = llmax(cur_max, ticks);
}
F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1)*j;
F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks;
- glVertex2f(x,y);
+ gGL.vertex2f(x,y);
}
- glEnd();
+ gGL.end();
if (mHoverIndex == idx)
{
+ gGL.flush();
glLineWidth(1);
}
}
@@ -1046,7 +1069,15 @@ void LLFastTimerView::draw()
llmin((F32) cur_max/ (F32) last_max - 1.f,1.f);
alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt;
-
+
+ if (mHoverIndex >= 0)
+ {
+ x = (graph_rect.mRight + graph_rect.mLeft)/2;
+ y = graph_rect.mBottom + 8;
+
+ LLFontGL::sMonospace->renderUTF8(ft_display_table[mHoverIndex].desc, 0, x, y, LLColor4::white,
+ LLFontGL::LEFT, LLFontGL::BOTTOM);
+ }
}
}