Skip to content
Snippets Groups Projects
Commit ee57bbf9 authored by Viktor Lopatin's avatar Viktor Lopatin
Browse files

Performance measurements

parent 0f4e29ed
No related branches found
No related tags found
No related merge requests found
......@@ -51,8 +51,8 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif
int main(int, char**) {
bool use_vr = false;
int main_real(int, char**) {
bool use_vr = true;
auto cut_plane_point = glm::vec3(1, 0, 1);
auto cut_plane_norm = glm::vec3(0, 1, 0);
......@@ -266,7 +266,7 @@ int main(int, char**) {
return EXIT_SUCCESS;
}
int main_bm(int, char**) {
int main(int, char**) {
bool use_vr = true;
std::unique_ptr<phx::Engine> engine =
......@@ -366,8 +366,8 @@ int main_bm(int, char**) {
nlohmann::json declaration = {
{"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}},
{"to", {{"X", 500.0f}, {"Y", 500.0f}, {"Z", 150.0f}}},
{"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}};
{"to", {{"X", 360.0f}, {"Y", 500.0f}, {"Z", 50.0f}}},
{"stride", {{"X", 3.0f}, {"Y", 3.0f}, {"Z", 3.0f}}}};
nlohmann::json planes_dec = {};
......@@ -387,40 +387,37 @@ int main_bm(int, char**) {
auto pli_resource = phx::ResourceUtils::LoadResourceFromFile<phx::PLIRegion>(
R"(/data/MSA0309_s0536-0695.h5)", declaration);
auto session = bm::run<float, std::milli>(
10, [&](bm::session_recorder<float, std::milli>& recorder) {
phx::PliDemoUtil::load(scene, std::vector<std::pair<glm::vec3, glm::vec3>>());
for (int i = 1; i < 11; i++) {
declaration = {
{"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}},
{"to", {{"X", 50.0f * i}, {"Y", 50.0f * i}, {"Z", 15.0f * i}}},
{"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}};
auto ray = phx::Ray(glm::vec3(0, 300, -50), glm::vec3(0, 0, 1));
planes_dec = {};
entity->FindOrAddComponent<phx::Transform>();
planes_dec.push_back({
{"A", 0},
{"B", -1},
{"C", 0},
{"D", -(1 * 0 + (40 * i) * (-1) + 1 * 0)},
});
pli_handle = entity->GetFirstComponent<phx::PLIHandle>(true);
mesh_handle = entity->GetFirstComponent<phx::MeshHandle>(true);
planes_dec.push_back({
{"A", 0},
{"B", 1},
{"C", 0},
{"D", -(1 * 0 + (10 * i) * (1) + 1 * 0)},
});
pli_handle->Activate();
mesh_handle->Activate();
declaration["cuttingPlane"] = planes_dec;
pli_resource =
phx::ResourceUtils::LoadResourceFromFile<phx::PLIRegion>(
R"(/data/MSA0309_s0536-0695.h5)", declaration);
std::cout << "Load finished" << std::endl;
recorder.record("load_" + std::to_string((50 * 50 * 15 * i * i * i)),
if (!use_vr) {
raycast->SetRay(scene->GetEntitiesWithComponents<phx::RenderTarget>()[0]
->GetFirstComponent<phx::Transform>());
raycast->SetTarget(pli_entity);
raycast->SetMarker(marker_entity);
}
auto session = bm::run<float, std::milli>(
10, [&](bm::session_recorder<float, std::milli>& recorder) {
for (int i = 1; i < 11; i++) {
recorder.record("trace," + std::to_string(30 * i) + "x" +
std::to_string(40 * i) + "x50",
[&]() {
phx::PliDemoUtil::load_surface_representation(
entity, pli_resource, false);
phx::PliDemoUtil::trace(
scene, glm::vec3(100.0, 100.0, 0),
glm::vec3(100 + 30 * i, 100 + 40 * i, 50));
});
}
......@@ -434,24 +431,7 @@ int main_bm(int, char**) {
std::cout << record_name << " m: " << mean << " v: " << variance
<< " std: " << standard_deviation << std::endl;
}
session.to_csv("loading_stride1_withplanes_sizes.csv", true);
entity->FindOrAddComponent<phx::Transform>();
pli_handle = entity->GetFirstComponent<phx::PLIHandle>(true);
mesh_handle = entity->GetFirstComponent<phx::MeshHandle>(true);
pli_handle->Activate();
mesh_handle->Activate();
std::cout << "Load finished" << std::endl;
if (!use_vr) {
raycast->SetRay(scene->GetEntitiesWithComponents<phx::RenderTarget>()[0]
->GetFirstComponent<phx::Transform>());
raycast->SetTarget(pli_entity);
raycast->SetMarker(marker_entity);
}
session.to_csv("trace_sizes.csv", true);
rendering_system->SetEnabled(true);
splash->SetEnabled(false);
......
......@@ -123,8 +123,8 @@ void PliDemoUtil::load(
nlohmann::json declaration = {
{"from", {{"X", 0.0f}, {"Y", 0.0f}, {"Z", 0.0f}}},
{"to", {{"X", 500.0f}, {"Y", 500.0f}, {"Z", 150.0f}}},
{"stride", {{"X", 1.0f}, {"Y", 1.0f}, {"Z", 1.0f}}}};
{"to", {{"X", 360.0f}, {"Y", 500.0f}, {"Z", 50.0f}}},
{"stride", {{"X", 3.0f}, {"Y", 3.0f}, {"Z", 3.0f}}}};
if (!cutting_planes.empty()) {
nlohmann::json planes_dec = {};
......
......@@ -76,8 +76,8 @@ void Engine::UpdateSystems() {
acc_time += frame_time;
// Send FPS to cout
if (frame_timer_.GetTimeInfo().frame_count % 10 == 0) {
float avg_time = acc_time / 10.0f;
if (frame_timer_.GetTimeInfo().frame_count % 100 == 0) {
float avg_time = acc_time / 100.0f;
float frame_rate = 1000.0f / avg_time;
std::cout << "Framerate: " << std::to_string(frame_rate) << std::endl;
acc_time = 0.0f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment