Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
profile_highlevel.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
20// $File: //depot/GeneralsMD/Staging/code/Libraries/Source/profile/profile_highlevel.h $
21// $Author: mhoffe $
22// $Revision: #2 $
23// $DateTime: 2003/07/09 10:57:23 $
24//
25// ©2003 Electronic Arts
26//
27// High level profiling
29#ifdef _MSC_VER
30# pragma once
31#endif
32#ifndef PROFILE_HIGHLEVEL_H // Include guard
33#define PROFILE_HIGHLEVEL_H
34
36class ProfileId;
37
41class ProfileHighLevel
42{
43 friend class Profile;
44
45 // no, no copying allowed!
46 ProfileHighLevel(const ProfileHighLevel&);
47 ProfileHighLevel& operator=(const ProfileHighLevel&);
48
49public:
50
52 class Id
53 {
54 friend ProfileHighLevel;
55
56 public:
57 Id(void): m_idPtr(0) {}
58
66 void Increment(double add=1.0);
67
79 void SetMax(double max);
80
86 const char *GetName(void) const;
87
93 const char *GetDescr(void) const;
94
100 const char *GetUnit(void) const;
101
116 const char *GetCurrentValue(void) const;
117
127 const char *GetValue(unsigned frame) const;
128
139 const char *GetTotalValue(void) const;
140
141 private:
142
144 ProfileId *m_idPtr;
145 };
146
148 class Block
149 {
150 friend ProfileHighLevel;
151
152 // no copying
153 Block(const Block&);
154 Block& operator=(const Block&);
155
156 public:
166 explicit Block(const char *name);
167
169 ~Block();
170
171 private:
173 Id m_idTime;
174
176 _int64 m_start;
177 };
178
199 static Id AddProfile(const char *name, const char *descr, const char *unit, int precision, int exp10=0);
200
210 static bool EnumProfile(unsigned index, Id &id);
211
223 static bool FindProfile(const char *name, Id &id);
224
225private:
226
233 ProfileHighLevel(void);
234
238 static ProfileHighLevel Instance;
239};
240
241#endif // PROFILE_HIGHLEVEL_H
#define max(x, y)
Definition BaseType.h:105
void add(float *sum, float *addend)
~Block()
Updates timer based function block.
A high level profile ID.
const char * GetName(void) const
Returns the internal Id name.
const char * GetCurrentValue(void) const
Returns the current value.
void SetMax(double max)
Set a new maximum value.
const char * GetUnit(void) const
Returns the value's unit text.
const char * GetValue(unsigned frame) const
Returns the value for the given recorded frame/range.
void Increment(double add=1.0)
Increment the internal profile value.
const char * GetDescr(void) const
Returns the descriptive name.
const char * GetTotalValue(void) const
Returns the total value for all frames.
static bool FindProfile(const char *name, Id &id)
Searches for the given high level profile.
static bool EnumProfile(unsigned index, Id &id)
Enumerates the list of known high level profile values.
static Id AddProfile(const char *name, const char *descr, const char *unit, int precision, int exp10=0)
Registers a new high level profile value.
an internal high level profile ID