PageRenderTime 105ms CodeModel.GetById 47ms app.highlight 54ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llcommon/llmemtype.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 232 lines | 170 code | 36 blank | 26 comment | 2 complexity | 2eb7276f0c4b123c24f101c2e9f453cb MD5 | raw file
  1/** 
  2 * @file llmemtype.cpp
  3 * @brief Simple memory allocation/deallocation tracking stuff here
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#include "llmemtype.h"
 28#include "llallocator.h"
 29
 30std::vector<char const *> LLMemType::DeclareMemType::mNameList;
 31
 32LLMemType::DeclareMemType LLMemType::MTYPE_INIT("Init");
 33LLMemType::DeclareMemType LLMemType::MTYPE_STARTUP("Startup");
 34LLMemType::DeclareMemType LLMemType::MTYPE_MAIN("Main");
 35LLMemType::DeclareMemType LLMemType::MTYPE_FRAME("Frame");
 36
 37LLMemType::DeclareMemType LLMemType::MTYPE_GATHER_INPUT("GatherInput");
 38LLMemType::DeclareMemType LLMemType::MTYPE_JOY_KEY("JoyKey");
 39
 40LLMemType::DeclareMemType LLMemType::MTYPE_IDLE("Idle");
 41LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_PUMP("IdlePump");
 42LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_NETWORK("IdleNetwork");
 43LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_REGIONS("IdleUpdateRegions");
 44LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_VIEWER_REGION("IdleUpdateViewerRegion");
 45LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_SURFACE("IdleUpdateSurface");
 46LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_PARCEL_OVERLAY("IdleUpdateParcelOverlay");
 47LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_AUDIO("IdleAudio");
 48
 49LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING("CacheProcessPending");
 50LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING_ASKS("CacheProcessPendingAsks");
 51LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING_REPLIES("CacheProcessPendingReplies");
 52
 53LLMemType::DeclareMemType LLMemType::MTYPE_MESSAGE_CHECK_ALL("MessageCheckAll");
 54LLMemType::DeclareMemType LLMemType::MTYPE_MESSAGE_PROCESS_ACKS("MessageProcessAcks");
 55
 56LLMemType::DeclareMemType LLMemType::MTYPE_RENDER("Render");
 57LLMemType::DeclareMemType LLMemType::MTYPE_SLEEP("Sleep");
 58
 59LLMemType::DeclareMemType LLMemType::MTYPE_NETWORK("Network");
 60LLMemType::DeclareMemType LLMemType::MTYPE_PHYSICS("Physics");
 61LLMemType::DeclareMemType LLMemType::MTYPE_INTERESTLIST("InterestList");
 62
 63LLMemType::DeclareMemType LLMemType::MTYPE_IMAGEBASE("ImageBase");
 64LLMemType::DeclareMemType LLMemType::MTYPE_IMAGERAW("ImageRaw");
 65LLMemType::DeclareMemType LLMemType::MTYPE_IMAGEFORMATTED("ImageFormatted");
 66		
 67LLMemType::DeclareMemType LLMemType::MTYPE_APPFMTIMAGE("AppFmtImage");
 68LLMemType::DeclareMemType LLMemType::MTYPE_APPRAWIMAGE("AppRawImage");
 69LLMemType::DeclareMemType LLMemType::MTYPE_APPAUXRAWIMAGE("AppAuxRawImage");
 70		
 71LLMemType::DeclareMemType LLMemType::MTYPE_DRAWABLE("Drawable");
 72
 73LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT("Object");
 74LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT_PROCESS_UPDATE("ObjectProcessUpdate");
 75LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT_PROCESS_UPDATE_CORE("ObjectProcessUpdateCore");
 76
 77LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY("Display");
 78LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE("DisplayUpdate");
 79LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_CAMERA("DisplayUpdateCam");
 80LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_GEOM("DisplayUpdateGeom");
 81LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_SWAP("DisplaySwap");
 82LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_HUD("DisplayUpdateHud");
 83LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_GEN_REFLECTION("DisplayGenRefl");
 84LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_IMAGE_UPDATE("DisplayImageUpdate");
 85LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_STATE_SORT("DisplayStateSort");
 86LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_SKY("DisplaySky");
 87LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_GEOM("DisplayRenderGeom");
 88LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_FLUSH("DisplayRenderFlush");
 89LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_UI("DisplayRenderUI");
 90LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS("DisplayRenderAttach");
 91
 92LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DATA("VertexData");
 93LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CONSTRUCTOR("VertexConstr");
 94LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTRUCTOR("VertexDestr");
 95LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CREATE_VERTICES("VertexCreateVerts");
 96LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CREATE_INDICES("VertexCreateIndices");
 97LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTROY_BUFFER("VertexDestroyBuff");	
 98LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTROY_INDICES("VertexDestroyIndices");
 99LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UPDATE_VERTS("VertexUpdateVerts");
100LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UPDATE_INDICES("VertexUpdateIndices");
101LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_ALLOCATE_BUFFER("VertexAllocateBuffer");
102LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_RESIZE_BUFFER("VertexResizeBuffer");
103LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER("VertexMapBuffer");
104LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES("VertexMapBufferVerts");
105LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES("VertexMapBufferIndices");
106LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UNMAP_BUFFER("VertexUnmapBuffer");
107LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SET_STRIDE("VertexSetStride");
108LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SET_BUFFER("VertexSetBuffer");
109LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SETUP_VERTEX_BUFFER("VertexSetupVertBuff");
110LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CLEANUP_CLASS("VertexCleanupClass");
111
112LLMemType::DeclareMemType LLMemType::MTYPE_SPACE_PARTITION("SpacePartition");
113
114LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE("Pipeline");
115LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_INIT("PipelineInit");
116LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS("PipelineCreateBuffs");
117LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RESTORE_GL("PipelineRestroGL");
118LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UNLOAD_SHADERS("PipelineUnloadShaders");
119LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_LIGHTING_DETAIL("PipelineLightingDetail");
120LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_GET_POOL_TYPE("PipelineGetPoolType");
121LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ADD_POOL("PipelineAddPool");
122LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ALLOCATE_DRAWABLE("PipelineAllocDrawable");
123LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ADD_OBJECT("PipelineAddObj");
124LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS("PipelineCreateObjs");
125LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_MOVE("PipelineUpdateMove");
126LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_GEOM("PipelineUpdateGeom");
127LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_VISIBLE("PipelineMarkVisible");
128LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_MOVED("PipelineMarkMoved");
129LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_SHIFT("PipelineMarkShift");
130LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS("PipelineShiftObjs");
131LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_TEXTURED("PipelineMarkTextured");
132LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_REBUILD("PipelineMarkRebuild");
133LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_CULL("PipelineUpdateCull");
134LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_STATE_SORT("PipelineStateSort");
135LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_POST_SORT("PipelinePostSort");
136		
137LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_HUD_ELS("PipelineHudEls");
138LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_HL("PipelineRenderHL");
139LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM("PipelineRenderGeom");
140LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED("PipelineRenderGeomDef");
141LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF("PipelineRenderGeomPostDef");
142LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_SHADOW("PipelineRenderGeomShadow");
143LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_SELECT("PipelineRenderSelect");
144LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_REBUILD_POOLS("PipelineRebuildPools");
145LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_QUICK_LOOKUP("PipelineQuickLookup");
146LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS("PipelineRenderObjs");
147LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR("PipelineGenImpostors");
148LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_BLOOM("PipelineRenderBloom");
149
150LLMemType::DeclareMemType LLMemType::MTYPE_UPKEEP_POOLS("UpkeepPools");
151
152LLMemType::DeclareMemType LLMemType::MTYPE_AVATAR("Avatar");
153LLMemType::DeclareMemType LLMemType::MTYPE_AVATAR_MESH("AvatarMesh");
154LLMemType::DeclareMemType LLMemType::MTYPE_PARTICLES("Particles");
155LLMemType::DeclareMemType LLMemType::MTYPE_REGIONS("Regions");
156
157LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY("Inventory");
158LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_DRAW("InventoryDraw");
159LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_BUILD_NEW_VIEWS("InventoryBuildNewViews");
160LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_DO_FOLDER("InventoryDoFolder");
161LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_POST_BUILD("InventoryPostBuild");
162LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_FROM_XML("InventoryFromXML");
163LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_CREATE_NEW_ITEM("InventoryCreateNewItem");
164LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_INIT("InventoryViewInit");
165LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_SHOW("InventoryViewShow");
166LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_TOGGLE("InventoryViewToggle");
167
168LLMemType::DeclareMemType LLMemType::MTYPE_ANIMATION("Animation");
169LLMemType::DeclareMemType LLMemType::MTYPE_VOLUME("Volume");
170LLMemType::DeclareMemType LLMemType::MTYPE_PRIMITIVE("Primitive");
171		
172LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT("Script");
173LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT_RUN("ScriptRun");
174LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT_BYTECODE("ScriptByteCode");
175		
176LLMemType::DeclareMemType LLMemType::MTYPE_IO_PUMP("IoPump");
177LLMemType::DeclareMemType LLMemType::MTYPE_IO_TCP("IoTCP");
178LLMemType::DeclareMemType LLMemType::MTYPE_IO_BUFFER("IoBuffer");
179LLMemType::DeclareMemType LLMemType::MTYPE_IO_HTTP_SERVER("IoHttpServer");
180LLMemType::DeclareMemType LLMemType::MTYPE_IO_SD_SERVER("IoSDServer");
181LLMemType::DeclareMemType LLMemType::MTYPE_IO_SD_CLIENT("IoSDClient");
182LLMemType::DeclareMemType LLMemType::MTYPE_IO_URL_REQUEST("IOUrlRequest");
183
184LLMemType::DeclareMemType LLMemType::MTYPE_DIRECTX_INIT("DirectXInit");
185
186LLMemType::DeclareMemType LLMemType::MTYPE_TEMP1("Temp1");
187LLMemType::DeclareMemType LLMemType::MTYPE_TEMP2("Temp2");
188LLMemType::DeclareMemType LLMemType::MTYPE_TEMP3("Temp3");
189LLMemType::DeclareMemType LLMemType::MTYPE_TEMP4("Temp4");
190LLMemType::DeclareMemType LLMemType::MTYPE_TEMP5("Temp5");
191LLMemType::DeclareMemType LLMemType::MTYPE_TEMP6("Temp6");
192LLMemType::DeclareMemType LLMemType::MTYPE_TEMP7("Temp7");
193LLMemType::DeclareMemType LLMemType::MTYPE_TEMP8("Temp8");
194LLMemType::DeclareMemType LLMemType::MTYPE_TEMP9("Temp9");
195
196LLMemType::DeclareMemType LLMemType::MTYPE_OTHER("Other");
197
198
199LLMemType::DeclareMemType::DeclareMemType(char const * st)
200{
201	mID = (S32)mNameList.size();
202	mName = st;
203
204	mNameList.push_back(mName);
205}
206
207LLMemType::DeclareMemType::~DeclareMemType()
208{
209}
210
211LLMemType::LLMemType(LLMemType::DeclareMemType& dt)
212{
213	mTypeIndex = dt.mID;
214	LLAllocator::pushMemType(dt.mID);
215}
216
217LLMemType::~LLMemType()
218{
219	LLAllocator::popMemType();
220}
221
222char const * LLMemType::getNameFromID(S32 id)
223{
224	if (id < 0 || id >= (S32)DeclareMemType::mNameList.size())
225	{
226		return "INVALID";
227	}
228
229	return DeclareMemType::mNameList[id];
230}
231
232//--------------------------------------------------------------------------------------------------