Accumulated measures of Events, Update, Recursive Updates.
This commit is contained in:
@@ -248,6 +248,15 @@ protected:
|
|||||||
EntityID GenerateEntityID();
|
EntityID GenerateEntityID();
|
||||||
|
|
||||||
void RecycleEntityID(EntityID id);
|
void RecycleEntityID(EntityID id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//Benchmarking
|
||||||
|
struct TimeMeasure {
|
||||||
|
double EventTime;
|
||||||
|
double SystemTime;
|
||||||
|
double RSystemTime;
|
||||||
|
};
|
||||||
|
std::map<std::string, TimeMeasure> m_typeToTimeMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
+19
-4
@@ -59,27 +59,42 @@ void dd::World::Update(double dt)
|
|||||||
const std::string &type = pair.first;
|
const std::string &type = pair.first;
|
||||||
auto system = pair.second;
|
auto system = pair.second;
|
||||||
|
|
||||||
LOG_INFO("System: %s", type.c_str());
|
std::map<std::string, TimeMeasure>::iterator it = m_typeToTimeMap.find(type.c_str());
|
||||||
|
if (it == m_typeToTimeMap.end()) {
|
||||||
|
//Does not contain item
|
||||||
|
TimeMeasure t;
|
||||||
|
t.EventTime = 0;
|
||||||
|
t.SystemTime = 0;
|
||||||
|
t.RSystemTime = 0;
|
||||||
|
m_typeToTimeMap[type.c_str()] = t;
|
||||||
|
}
|
||||||
|
|
||||||
double start = glfwGetTime();
|
double start = glfwGetTime();
|
||||||
EventBroker->Process(type);
|
EventBroker->Process(type);
|
||||||
double stop = glfwGetTime();
|
double stop = glfwGetTime();
|
||||||
double t1 = stop - start;
|
double t1 = stop - start;
|
||||||
LOG_INFO("Events: %f", t1);
|
m_typeToTimeMap[type.c_str()].EventTime += t1;
|
||||||
|
|
||||||
start = glfwGetTime();
|
start = glfwGetTime();
|
||||||
system->Update(dt);
|
system->Update(dt);
|
||||||
stop = glfwGetTime();
|
stop = glfwGetTime();
|
||||||
double t2 = stop - start;
|
double t2 = stop - start;
|
||||||
LOG_INFO("Systems: %f", t2);
|
m_typeToTimeMap[type.c_str()].SystemTime += t2;
|
||||||
|
|
||||||
start = glfwGetTime();
|
start = glfwGetTime();
|
||||||
RecursiveUpdate(system, dt, 0);
|
RecursiveUpdate(system, dt, 0);
|
||||||
stop = glfwGetTime();
|
stop = glfwGetTime();
|
||||||
double t3 = stop - start;
|
double t3 = stop - start;
|
||||||
LOG_INFO("Recursive Systems: %f", t3);
|
m_typeToTimeMap[type.c_str()].RSystemTime += t3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto item : m_typeToTimeMap)
|
||||||
|
{
|
||||||
|
LOG_INFO("Type %s", item.first.c_str());
|
||||||
|
LOG_INFO("Events: %f", item.second.EventTime);
|
||||||
|
LOG_INFO("Systems: %f", item.second.SystemTime);
|
||||||
|
LOG_INFO("Recursive Systems: %f", item.second.RSystemTime);
|
||||||
|
}
|
||||||
ProcessEntityRemovals();
|
ProcessEntityRemovals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event)
|
|||||||
|
|
||||||
|
|
||||||
//Play
|
//Play
|
||||||
alSourcePlay(source);
|
//alSourcePlay(source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user