mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into view_frustum_work
This commit is contained in:
commit
2ea8ce8ef8
3 changed files with 53 additions and 56 deletions
|
@ -33,17 +33,17 @@
|
||||||
// int sampleAt;
|
// int sampleAt;
|
||||||
|
|
||||||
|
|
||||||
void CounterStatHistory::recordSample(long int thisCount) {
|
void CounterStatHistory::recordSample(long thisCount) {
|
||||||
timeval now;
|
timeval now;
|
||||||
gettimeofday(&now,NULL);
|
gettimeofday(&now,NULL);
|
||||||
double nowSeconds = (now.tv_usec/1000000.0)+(now.tv_sec);
|
double nowSeconds = (now.tv_usec/1000000.0)+(now.tv_sec);
|
||||||
this->recordSample(nowSeconds,thisCount);
|
this->recordSample(nowSeconds,thisCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CounterStatHistory::recordSample(double thisTime, long int thisCount) {
|
void CounterStatHistory::recordSample(double thisTime, long thisCount) {
|
||||||
|
|
||||||
// how much did we change since last sample?
|
// how much did we change since last sample?
|
||||||
long int thisDelta = thisCount - this->lastCount;
|
long thisDelta = thisCount - this->lastCount;
|
||||||
double elapsed = thisTime - this->lastTime;
|
double elapsed = thisTime - this->lastTime;
|
||||||
|
|
||||||
// record the latest values
|
// record the latest values
|
||||||
|
@ -74,12 +74,12 @@ void CounterStatHistory::recordSample(double thisTime, long int thisCount) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long int CounterStatHistory::getRunningAverage() {
|
long CounterStatHistory::getRunningAverage() {
|
||||||
// before we calculate our running average, always "reset" the current count, with the current time
|
// before we calculate our running average, always "reset" the current count, with the current time
|
||||||
// this will flush out old data, if we haven't been adding any new data.
|
// this will flush out old data, if we haven't been adding any new data.
|
||||||
this->recordSample(this->currentCount);
|
this->recordSample(this->currentCount);
|
||||||
|
|
||||||
long int runningTotal = 0;
|
long runningTotal = 0;
|
||||||
double minTime = this->timeSamples[0];
|
double minTime = this->timeSamples[0];
|
||||||
double maxTime = this->timeSamples[0];
|
double maxTime = this->timeSamples[0];
|
||||||
|
|
||||||
|
@ -90,6 +90,6 @@ long int CounterStatHistory::getRunningAverage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
double elapsedTime = maxTime-minTime;
|
double elapsedTime = maxTime-minTime;
|
||||||
long int runningAverage = runningTotal/elapsedTime;
|
long runningAverage = runningTotal/elapsedTime;
|
||||||
return runningAverage;
|
return runningAverage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,58 +22,56 @@
|
||||||
#define COUNTETSTATS_TIME_FRAME (COUNTETSTATS_SAMPLES_TO_KEEP*COUNTETSTATS_TIME_BETWEEN_SAMPLES)
|
#define COUNTETSTATS_TIME_FRAME (COUNTETSTATS_SAMPLES_TO_KEEP*COUNTETSTATS_TIME_BETWEEN_SAMPLES)
|
||||||
|
|
||||||
class CounterStatHistory {
|
class CounterStatHistory {
|
||||||
|
public:
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
CounterStatHistory(std::string myName):
|
||||||
|
currentCount(0), currentDelta(0),currentTime(0.0),
|
||||||
|
lastCount(0),lastTime(0.0),
|
||||||
|
totalTime(0.0),
|
||||||
|
sampleAt(-1), sampleCount(0), name(myName) {};
|
||||||
|
|
||||||
|
CounterStatHistory():
|
||||||
|
currentCount(0), currentDelta(0),currentTime(0.0),
|
||||||
|
lastCount(0),lastTime(0.0),
|
||||||
|
totalTime(0.0),
|
||||||
|
sampleAt(-1), sampleCount(0) {};
|
||||||
|
|
||||||
|
CounterStatHistory(std::string myName, double initialTime, long initialCount) :
|
||||||
|
currentCount(initialCount), currentDelta(0), currentTime(initialTime),
|
||||||
|
lastCount(initialCount),lastTime(initialTime),
|
||||||
|
totalTime(initialTime),
|
||||||
|
sampleAt(-1), sampleCount(0), name(myName) {};
|
||||||
|
|
||||||
|
void recordSample(long thisCount);
|
||||||
|
void recordSample(double thisTime, long thisCount);
|
||||||
|
long getRunningAverage();
|
||||||
|
|
||||||
|
long getAverage() {
|
||||||
|
return currentCount/totalTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
double getTotalTime() {
|
||||||
|
return totalTime;
|
||||||
|
};
|
||||||
|
long getCount() {
|
||||||
|
return currentCount;
|
||||||
|
};
|
||||||
private:
|
private:
|
||||||
long int currentCount;
|
long currentCount;
|
||||||
long int currentDelta;
|
long currentDelta;
|
||||||
double currentTime;
|
double currentTime;
|
||||||
|
|
||||||
long int lastCount;
|
long lastCount;
|
||||||
double lastTime;
|
double lastTime;
|
||||||
|
|
||||||
double totalTime;
|
double totalTime;
|
||||||
|
|
||||||
long int countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
long countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||||
long int deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
long deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||||
double timeSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
double timeSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||||
int sampleAt;
|
int sampleAt;
|
||||||
int sampleCount;
|
int sampleCount;
|
||||||
|
|
||||||
public:
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
CounterStatHistory(std::string myName):
|
|
||||||
currentCount(0), currentDelta(0),currentTime(0.0),
|
|
||||||
lastCount(0),lastTime(0.0),
|
|
||||||
totalTime(0.0),
|
|
||||||
sampleAt(-1),sampleCount(0), name(myName) {};
|
|
||||||
|
|
||||||
CounterStatHistory():
|
|
||||||
currentCount(0), currentDelta(0),currentTime(0.0),
|
|
||||||
lastCount(0),lastTime(0.0),
|
|
||||||
totalTime(0.0),
|
|
||||||
sampleAt(-1),sampleCount(0) {};
|
|
||||||
|
|
||||||
CounterStatHistory(std::string myName, double initialTime, long int initialCount) :
|
|
||||||
currentCount(initialCount), currentDelta(0), currentTime(initialTime),
|
|
||||||
lastCount(initialCount),lastTime(initialTime),
|
|
||||||
totalTime(initialTime),
|
|
||||||
sampleAt(-1), sampleCount(0), name(myName) {};
|
|
||||||
|
|
||||||
void recordSample(long int thisCount);
|
|
||||||
void recordSample(double thisTime, long int thisCount);
|
|
||||||
long int getRunningAverage();
|
|
||||||
|
|
||||||
long int getAverage() {
|
|
||||||
return currentCount/totalTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
double getTotalTime() {
|
|
||||||
return totalTime;
|
|
||||||
};
|
|
||||||
long int getCount() {
|
|
||||||
return currentCount;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__CounterStat__) */
|
#endif /* defined(__hifi__CounterStat__) */
|
||||||
|
|
|
@ -19,15 +19,10 @@ const int MAX_TREE_SLICE_BYTES = 26;
|
||||||
const int TREE_SCALE = 10;
|
const int TREE_SCALE = 10;
|
||||||
|
|
||||||
class VoxelTree {
|
class VoxelTree {
|
||||||
VoxelNode * nodeForOctalCode(VoxelNode *ancestorNode, unsigned char * needleCode, VoxelNode** parentOfFoundNode);
|
|
||||||
VoxelNode * createMissingNode(VoxelNode *lastParentNode, unsigned char *deepestCodeToCreate);
|
|
||||||
int readNodeData(VoxelNode *destinationNode, unsigned char * nodeData, int bufferSizeBytes);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
long int voxelsCreated;
|
long voxelsCreated;
|
||||||
long int voxelsColored;
|
long voxelsColored;
|
||||||
long int voxelsBytesRead;
|
long voxelsBytesRead;
|
||||||
|
|
||||||
CounterStatHistory voxelsCreatedStats;
|
CounterStatHistory voxelsCreatedStats;
|
||||||
CounterStatHistory voxelsColoredStats;
|
CounterStatHistory voxelsColoredStats;
|
||||||
|
@ -56,6 +51,10 @@ public:
|
||||||
|
|
||||||
void loadVoxelsFile(const char* fileName, bool wantColorRandomizer);
|
void loadVoxelsFile(const char* fileName, bool wantColorRandomizer);
|
||||||
void createSphere(float r,float xc, float yc, float zc, float s, bool solid, bool wantColorRandomizer);
|
void createSphere(float r,float xc, float yc, float zc, float s, bool solid, bool wantColorRandomizer);
|
||||||
|
private:
|
||||||
|
VoxelNode * nodeForOctalCode(VoxelNode *ancestorNode, unsigned char * needleCode, VoxelNode** parentOfFoundNode);
|
||||||
|
VoxelNode * createMissingNode(VoxelNode *lastParentNode, unsigned char *deepestCodeToCreate);
|
||||||
|
int readNodeData(VoxelNode *destinationNode, unsigned char * nodeData, int bufferSizeBytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
int boundaryDistanceForRenderLevel(unsigned int renderLevel);
|
int boundaryDistanceForRenderLevel(unsigned int renderLevel);
|
||||||
|
|
Loading…
Reference in a new issue