VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scenarioPerformanceTestManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include "vrfcgf/vrfcgfDefines.h"
11 
12 #include <chrono>
13 #include <atomic>
14 
15 #include <rapidjson/fwd.h>
16 
17 class DtCgf;
18 class DtScenario;
19 class DtLocalObject;
20 
22 {
23 public:
26  {
27  DtCoordInside = 0,
28  DtCoordNotInside = 1,
29  DtCoordIntersects = 2
30  };
31 
34  {
36  double meanFramerate;
40  double sampleTime;
41  };
42 
43  struct DtEntityInfo
44  {
45  std::string EntityType;
47 
48  bool operator==(const DtEntityInfo& rhs) const { return ( EntityType == rhs.EntityType && numEntities == rhs.numEntities ); };
49  };
50 
52  DtScenarioPerformanceTestManager(DtCgf* cgf, const DtString&, const DtString outputFilename = "");
53 
56 
59 
62 
64  static void postScenarioCloseCallback(void* usr);
65  virtual void postScenarioCloseCallback();
66  static void postScenarioLoadCallback(const DtScenario& s, void* usr);
67  virtual void postScenarioLoadCallback(const DtScenario& s);
68  static void postTickCallback(void* usr);
69  static void endBulkCreateCallback(void* usr);
70  virtual void endBulkCreateCallback();
71  virtual void tick();
72 
74  bool loadScenario();
75 
77  void setMaxTasks();
78 
80  bool jsonPrettyPrint() { return myRapidjsonPrettyPrint; };
81  void setJsonPrettyPrint(bool pp) { myRapidjsonPrettyPrint = pp; };
82 
84  int jsonDecimals() { return myRapidjsonDecimals; };
85  void setJsonDecimals(int d) { myRapidjsonDecimals = d; };
86 
88  int jsonIndentSize() { return myRapidjsonIndentSize; };
89  void setJsonIndentSize(int s) { myRapidjsonIndentSize = s; };
90 
91  DtRandomCoordGenerationStatus generateRandomPointInArea(DtSimObjectReference area, const double entityRadius, DtExtent& areaExtent, DtVector& coord,
92  const std::vector<DtVector>& checkPositions = std::vector<DtVector>());
93 
94 protected:
96  void loadConfig(const DtString&);
97 
99  void finishMonitoring();
100 
102  int checkTestName(const rapidjson::Value&) const;
103  bool checkEntityInfo(const rapidjson::Value&, const std::vector<DtEntityInfo>) const;
104  bool checkScenarioFile(const rapidjson::Value&) const;
105  bool checkProtocol(const rapidjson::Value&) const;
106  bool checkCallbackThreads(const rapidjson::Value&) const;
107 
109  void createJsonFile();
110 
111  void createEntities(const DtRwEntityCreationConfig& config, std::vector<DtLocalObject*>& ents);
112  DtExtent generateExtentsOfArea(DtSimObjectReference area);
113 
115  std::string getCurrentProtocol() const;
116 
118  std::string getCPUName() const;
119  double getMemoryInstalled() const;
121 
122 protected:
125  std::vector<DtPerformanceStatistics> myStats;
130 
135  std::string myOutputJson;
136  unsigned int myCurrentFrame;
137  unsigned int myMaxFrames;
138 
141 };
142 
void setJsonPrettyPrint(bool pp)
Definition: scenarioPerformanceTestManager.h:81
Definition: rwScenarioPerformanceTestConfig.h:86
int myRapidjsonDecimals
Definition: scenarioPerformanceTestManager.h:133
std::string myOutputJson
Definition: scenarioPerformanceTestManager.h:135
Definition: scenario.h:52
unsigned int myMaxFrames
Definition: scenarioPerformanceTestManager.h:137
DtRwScenarioPerformanceTestConfig myConfig
Definition: scenarioPerformanceTestManager.h:140
int jsonDecimals()
Set and Get the decimals.
Definition: scenarioPerformanceTestManager.h:84
std::string EntityType
Definition: scenarioPerformanceTestManager.h:45
DtCgf * myCgf
Definition: scenarioPerformanceTestManager.h:139
unsigned int myCurrentFrame
Definition: scenarioPerformanceTestManager.h:136
void setJsonDecimals(int d)
Definition: scenarioPerformanceTestManager.h:85
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
bool myDelayedStartSamplingTime
Definition: scenarioPerformanceTestManager.h:127
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
void setJsonIndentSize(int s)
Definition: scenarioPerformanceTestManager.h:89
int mySampleCount
Definition: scenarioPerformanceTestManager.h:129
double maximumFramerate
Definition: scenarioPerformanceTestManager.h:39
bool jsonPrettyPrint()
Set and Get whether to have RapidJson pretty print.
Definition: scenarioPerformanceTestManager.h:80
int numEntities
Definition: scenarioPerformanceTestManager.h:46
double myEntityCreationTime
unsigned int getThreadCount(); - TO ADD LATER if necessary
Definition: scenarioPerformanceTestManager.h:124
double meanFramerate
Definition: scenarioPerformanceTestManager.h:36
IMGUI_API void Value(const char *prefix, bool b)
double minimumFramerate
Definition: scenarioPerformanceTestManager.h:38
int jsonIndentSize()
Set and Get the indentation size.
Definition: scenarioPerformanceTestManager.h:88
Definition: rwScenarioPerformanceTestConfig.h:26
DtRandomCoordGenerationStatus
Enum for returning status of random coordinate generation.
Definition: scenarioPerformanceTestManager.h:25
Definition: scenarioPerformanceTestManager.h:43
Struct for storing framerate information.
Definition: scenarioPerformanceTestManager.h:33
int myRapidjsonIndentSize
Definition: scenarioPerformanceTestManager.h:134
bool myRapidjsonPrettyPrint
RapidJson.
Definition: scenarioPerformanceTestManager.h:132
double sampleTime
Definition: scenarioPerformanceTestManager.h:40
Contains the DtSimObjectReference class declaration.
Definition: scenarioPerformanceTestManager.h:21
double myLastCheckedTime
Definition: scenarioPerformanceTestManager.h:128
The top level class of a VR-Forces Simulation Engine, representing a Computer Generated Forces instan...
Definition: cgf.h:147
double myFinishedPostScenarioLoadTime
Definition: scenarioPerformanceTestManager.h:126
#define DT_DLL_vrfcgf
This file is used to determine how to build.
Definition: vrfcgfDefines.h:25
double standardDeviationFramerate
Definition: scenarioPerformanceTestManager.h:37
bool operator==(const DtEntityInfo &rhs) const
Definition: scenarioPerformanceTestManager.h:48
int sampleNumber
Definition: scenarioPerformanceTestManager.h:35
std::vector< DtPerformanceStatistics > myStats
Definition: scenarioPerformanceTestManager.h:125
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)