![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SBPROFILINGDATA_H 00002 #define COIN_SBPROFILINGDATA_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg SIM about acquiring 00018 * a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/SbBasic.h> 00028 #include <Inventor/SbTime.h> 00029 #include <Inventor/SoType.h> 00030 #include <Inventor/SbName.h> 00031 #include <Inventor/lists/SbList.h> 00032 #include <Inventor/tools/SbPimplPtr.h> 00033 00034 class SoNode; 00035 class SoPath; 00036 class SoFullPath; 00037 class SbProfilingDataP; 00038 00039 typedef void * SbProfilingNodeKey; // void since it should not be dereferenced 00040 typedef int16_t SbProfilingNodeTypeKey; 00041 typedef const char * SbProfilingNodeNameKey; 00042 00043 class COIN_DLL_API SbProfilingData { 00044 public: 00045 SbProfilingData(void); 00046 SbProfilingData(const SbProfilingData & rhs); 00047 ~SbProfilingData(void); 00048 00049 void setActionType(SoType actiontype); 00050 SoType getActionType(void) const; 00051 00052 void setActionStartTime(SbTime starttime); 00053 SbTime getActionStartTime(void) const; 00054 void setActionStopTime(SbTime stoptime); 00055 SbTime getActionStopTime(void) const; 00056 SbTime getActionDuration(void) const; 00057 00058 // profiling setters 00059 enum FootprintType { 00060 MEMORY_SIZE, 00061 VIDEO_MEMORY_SIZE, 00062 }; 00063 00064 enum NodeFlag { 00065 GL_CACHED_FLAG, 00066 CULLED_FLAG 00067 }; 00068 00069 enum NodeDataQueryFlags { 00070 INCLUDE_CHILDREN = 0x01 00071 }; 00072 00073 void setNodeTiming(const SoPath * path, SbTime timing); 00074 void setNodeTiming(int idx, SbTime timing); 00075 void preOffsetNodeTiming(int idx, SbTime timing); 00076 SbTime getNodeTiming(const SoPath * path, unsigned int queryflags = 0) const; 00077 SbTime getNodeTiming(int idx, unsigned int queryflags = 0) const; 00078 00079 void setNodeFootprint(const SoPath * path, FootprintType type, 00080 size_t footprint); 00081 void setNodeFootprint(int idx, FootprintType type, size_t footprint); 00082 size_t getNodeFootprint(const SoPath * path, FootprintType type, 00083 unsigned int queryflags = 0) const; 00084 size_t getNodeFootprint(int idx, FootprintType type, 00085 unsigned int queryflags = 0) const; 00086 00087 void setNodeFlag(const SoPath * path, NodeFlag flag, SbBool on); 00088 void setNodeFlag(int idx, NodeFlag flag, SbBool on); 00089 SbBool getNodeFlag(const SoPath * path, NodeFlag flag) const; 00090 SbBool getNodeFlag(int idx, NodeFlag flag) const; 00091 00092 int getIndex(const SoPath * path, SbBool create = FALSE); 00093 int getParentIndex(int idx) const; 00094 00095 SoType getNodeType(int idx) const; 00096 SbName getNodeName(int idx) const; 00097 00098 int getLongestNameLength(void) const; 00099 int getLongestTypeNameLength(void) const; 00100 00101 int getNumNodeEntries(void) const; 00102 00103 typedef void SbProfilingDataCB(void * userdata, const SbProfilingData & data, const SbList<SoNode *> & pointers, SbList<int> & childindices, int idx); 00104 void reportAll(SbProfilingDataCB * callback, void * userdata) const; 00105 00106 // read out pre-categorized data 00107 void getStatsForTypesKeyList(SbList<SbProfilingNodeTypeKey> & keys_out) const; 00108 void getStatsForType(SbProfilingNodeTypeKey type, 00109 SbTime & total, SbTime & max, uint32_t & count) const; 00110 00111 void getStatsForNamesKeyList(SbList<SbProfilingNodeNameKey> & keys_out) const; 00112 void getStatsForName(SbProfilingNodeNameKey name, 00113 SbTime & total, SbTime & max, uint32_t & count) const; 00114 00115 // statistics management 00116 void reset(void); 00117 00118 SbProfilingData & operator = (const SbProfilingData & rhs); 00119 SbProfilingData & operator += (const SbProfilingData & rhs); 00120 00121 int operator == (const SbProfilingData & rhs) const; 00122 int operator != (const SbProfilingData & rhs) const; 00123 00124 00125 // debug - return profiling data overhead 00126 size_t getProfilingDataSize(void) const; 00127 00128 protected: 00129 SoType actionType; 00130 SbTime actionStartTime; 00131 SbTime actionStopTime; 00132 00133 private: 00134 SbPimplPtr<SbProfilingDataP> pimpl; 00135 00136 void constructorInit(void); 00137 00138 SbBool isPathMatch(const SoFullPath * path, int pathlen, int idx); 00139 00140 int getIndexCreate(const SoFullPath * path, int pathlen); 00141 int getIndexNoCreate(const SoPath * path, int pathlen) const; 00142 int getIndexForwardCreate(const SoFullPath * path, int pathlen, 00143 int parentindex); 00144 int getIndexForwardNoCreate(const SoFullPath * path, int pathlen, 00145 int parentindex) const; 00146 00147 }; // SbProfilingData 00148 00149 #endif // !COIN_SBPROFILINGDATA_H
Copyright © 1998-2008 by Kongsberg SIM. All rights reserved.
Generated on Sat Nov 8 00:38:05 2008 for Coin by Doxygen 1.5.6.