Fixed and reenabled broken timing scripts
parent
97a6c3d94a
commit
87f2755ec6
|
@ -10,9 +10,6 @@ set(base_local_libs
|
|||
# Files to exclude from compilation of tests and timing scripts
|
||||
set(base_excluded_files
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/tests/testTypedDiscreteFactor.cpp" # Example of excluding a test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/timeTest.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/timeVirtual.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/timeVirtual2.cpp"
|
||||
# "" # Add to this list, with full path, to exclude
|
||||
)
|
||||
|
||||
|
|
|
@ -17,44 +17,56 @@
|
|||
|
||||
#include <gtsam/base/timing.h>
|
||||
|
||||
using namespace gtsam;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// FIXME: ticPush_ does not exist
|
||||
ticPush_("1", "top 1");
|
||||
ticPush_("1", "sub 1");
|
||||
gttic_("sub sub a");
|
||||
gttoc_("sub sub a");
|
||||
ticPop_("1", "sub 1");
|
||||
ticPush_("2", "sub 2");
|
||||
gttic_("sub sub b");
|
||||
gttoc_("sub sub b");
|
||||
ticPop_("2", "sub 2");
|
||||
ticPop_("1", "top 1");
|
||||
|
||||
ticPush_("2", "top 2");
|
||||
ticPush_("1", "sub 1");
|
||||
gttic_("sub sub a");
|
||||
gttoc_("sub sub a");
|
||||
ticPop_("1", "sub 1");
|
||||
ticPush_("2", "sub 2");
|
||||
gttic_("sub sub b");
|
||||
gttoc_("sub sub b");
|
||||
ticPop_("2", "sub 2");
|
||||
ticPop_("2", "top 2");
|
||||
|
||||
for(size_t i=0; i<1000000; ++i) {
|
||||
ticPush_("3", "overhead");
|
||||
ticPush_("1", "overhead");
|
||||
ticPop_("1", "overhead");
|
||||
ticPop_("3", "overhead");
|
||||
{
|
||||
gttic_(top1);
|
||||
gttic_(sub1);
|
||||
gttic_(sub_sub_a);
|
||||
gttoc_(sub_sub_a);
|
||||
gttoc_(sub1);
|
||||
gttic_(sub2);
|
||||
gttic_(sub_sub_b);
|
||||
gttoc_(sub_sub_b);
|
||||
gttoc_(sub2);
|
||||
gttoc_(top1);
|
||||
}
|
||||
|
||||
{
|
||||
gttic_(top2);
|
||||
gttic_(sub1);
|
||||
gttic_(sub_sub_a);
|
||||
gttoc_(sub_sub_a);
|
||||
gttoc_(sub1);
|
||||
gttic_(sub2);
|
||||
gttic_(sub_sub_b);
|
||||
gttoc_(sub_sub_b);
|
||||
gttoc_(sub2);
|
||||
gttoc_(top2);
|
||||
}
|
||||
|
||||
gttic_(top3);
|
||||
for(size_t i=0; i<1000000; ++i) {
|
||||
gttic_(overhead);
|
||||
gttic_(sub_overhead);
|
||||
gttoc_(sub_overhead);
|
||||
gttoc_(overhead);
|
||||
tictoc_finishedIteration_();
|
||||
}
|
||||
gttoc_(top3);
|
||||
|
||||
gttic_(top4);
|
||||
for(size_t i=0; i<1000000; ++i) {
|
||||
gttic(overhead_a);
|
||||
gttic(overhead_b);
|
||||
gttoc(overhead_b);
|
||||
gttoc(overhead_a);
|
||||
tictoc_finishedIteration();
|
||||
}
|
||||
gttoc_(top4);
|
||||
|
||||
tictoc_print_();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace gtsam;
|
||||
|
||||
struct Plain {
|
||||
size_t data;
|
||||
|
@ -59,98 +60,97 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
size_t trials = 10000000;
|
||||
|
||||
gttic_("heap plain alloc, dealloc");
|
||||
gttic_(heap_plain_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Plain *obj = new Plain(i);
|
||||
delete obj;
|
||||
}
|
||||
gttoc_("heap plain alloc, dealloc");
|
||||
gttoc_(heap_plain_alloc_dealloc);
|
||||
|
||||
gttic_("heap virtual alloc, dealloc");
|
||||
gttic_(heap_virtual_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Virtual *obj = new Virtual(i);
|
||||
delete obj;
|
||||
}
|
||||
gttoc_("heap virtual alloc, dealloc");
|
||||
gttoc_(heap_virtual_alloc_dealloc);
|
||||
|
||||
gttic_("stack plain alloc, dealloc");
|
||||
gttic_(stack_plain_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Plain obj(i);
|
||||
}
|
||||
gttoc_("stack plain alloc, dealloc");
|
||||
gttoc_(stack_plain_alloc_dealloc);
|
||||
|
||||
gttic_("stack virtual alloc, dealloc");
|
||||
gttic_(stack_virtual_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Virtual obj(i);
|
||||
}
|
||||
gttoc_("stack virtual alloc, dealloc");
|
||||
gttoc_(stack_virtual_alloc_dealloc);
|
||||
|
||||
gttic_("shared plain alloc, dealloc");
|
||||
gttic_(shared_plain_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
boost::shared_ptr<Plain> obj(new Plain(i));
|
||||
}
|
||||
gttoc_("shared plain alloc, dealloc");
|
||||
gttoc_(shared_plain_alloc_dealloc);
|
||||
|
||||
gttic_("shared virtual alloc, dealloc");
|
||||
gttic_(shared_virtual_alloc_dealloc);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
boost::shared_ptr<Virtual> obj(new Virtual(i));
|
||||
}
|
||||
gttoc_("shared virtual alloc, dealloc");
|
||||
gttoc_(shared_virtual_alloc_dealloc);
|
||||
|
||||
|
||||
gttic_("heap plain alloc, dealloc, call");
|
||||
gttic_(heap_plain_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Plain *obj = new Plain(i);
|
||||
obj->setData(i+1);
|
||||
delete obj;
|
||||
}
|
||||
gttoc_("heap plain alloc, dealloc, call");
|
||||
gttoc_(heap_plain_alloc_dealloc_call);
|
||||
|
||||
gttic_("heap virtual alloc, dealloc, call");
|
||||
gttic_(heap_virtual_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Virtual *obj = new Virtual(i);
|
||||
obj->setData(i+1);
|
||||
delete obj;
|
||||
}
|
||||
gttoc_("heap virtual alloc, dealloc, call");
|
||||
gttoc_(heap_virtual_alloc_dealloc_call);
|
||||
|
||||
gttic_("stack plain alloc, dealloc, call");
|
||||
gttic_(stack_plain_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Plain obj(i);
|
||||
obj.setData(i+1);
|
||||
}
|
||||
gttoc_("stack plain alloc, dealloc, call");
|
||||
gttoc_(stack_plain_alloc_dealloc_call);
|
||||
|
||||
gttic_("stack virtual alloc, dealloc, call");
|
||||
gttic_(stack_virtual_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
Virtual obj(i);
|
||||
obj.setData(i+1);
|
||||
}
|
||||
gttoc_("stack virtual alloc, dealloc, call");
|
||||
gttoc_(stack_virtual_alloc_dealloc_call);
|
||||
|
||||
gttic_("shared plain alloc, dealloc, call");
|
||||
gttic_(shared_plain_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
boost::shared_ptr<Plain> obj(new Plain(i));
|
||||
obj->setData(i+1);
|
||||
}
|
||||
gttoc_("shared plain alloc, dealloc, call");
|
||||
gttoc_(shared_plain_alloc_dealloc_call);
|
||||
|
||||
gttic_("shared virtual alloc, dealloc, call");
|
||||
gttic_(shared_virtual_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
boost::shared_ptr<Virtual> obj(new Virtual(i));
|
||||
obj->setData(i+1);
|
||||
}
|
||||
gttoc_("shared virtual alloc, dealloc, call");
|
||||
gttoc_(shared_virtual_alloc_dealloc_call);
|
||||
|
||||
gttic_("intrusive virtual alloc, dealloc, call");
|
||||
gttic_(intrusive_virtual_alloc_dealloc_call);
|
||||
for(size_t i=0; i<trials; ++i) {
|
||||
intrusive_ptr<VirtualCounted> obj(new VirtualCounted(i));
|
||||
obj->setData(i+1);
|
||||
}
|
||||
gttoc_("intrusive virtual alloc, dealloc, call");
|
||||
gttoc_(intrusive_virtual_alloc_dealloc_call);
|
||||
|
||||
tictoc_print_();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace gtsam;
|
||||
|
||||
struct DtorTestBase {
|
||||
DtorTestBase() { cout << " DtorTestBase" << endl; }
|
||||
|
@ -120,10 +121,10 @@ int main(int argc, char *argv[]) {
|
|||
for(int i=0; i<n; ++i)
|
||||
d[i]->method();
|
||||
gttoc_(method);
|
||||
gttic_(dynamic_cast (does nothing));
|
||||
gttic_(dynamic_cast_does_nothing);
|
||||
for(int i=0; i<n; ++i)
|
||||
d[i]->method();
|
||||
gttoc_(dynamic_cast (does nothing));
|
||||
gttoc_(dynamic_cast_does_nothing);
|
||||
gttic_(delete);
|
||||
for(int i=0; i<n; ++i)
|
||||
delete d[i];
|
||||
|
|
|
@ -14,8 +14,6 @@ set(linear_local_libs
|
|||
# Files to exclude from compilation of tests and timing scripts
|
||||
set(linear_excluded_files
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/tests/testTypedDiscreteFactor.cpp" # Example of excluding a test
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/timeSLAMlike.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/timeFactorOverhead.cpp"
|
||||
# "" # Add to this list, with full path, to exclude
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue