HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_NodeStats.h
Go to the documentation of this file.
1 /*
2 * PROPRIETARY INFORMATION. This software is proprietary to
3 * Side Effects Software Inc., and is not to be reproduced,
4 * transmitted, or disclosed in any way without written permission.
5 *
6 * COMMENTS:
7 */
8 
9 #ifndef __PDG_NODE_STATS_H__
10 #define __PDG_NODE_STATS_H__
11 
12 #include "PDG_API.h"
13 #include "PDG_Types.h"
15 
16 #include <UT/UT_TBBSpinLock.h>
17 
18 /*
19  * Helper class that stores node cook times and work item totals
20  */
22 {
23 public:
24  /// Enumeration of stats stored in this object
25  enum StatType
26  {
27  /// The timestamp at which the node first began generating work items
29 
30  /// The timestamp at which the node is fully generated
32 
33  /// The total time spent generating work items
35 
36  /// The timestamp at which the node first began cooking work items
38 
39  /// The timestamp at which the node is fully cooked
41 
42  /// The total time spent cooking work items
44 
45  /// The number of different tracked node stats
46  eStatCount
47  };
48 
49 public:
50  /// Constructs a new node stat instance
51  PDG_NodeStats();
52 
53  /// Resets all stats on the node
54  void reset(bool full);
55 
56  /// Returns the work item state tracker for this node
58  { return myWorkItemStates; }
60  { return myWorkItemStates; }
61 
62  /// Returns the number of times this node has cooked
63  int cookCount() const
64  { return myCookCount; }
65 
66  /// Increments the cook count and returns the old value
68  {
69  int old_count = myCookCount++;
70  return old_count;
71  }
72 
73  /// Returns the current value of the specified stat type
74  fpreal getStat(StatType stat) const;
75 
76  /// Sets the value of the specified stat type
77  fpreal setStat(
78  StatType stat,
79  fpreal value,
80  bool first=false);
81 
82  /// Sets te value of the specified stat to the current time
83  fpreal setTimeStat(
84  StatType stat,
85  bool first=false);
86 
87  /// Adds the value to the specified state type
88  fpreal addStat(
89  StatType state,
90  fpreal value,
91  bool first=false);
92 
93  /// Returns the total time spent cooking work items in the node
94  fpreal totalCookTime() const;
95 
96  /// Returns the wallclock cook time, e.g. the difference between the
97  /// first work item starting and the last work item ending.
98  fpreal wallclockCookTime() const;
99 
100 private:
101  PDG_WorkItemStateTracker myWorkItemStates;
102  fpreal myStats[eStatCount];
103  int myCookCount;
104  mutable UT_TBBSpinLock myStatLock;
105 };
106 
107 #endif
The timestamp at which the node is fully generated.
Definition: PDG_NodeStats.h:31
GLint first
Definition: glcorearb.h:405
PDG_WorkItemStateTracker & stateTracker()
Definition: PDG_NodeStats.h:59
int cookCount() const
Returns the number of times this node has cooked.
Definition: PDG_NodeStats.h:63
#define PDG_API
Definition: PDG_API.h:23
The total time spent cooking work items.
Definition: PDG_NodeStats.h:43
The total time spent generating work items.
Definition: PDG_NodeStats.h:34
The timestamp at which the node first began cooking work items.
Definition: PDG_NodeStats.h:37
StatType
Enumeration of stats stored in this object.
Definition: PDG_NodeStats.h:25
The timestamp at which the node first began generating work items.
Definition: PDG_NodeStats.h:28
GLboolean reset
Definition: glad.h:5138
const PDG_WorkItemStateTracker & stateTracker() const
Returns the work item state tracker for this node.
Definition: PDG_NodeStats.h:57
fpreal64 fpreal
Definition: SYS_Types.h:277
Definition: core.h:1131
The timestamp at which the node is fully cooked.
Definition: PDG_NodeStats.h:40
int incrementCookCount()
Increments the cook count and returns the old value.
Definition: PDG_NodeStats.h:67