Cleaned up profiler storage, removed issue with double free.

Profilers are no longer required to be manually deleted. Swtiched to smart pointers for this one.
main
Brett 2022-11-13 13:10:58 -05:00
parent 7a09800c40
commit 57ede806b0
28 changed files with 65 additions and 21 deletions

Binary file not shown.

View File

@ -23,3 +23,48 @@
2 2362 1668306655590361727 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 71dc053459a0e1f1
2 3200 1668306656426385604 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 604a2e8d964efb9f
2 1622 1668274730524259221 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o e7cc33824fbdff30
3 942 1668362748605515989 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1373 1668362749041528665 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
3 1631 1668362749297536103 CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o 6b49c8b248d04bb6
3 1762 1668362749429539940 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o e9e3fe6fe9a4de66
2 1849 1668362749513542381 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
2 2023 1668362749689547500 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 12778f168a75833b
3 2081 1668362749749549242 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
2023 2244 1668362749909553892 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 35f01a0bb2fddead
3 2354 1668362750021557148 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554
2244 2466 1668362750133560403 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 45a2ee53269bffeb
2082 2569 1668362750237563426 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o 6f5a39b3d5d543ae
3 2845 1668362750505571219 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
2 3085 1668362750749578312 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
942 3150 1668362750817580289 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
1763 3332 1668362750997585518 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o cf522ea42b0f8fd3
2 3562 1668362751225592146 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2 3800 1668362751465599125 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 4ca9d05ad8f3d295
2569 3864 1668362751533601098 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 10752ac78f398bdb
2354 4138 1668362751805609008 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o dc4b23b5e01a8208
1374 4227 1668362751893611563 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
1849 4534 1668362752197620402 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o 707f99c685c75a0f
2466 5248 1668362752913641215 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o d81abd5f968f8f53
1631 5297 1668362752961642610 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o f152a6b2309aba93
5297 5505 1668362753169648656 Step_3 7f6959eaebe4da02
1 1693 1668362807195219265 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554
1 2108 1668362807611231362 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
2 2177 1668362807679233339 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
1 2414 1668362807915240201 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
1 2489 1668362807991242410 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2489 2692 1668362808195248344 Step_3 7f6959eaebe4da02
1 965 1668362864276879195 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
1 1166 1668362864480885130 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
1 2161 1668362865472913981 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
1 2299 1668362865612918054 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2299 2502 1668362865812923870 Step_3 7f6959eaebe4da02
1 1228 1668362988976506901 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
1 2230 1668362989976535999 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
1 2290 1668362990036537746 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
1 1013 1668363015781286921 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
1014 1262 1668363016025294021 Step_3 7f6959eaebe4da02
1 992 1668363033961816015 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
1 1252 1668363034221823584 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
1 2232 1668363035201852107 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
1 2254 1668363035221852687 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2254 2476 1668363035445859208 Step_3 7f6959eaebe4da02

Binary file not shown.

View File

@ -1,3 +1,3 @@
Start testing: Nov 12 21:32 EST
Start testing: Nov 13 13:10 EST
----------------------------------------------------------
End testing: Nov 12 21:32 EST
End testing: Nov 13 13:10 EST

View File

@ -26,3 +26,9 @@
2 2242 1668360836450355031 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o 1007c86c207ac940
2 1579 1668362569316307713 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1579 1704 1668362569440311315 Step_3 f055ce2b85635598
1 1319 1668362704700239985 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
2 1568 1668362704948247191 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
2 1667 1668362705048250097 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1 1710 1668362705092251375 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
1 2005 1668362705384259861 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
2005 2097 1668362705476262536 Step_3 f055ce2b85635598

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

View File

@ -1,3 +1,3 @@
Start testing: Nov 13 13:02 EST
Start testing: Nov 13 13:05 EST
----------------------------------------------------------
End testing: Nov 13 13:02 EST
End testing: Nov 13 13:05 EST

View File

@ -52,10 +52,11 @@ namespace Raytracing {
for (const auto& obj: objs) {
// if this object doesn't have an AABB, we cannot use a BVH on it
// If this ever fails we have a problem with the implementation.
assert(obj.aabb.isEmpty());
assert(!obj.aabb.isEmpty());
if (obj.aabb.intersects(aabbs.first)) {
space.left.push_back(obj);
} else if (obj.aabb.intersects(aabbs.second)) {
}
if (obj.aabb.intersects(aabbs.second)) {
space.right.push_back(obj);
}
}

View File

@ -20,7 +20,7 @@
namespace Raytracing {
class profiler;
extern std::unordered_map<std::string, profiler*> profiles;
extern std::unordered_map<std::string, std::shared_ptr<profiler>> profiles;
class DebugTab{
protected:
@ -47,7 +47,7 @@ namespace Raytracing {
auto p = profiles.at(name);
p->start(tabName);
} else {
auto p = new profiler(name);
auto p = std::make_shared<profiler>(name);
profiles.insert(std::pair(name, p));
p->start(tabName);
}
@ -65,7 +65,6 @@ namespace Raytracing {
static void print(const std::string& name){
try {
profiles.at(name)->print();
delete(profiles.at(name));
} catch (std::exception& e){}
}
@ -77,15 +76,11 @@ namespace Raytracing {
void render();
static void render(int count) {
for (auto p : profiles)
for (const auto& p : profiles)
p.second->render();
}
~profiler();
static void cleanup(){
for (const auto& p : profiles)
delete(p.second);
}
~profiler() = default;
};
}

View File

@ -10,5 +10,5 @@ bool* pauseRaytracing;
bool* haltRaytracing;
namespace Raytracing {
std::unordered_map<std::string, profiler*> profiles;
std::unordered_map<std::string, std::shared_ptr<profiler>> profiles;
}

View File

@ -196,8 +196,5 @@ int main(int argc, char** args) {
deleteQuad();
#endif
for (auto& p : Raytracing::profiles)
delete(p.second);
return 0;
}

View File

@ -58,8 +58,8 @@ namespace Raytracing {
ImGui::NewLine();*/
}
profiler::~profiler() {
//profiler::~profiler() {
// currently unused as we don't have a UI yet.
//TD::debugUI::deleteTab(this);
}
//}
}