mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 11:46:34 +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;
|
||||
|
||||
|
||||
void CounterStatHistory::recordSample(long int thisCount) {
|
||||
void CounterStatHistory::recordSample(long thisCount) {
|
||||
timeval now;
|
||||
gettimeofday(&now,NULL);
|
||||
double nowSeconds = (now.tv_usec/1000000.0)+(now.tv_sec);
|
||||
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?
|
||||
long int thisDelta = thisCount - this->lastCount;
|
||||
long thisDelta = thisCount - this->lastCount;
|
||||
double elapsed = thisTime - this->lastTime;
|
||||
|
||||
// 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
|
||||
// this will flush out old data, if we haven't been adding any new data.
|
||||
this->recordSample(this->currentCount);
|
||||
|
||||
long int runningTotal = 0;
|
||||
long runningTotal = 0;
|
||||
double minTime = this->timeSamples[0];
|
||||
double maxTime = this->timeSamples[0];
|
||||
|
||||
|
@ -90,6 +90,6 @@ long int CounterStatHistory::getRunningAverage() {
|
|||
}
|
||||
|
||||
double elapsedTime = maxTime-minTime;
|
||||
long int runningAverage = runningTotal/elapsedTime;
|
||||
long runningAverage = runningTotal/elapsedTime;
|
||||
return runningAverage;
|
||||
}
|
||||
|
|
|
@ -22,58 +22,56 @@
|
|||
#define COUNTETSTATS_TIME_FRAME (COUNTETSTATS_SAMPLES_TO_KEEP*COUNTETSTATS_TIME_BETWEEN_SAMPLES)
|
||||
|
||||
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:
|
||||
long int currentCount;
|
||||
long int currentDelta;
|
||||
long currentCount;
|
||||
long currentDelta;
|
||||
double currentTime;
|
||||
|
||||
long int lastCount;
|
||||
long lastCount;
|
||||
double lastTime;
|
||||
|
||||
double totalTime;
|
||||
|
||||
long int countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||
long int deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||
long countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||
long deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||
double timeSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
|
||||
int sampleAt;
|
||||
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__) */
|
||||
|
|
|
@ -19,15 +19,10 @@ const int MAX_TREE_SLICE_BYTES = 26;
|
|||
const int TREE_SCALE = 10;
|
||||
|
||||
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:
|
||||
long int voxelsCreated;
|
||||
long int voxelsColored;
|
||||
long int voxelsBytesRead;
|
||||
long voxelsCreated;
|
||||
long voxelsColored;
|
||||
long voxelsBytesRead;
|
||||
|
||||
CounterStatHistory voxelsCreatedStats;
|
||||
CounterStatHistory voxelsColoredStats;
|
||||
|
@ -56,6 +51,10 @@ public:
|
|||
|
||||
void loadVoxelsFile(const char* fileName, 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);
|
||||
|
|
Loading…
Reference in a new issue