Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbProfilingData.h
1#ifndef COIN_SBPROFILINGDATA_H
2#define COIN_SBPROFILINGDATA_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbBasic.h>
28#include <Inventor/SbTime.h>
29#include <Inventor/SoType.h>
30#include <Inventor/SbName.h>
31#include <Inventor/lists/SbList.h>
32#include <Inventor/tools/SbPimplPtr.h>
33
34class SoNode;
35class SoPath;
36class SoFullPath;
37class SbProfilingDataP;
38
39typedef void * SbProfilingNodeKey; // void since it should not be dereferenced
40typedef int16_t SbProfilingNodeTypeKey;
41typedef const char * SbProfilingNodeNameKey;
42
43class COIN_DLL_API SbProfilingData {
44public:
45 SbProfilingData(void);
47 ~SbProfilingData(void);
48
49 void setActionType(SoType actiontype);
50 SoType getActionType(void) const;
51
52 void setActionStartTime(SbTime starttime);
53 SbTime getActionStartTime(void) const;
54 void setActionStopTime(SbTime stoptime);
55 SbTime getActionStopTime(void) const;
56 SbTime getActionDuration(void) const;
57
58 // profiling setters
59 enum FootprintType {
60 MEMORY_SIZE,
61 VIDEO_MEMORY_SIZE
62 };
63
64 enum NodeFlag {
65 GL_CACHED_FLAG,
66 CULLED_FLAG
67 };
68
69 enum NodeDataQueryFlags {
70 INCLUDE_CHILDREN = 0x01
71 };
72
73 void setNodeTiming(const SoPath * path, SbTime timing);
74 void setNodeTiming(int idx, SbTime timing);
75 void preOffsetNodeTiming(int idx, SbTime timing);
76 SbTime getNodeTiming(const SoPath * path, unsigned int queryflags = 0) const;
77 SbTime getNodeTiming(int idx, unsigned int queryflags = 0) const;
78
79 void setNodeFootprint(const SoPath * path, FootprintType type,
80 size_t footprint);
81 void setNodeFootprint(int idx, FootprintType type, size_t footprint);
82 size_t getNodeFootprint(const SoPath * path, FootprintType type,
83 unsigned int queryflags = 0) const;
84 size_t getNodeFootprint(int idx, FootprintType type,
85 unsigned int queryflags = 0) const;
86
87 void setNodeFlag(const SoPath * path, NodeFlag flag, SbBool on);
88 void setNodeFlag(int idx, NodeFlag flag, SbBool on);
89 SbBool getNodeFlag(const SoPath * path, NodeFlag flag) const;
90 SbBool getNodeFlag(int idx, NodeFlag flag) const;
91
92 int getIndex(const SoPath * path, SbBool create = FALSE);
93 int getParentIndex(int idx) const;
94
95 SoType getNodeType(int idx) const;
96 SbName getNodeName(int idx) const;
97
98 int getLongestNameLength(void) const;
99 int getLongestTypeNameLength(void) const;
100
101 int getNumNodeEntries(void) const;
102
103 typedef void SbProfilingDataCB(void * userdata, const SbProfilingData & data, const SbList<SoNode *> & pointers, SbList<int> & childindices, int idx);
104 void reportAll(SbProfilingDataCB * callback, void * userdata) const;
105
106 // read out pre-categorized data
107 void getStatsForTypesKeyList(SbList<SbProfilingNodeTypeKey> & keys_out) const;
108 void getStatsForType(SbProfilingNodeTypeKey type,
109 SbTime & total, SbTime & max, uint32_t & count) const;
110
111 void getStatsForNamesKeyList(SbList<SbProfilingNodeNameKey> & keys_out) const;
112 void getStatsForName(SbProfilingNodeNameKey name,
113 SbTime & total, SbTime & max, uint32_t & count) const;
114
115 // statistics management
116 void reset(void);
117
118 SbProfilingData & operator = (const SbProfilingData & rhs);
119 SbProfilingData & operator += (const SbProfilingData & rhs);
120
121 int operator == (const SbProfilingData & rhs) const;
122 int operator != (const SbProfilingData & rhs) const;
123
124
125 // debug - return profiling data overhead
126 size_t getProfilingDataSize(void) const;
127
128protected:
129 SoType actionType;
130 SbTime actionStartTime;
131 SbTime actionStopTime;
132
133private:
134 SbPimplPtr<SbProfilingDataP> pimpl;
135
136 void constructorInit(void);
137
138 SbBool isPathMatch(const SoFullPath * path, int pathlen, int idx);
139
140 int getIndexCreate(const SoFullPath * path, int pathlen);
141 int getIndexNoCreate(const SoPath * path, int pathlen) const;
142 int getIndexForwardCreate(const SoFullPath * path, int pathlen,
143 int parentindex);
144 int getIndexForwardNoCreate(const SoFullPath * path, int pathlen,
145 int parentindex) const;
146
147}; // SbProfilingData
148
149#endif // !COIN_SBPROFILINGDATA_H
The SbList class is a template container class for lists.
Definition SbList.h:61
The SbName class stores strings by reference.
Definition SbName.h:31
Data structure for gathering scene graph traversal profiling information.
Definition SbProfilingData.h:43
The SbTime class instances represents time values.
Definition SbTime.h:41
The SoFullPath class allows examination of hidden children in paths.
Definition SoFullPath.h:29
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:43
The SoType class is the basis for the run-time type system in Coin.
Definition SoType.h:50

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.