aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfasttimerview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llfasttimerview.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llfasttimerview.cpp')
-rw-r--r--linden/indra/newview/llfasttimerview.cpp200
1 files changed, 117 insertions, 83 deletions
diff --git a/linden/indra/newview/llfasttimerview.cpp b/linden/indra/newview/llfasttimerview.cpp
index 6364fd2..0fdbb98 100644
--- a/linden/indra/newview/llfasttimerview.cpp
+++ b/linden/indra/newview/llfasttimerview.cpp
@@ -37,6 +37,7 @@
37#include "llrect.h" 37#include "llrect.h"
38#include "llerror.h" 38#include "llerror.h"
39#include "llgl.h" 39#include "llgl.h"
40#include "llglimmediate.h"
40#include "llmath.h" 41#include "llmath.h"
41#include "llfontgl.h" 42#include "llfontgl.h"
42 43
@@ -56,20 +57,20 @@ static const S32 LINE_GRAPH_HEIGHT = 240;
56struct ft_display_info { 57struct ft_display_info {
57 int timer; 58 int timer;
58 const char *desc; 59 const char *desc;
59 LLColor4 *color; 60 const LLColor4 *color;
60 S32 disabled; // initialized to 0 61 S32 disabled; // initialized to 0
61 int level; // calculated based on desc 62 int level; // calculated based on desc
62 int parent; // calculated 63 int parent; // calculated
63}; 64};
64 65
65static LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f); 66static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f);
66static LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f); 67static const LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f);
67static LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f); 68static const LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f);
68static LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f); 69static const LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f);
69 70
70static LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f); 71static const LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f);
71static LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f); 72static const LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f);
72static LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f); 73static const LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f);
73 74
74// green(6), blue, yellow, orange, pink(2), cyan 75// green(6), blue, yellow, orange, pink(2), cyan
75// red (5) magenta (4) 76// red (5) magenta (4)
@@ -93,40 +94,14 @@ static struct ft_display_info ft_display_table[] =
93 { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, 94 { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 },
94 { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, 95 { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 },
95 { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 }, 96 { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 },
96// { LLFastTimer::FTM_TEMP1, " Blur", &LLColor4::red1, 0 }, 97 { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 },
97 { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 }, 98 { LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 1 },
98 { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 },
99 { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 },
100 { LLFastTimer::FTM_OCCLUSION, " Object Occlude", &LLColor4::pink1, 0 },
101 { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 },
102 { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 },
103 { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 },
104 { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 0 },
105 { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 },
106 { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 },
107 { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 },
108 { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 },
109 { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 },
110 { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 },
111 { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 },
112 { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 },
113 { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 },
114 { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 },
115 { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 },
116 { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 },
117 { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 },
118 { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 },
119 { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 },
120 { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 },
121 { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 },
122 { LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 0 },
123 { LLFastTimer::FTM_AVATAR_UPDATE, " Avatars", &LLColor4::purple2, 0 }, 99 { LLFastTimer::FTM_AVATAR_UPDATE, " Avatars", &LLColor4::purple2, 0 },
124 { LLFastTimer::FTM_JOINT_UPDATE, " Joints", &LLColor4::purple3, 0 }, 100 { LLFastTimer::FTM_JOINT_UPDATE, " Joints", &LLColor4::purple3, 0 },
125 { LLFastTimer::FTM_ATTACHMENT_UPDATE, " Attachments", &LLColor4::purple4, 0 }, 101 { LLFastTimer::FTM_ATTACHMENT_UPDATE, " Attachments", &LLColor4::purple4, 0 },
126 { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 }, 102 { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 },
127 { LLFastTimer::FTM_FLEXIBLE_UPDATE, " Flex Update", &LLColor4::pink2, 0 }, 103 { LLFastTimer::FTM_FLEXIBLE_UPDATE, " Flex Update", &LLColor4::pink2, 0 },
128 { LLFastTimer::FTM_LOD_UPDATE, " LOD Update", &LLColor4::magenta1, 0 }, 104 { LLFastTimer::FTM_LOD_UPDATE, " LOD Update", &LLColor4::magenta1, 0 },
129// { LLFastTimer::FTM_TEMP5, " Check", &LLColor4::red1, 1},
130 { LLFastTimer::FTM_REGION_UPDATE, " Region Update", &LLColor4::cyan2, 0 }, 105 { LLFastTimer::FTM_REGION_UPDATE, " Region Update", &LLColor4::cyan2, 0 },
131 { LLFastTimer::FTM_NETWORK, " Network", &LLColor4::orange1, 1 }, 106 { LLFastTimer::FTM_NETWORK, " Network", &LLColor4::orange1, 1 },
132 { LLFastTimer::FTM_IDLE_NETWORK, " Decode Msgs", &LLColor4::orange2, 0 }, 107 { LLFastTimer::FTM_IDLE_NETWORK, " Decode Msgs", &LLColor4::orange2, 0 },
@@ -145,23 +120,48 @@ static struct ft_display_info ft_display_table[] =
145 { LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 }, 120 { LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 },
146// { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 }, 121// { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 },
147 { LLFastTimer::FTM_RENDER, " Render", &green0, 1 }, 122 { LLFastTimer::FTM_RENDER, " Render", &green0, 1 },
148 { LLFastTimer::FTM_REBUILD, " Rebuild", &LLColor4::green1, 1 }, 123 { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 },
149 { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, 124 { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 },
150 { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, 125 { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 },
151 { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 }, 126 { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 },
152 { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 }, 127 { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 1 },
153 { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 }, 128 { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 },
154 { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 }, 129 { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 },
155 { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 }, 130 { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 },
156 { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 }, 131 { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 },
157 { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 }, 132 { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 },
158 { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 }, 133 { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 },
159 { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 }, 134 { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 },
160 { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 }, 135 { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 },
161 { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 }, 136 { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 },
162 { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 }, 137 { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 },
163 { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 }, 138 { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 },
164 { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 }, 139 { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 },
140 { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 },
141 { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 },
142 { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 },
143 { LLFastTimer::FTM_GEO_SKY, " Sky", &LLColor4::yellow3, 0 },
144 { LLFastTimer::FTM_UPDATE_WLPARAM, " Windlight Param",&LLColor4::magenta2, 0 },
145 { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 },
146 { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 },
147 { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 },
148 { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 },
149 { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 },
150 { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 },
151 { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 },
152 { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 },
153 { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 },
154 { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 },
155// { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 },
156// { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 },
157// { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 },
158 { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 },
159// { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 },
160// { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 },
161 { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 },
162// { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 },
163// { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 },
164 { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 },
165 { LLFastTimer::FTM_POOLS, " Pools", &LLColor4::green3, 1 }, 165 { LLFastTimer::FTM_POOLS, " Pools", &LLColor4::green3, 1 },
166 { LLFastTimer::FTM_POOLRENDER, " RenderPool", &LLColor4::green4, 1 }, 166 { LLFastTimer::FTM_POOLRENDER, " RenderPool", &LLColor4::green4, 1 },
167 { LLFastTimer::FTM_RENDER_TERRAIN, " Terrain", &LLColor4::green6, 0 }, 167 { LLFastTimer::FTM_RENDER_TERRAIN, " Terrain", &LLColor4::green6, 0 },
@@ -179,13 +179,17 @@ static struct ft_display_info ft_display_table[] =
179 { LLFastTimer::FTM_RENDER_ALPHA, " Alpha", &LLColor4::yellow6, 0 }, 179 { LLFastTimer::FTM_RENDER_ALPHA, " Alpha", &LLColor4::yellow6, 0 },
180 { LLFastTimer::FTM_RENDER_HUD, " HUD", &LLColor4::yellow7, 0 }, 180 { LLFastTimer::FTM_RENDER_HUD, " HUD", &LLColor4::yellow7, 0 },
181 { LLFastTimer::FTM_RENDER_WATER, " Water", &LLColor4::yellow9, 0 }, 181 { LLFastTimer::FTM_RENDER_WATER, " Water", &LLColor4::yellow9, 0 },
182 { LLFastTimer::FTM_RENDER_WL_SKY, " WL Sky", &LLColor4::blue3, 0 },
183 { LLFastTimer::FTM_RENDER_FAKE_VBO_UPDATE," Fake VBO update", &LLColor4::red2, 0 },
184 { LLFastTimer::FTM_RENDER_BLOOM, " Bloom", &LLColor4::blue4, 0 },
185 { LLFastTimer::FTM_RENDER_BLOOM_FBO, " First FBO", &LLColor4::blue, 0 },
182 { LLFastTimer::FTM_RENDER_UI, " UI", &LLColor4::cyan4, 1 }, 186 { LLFastTimer::FTM_RENDER_UI, " UI", &LLColor4::cyan4, 1 },
183 { LLFastTimer::FTM_RENDER_TIMER, " Timers", &LLColor4::cyan5, 1, 0 }, 187 { LLFastTimer::FTM_RENDER_TIMER, " Timers", &LLColor4::cyan5, 1, 0 },
184// { LLFastTimer::FTM_RENDER_FONTS, " Fonts", &LLColor4::pink1, 0 }, 188// { LLFastTimer::FTM_RENDER_FONTS, " Fonts", &LLColor4::pink1, 0 },
185// { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 },
186 { LLFastTimer::FTM_SWAP, " Swap", &LLColor4::pink1, 0 }, 189 { LLFastTimer::FTM_SWAP, " Swap", &LLColor4::pink1, 0 },
187 { LLFastTimer::FTM_CLIENT_COPY, " Client Copy", &LLColor4::red1, 1}, 190 { LLFastTimer::FTM_CLIENT_COPY, " Client Copy", &LLColor4::red1, 1},
188 191
192#if 0 || !LL_RELEASE_FOR_DOWNLOAD
189 { LLFastTimer::FTM_TEMP1, " Temp1", &LLColor4::red1, 0 }, 193 { LLFastTimer::FTM_TEMP1, " Temp1", &LLColor4::red1, 0 },
190 { LLFastTimer::FTM_TEMP2, " Temp2", &LLColor4::magenta1, 0 }, 194 { LLFastTimer::FTM_TEMP2, " Temp2", &LLColor4::magenta1, 0 },
191 { LLFastTimer::FTM_TEMP3, " Temp3", &LLColor4::red2, 0 }, 195 { LLFastTimer::FTM_TEMP3, " Temp3", &LLColor4::red2, 0 },
@@ -194,7 +198,8 @@ static struct ft_display_info ft_display_table[] =
194 { LLFastTimer::FTM_TEMP6, " Temp6", &LLColor4::magenta3, 0 }, 198 { LLFastTimer::FTM_TEMP6, " Temp6", &LLColor4::magenta3, 0 },
195 { LLFastTimer::FTM_TEMP7, " Temp7", &LLColor4::red4, 0 }, 199 { LLFastTimer::FTM_TEMP7, " Temp7", &LLColor4::red4, 0 },
196 { LLFastTimer::FTM_TEMP8, " Temp8", &LLColor4::magenta4, 0 }, 200 { LLFastTimer::FTM_TEMP8, " Temp8", &LLColor4::magenta4, 0 },
197 201#endif
202
198 { LLFastTimer::FTM_OTHER, " Other", &red0 } 203 { LLFastTimer::FTM_OTHER, " Other", &red0 }
199}; 204};
200static int ft_display_didcalc = 0; 205static int ft_display_didcalc = 0;
@@ -211,6 +216,7 @@ LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect)
211 mMaxCountTotal = 0; 216 mMaxCountTotal = 0;
212 mDisplayCenter = 1; 217 mDisplayCenter = 1;
213 mDisplayCalls = 0; 218 mDisplayCalls = 0;
219 mDisplayHz = 0;
214 mScrollIndex = 0; 220 mScrollIndex = 0;
215 mHoverIndex = -1; 221 mHoverIndex = -1;
216 mHoverBarIndex = -1; 222 mHoverBarIndex = -1;
@@ -288,7 +294,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
288 294
289S32 LLFastTimerView::getLegendIndex(S32 y) 295S32 LLFastTimerView::getLegendIndex(S32 y)
290{ 296{
291 S32 idx = (mRect.getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5; 297 S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5;
292 if (idx >= 0 && idx < FTV_DISPLAY_NUM) 298 if (idx >= 0 && idx < FTV_DISPLAY_NUM)
293 { 299 {
294 return ft_display_idx[idx]; 300 return ft_display_idx[idx];
@@ -322,9 +328,17 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
322 else if (mask & MASK_ALT) 328 else if (mask & MASK_ALT)
323 { 329 {
324 if (mask & MASK_SHIFT) 330 if (mask & MASK_SHIFT)
331 {
325 mSubtractHidden = !mSubtractHidden; 332 mSubtractHidden = !mSubtractHidden;
333 }
334 else if (mask & MASK_CONTROL)
335 {
336 mDisplayHz = !mDisplayHz;
337 }
326 else 338 else
339 {
327 mDisplayCalls = !mDisplayCalls; 340 mDisplayCalls = !mDisplayCalls;
341 }
328 } 342 }
329 else if (mask & MASK_SHIFT) 343 else if (mask & MASK_SHIFT)
330 { 344 {
@@ -417,7 +431,8 @@ void LLFastTimerView::draw()
417 S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); 431 S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f);
418 S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f); 432 S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f);
419 433
420 mRect.setLeftTopAndSize(mRect.mLeft, mRect.mTop, width, height); 434 // HACK: casting away const. Should use setRect or some helper function instead.
435 const_cast<LLRect&>(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
421 436
422 S32 left, top, right, bottom; 437 S32 left, top, right, bottom;
423 S32 x, y, barw, barh, dx, dy; 438 S32 x, y, barw, barh, dx, dy;
@@ -463,7 +478,7 @@ void LLFastTimerView::draw()
463 // Draw the window background 478 // Draw the window background
464 { 479 {
465 LLGLSNoTexture gls_ui_no_texture; 480 LLGLSNoTexture gls_ui_no_texture;
466 gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); 481 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
467 } 482 }
468 483
469 S32 xleft = margin; 484 S32 xleft = margin;
@@ -644,7 +659,7 @@ void LLFastTimerView::draw()
644 659
645 // update rectangle that includes timer bars 660 // update rectangle that includes timer bars
646 mBarRect.mLeft = xleft; 661 mBarRect.mLeft = xleft;
647 mBarRect.mRight = mRect.mRight - xleft; 662 mBarRect.mRight = getRect().mRight - xleft;
648 mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4); 663 mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
649 mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT; 664 mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT;
650 665
@@ -755,36 +770,36 @@ void LLFastTimerView::draw()
755 // Draw borders 770 // Draw borders
756 { 771 {
757 LLGLSNoTexture gls_ui_no_texture; 772 LLGLSNoTexture gls_ui_no_texture;
758 glColor4f(0.5f,0.5f,0.5f,0.5f); 773 gGL.color4f(0.5f,0.5f,0.5f,0.5f);
759 774
760 S32 by = y + 2; 775 S32 by = y + 2;
761 776
762 y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4); 777 y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
763 778
764 //heading 779 //heading
765 gl_rect_2d(xleft-5, by, mRect.getWidth()-5, y+5, FALSE); 780 gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE);
766 781
767 //tree view 782 //tree view
768 gl_rect_2d(5, by, xleft-10, 5, FALSE); 783 gl_rect_2d(5, by, xleft-10, 5, FALSE);
769 784
770 by = y + 5; 785 by = y + 5;
771 //average bar 786 //average bar
772 gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-5, FALSE); 787 gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-5, FALSE);
773 788
774 by -= barh*2+dy; 789 by -= barh*2+dy;
775 790
776 //current frame bar 791 //current frame bar
777 gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-2, FALSE); 792 gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-2, FALSE);
778 793
779 by -= barh+dy+1; 794 by -= barh+dy+1;
780 795
781 //history bars 796 //history bars
782 gl_rect_2d(xleft-5, by, mRect.getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); 797 gl_rect_2d(xleft-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE);
783 798
784 by = LINE_GRAPH_HEIGHT-barh-dy-7; 799 by = LINE_GRAPH_HEIGHT-barh-dy-7;
785 800
786 //line graph 801 //line graph
787 graph_rect = LLRect(xleft-5, by, mRect.getWidth()-5, 5); 802 graph_rect = LLRect(xleft-5, by, getRect().getWidth()-5, 5);
788 803
789 gl_rect_2d(graph_rect, FALSE); 804 gl_rect_2d(graph_rect, FALSE);
790 } 805 }
@@ -920,7 +935,7 @@ void LLFastTimerView::draw()
920 color = lerp(color, LLColor4::grey, 0.8f); 935 color = lerp(color, LLColor4::grey, 0.8f);
921 } 936 }
922 937
923 glColor4fv(color.mV); 938 gGL.color4fv(color.mV);
924 F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); 939 F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f);
925 F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); 940 F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f);
926 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); 941 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);
@@ -947,6 +962,8 @@ void LLFastTimerView::draw()
947 //display y-axis range 962 //display y-axis range
948 LLString tdesc = mDisplayCalls ? 963 LLString tdesc = mDisplayCalls ?
949 llformat("%d calls", max_ticks) : 964 llformat("%d calls", max_ticks) :
965 mDisplayHz ?
966 llformat("%d Hz", max_ticks) :
950 llformat("%4.2f ms", ms); 967 llformat("%4.2f ms", ms);
951 968
952 x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5; 969 x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5;
@@ -954,7 +971,7 @@ void LLFastTimerView::draw()
954 971
955 LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, 972 LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
956 LLFontGL::LEFT, LLFontGL::TOP); 973 LLFontGL::LEFT, LLFontGL::TOP);
957 974
958 //highlight visible range 975 //highlight visible range
959 { 976 {
960 S32 first_frame = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex; 977 S32 first_frame = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex;
@@ -965,7 +982,7 @@ void LLFastTimerView::draw()
965 F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame; 982 F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame;
966 F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame; 983 F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame;
967 984
968 glColor4f(0.5f,0.5f,0.5f,0.3f); 985 gGL.color4f(0.5f,0.5f,0.5f,0.3f);
969 gl_rect_2d((S32) left, graph_rect.mTop, (S32) right, graph_rect.mBottom); 986 gl_rect_2d((S32) left, graph_rect.mTop, (S32) right, graph_rect.mBottom);
970 987
971 if (mHoverBarIndex >= 0) 988 if (mHoverBarIndex >= 0)
@@ -973,12 +990,12 @@ void LLFastTimerView::draw()
973 S32 bar_frame = first_frame - mHoverBarIndex; 990 S32 bar_frame = first_frame - mHoverBarIndex;
974 F32 bar = (F32) graph_rect.mLeft + frame_delta*bar_frame; 991 F32 bar = (F32) graph_rect.mLeft + frame_delta*bar_frame;
975 992
976 glColor4f(0.5f,0.5f,0.5f,1); 993 gGL.color4f(0.5f,0.5f,0.5f,1);
977 994
978 glBegin(GL_LINES); 995 gGL.begin(GL_LINES);
979 glVertex2i((S32)bar, graph_rect.mBottom); 996 gGL.vertex2i((S32)bar, graph_rect.mBottom);
980 glVertex2i((S32)bar, graph_rect.mTop); 997 gGL.vertex2i((S32)bar, graph_rect.mTop);
981 glEnd(); 998 gGL.end();
982 } 999 }
983 } 1000 }
984 1001
@@ -993,10 +1010,11 @@ void LLFastTimerView::draw()
993 //fatten highlighted timer 1010 //fatten highlighted timer
994 if (mHoverIndex == idx) 1011 if (mHoverIndex == idx)
995 { 1012 {
1013 gGL.flush();
996 glLineWidth(3); 1014 glLineWidth(3);
997 } 1015 }
998 1016
999 F32* col = ft_display_table[idx].color->mV; 1017 const F32 * col = ft_display_table[idx].color->mV;
1000 1018
1001 F32 alpha = 1.f; 1019 F32 alpha = 1.f;
1002 1020
@@ -1009,30 +1027,38 @@ void LLFastTimerView::draw()
1009 } 1027 }
1010 } 1028 }
1011 1029
1012 glColor4f(col[0], col[1], col[2], alpha); 1030 gGL.color4f(col[0], col[1], col[2], alpha);
1013 glBegin(GL_LINE_STRIP); 1031 gGL.begin(GL_LINE_STRIP);
1014 for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++) 1032 for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++)
1015 { 1033 {
1016 U64 ticks = ticks_sum[j+1][idx]; 1034 U64 ticks = ticks_sum[j+1][idx];
1017 if (mDisplayCalls) 1035
1036 if (mDisplayHz)
1037 {
1038 F64 tc = (F64) (ticks+1) * iclock_freq;
1039 tc = 1000.f/tc;
1040 ticks = llmin((U64) tc, (U64) 1024);
1041 }
1042 else if (mDisplayCalls)
1018 { 1043 {
1019 S32 tidx = ft_display_table[idx].timer; 1044 S32 tidx = ft_display_table[idx].timer;
1020 S32 hidx = (LLFastTimer::sLastFrameIndex + j) % LLFastTimer::FTM_HISTORY_NUM; 1045 S32 hidx = (LLFastTimer::sLastFrameIndex + j) % LLFastTimer::FTM_HISTORY_NUM;
1021 ticks = (S32)LLFastTimer::sCallHistory[hidx][tidx]; 1046 ticks = (S32)LLFastTimer::sCallHistory[hidx][tidx];
1022 } 1047 }
1023 1048
1024 if (alpha == 1.f) 1049 if (alpha == 1.f)
1025 { //normalize to highlighted timer 1050 { //normalize to highlighted timer
1026 cur_max = llmax(cur_max, ticks); 1051 cur_max = llmax(cur_max, ticks);
1027 } 1052 }
1028 F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1)*j; 1053 F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1)*j;
1029 F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks; 1054 F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks;
1030 glVertex2f(x,y); 1055 gGL.vertex2f(x,y);
1031 } 1056 }
1032 glEnd(); 1057 gGL.end();
1033 1058
1034 if (mHoverIndex == idx) 1059 if (mHoverIndex == idx)
1035 { 1060 {
1061 gGL.flush();
1036 glLineWidth(1); 1062 glLineWidth(1);
1037 } 1063 }
1038 } 1064 }
@@ -1045,7 +1071,15 @@ void LLFastTimerView::draw()
1045 llmin((F32) cur_max/ (F32) last_max - 1.f,1.f); 1071 llmin((F32) cur_max/ (F32) last_max - 1.f,1.f);
1046 1072
1047 alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt; 1073 alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt;
1048 1074
1075 if (mHoverIndex >= 0)
1076 {
1077 x = (graph_rect.mRight + graph_rect.mLeft)/2;
1078 y = graph_rect.mBottom + 8;
1079
1080 LLFontGL::sMonospace->renderUTF8(ft_display_table[mHoverIndex].desc, 0, x, y, LLColor4::white,
1081 LLFontGL::LEFT, LLFontGL::BOTTOM);
1082 }
1049 } 1083 }
1050 } 1084 }
1051 1085