New profiling tool : Profile_branch_counter, that improves the display

of failure/calls ratios.  With the corresponding macro CGAL_BRANCH_PROFILER().
This commit is contained in:
Sylvain Pion 2008-09-08 09:52:37 +00:00
parent 54493b233b
commit a0be560caa
6 changed files with 169 additions and 143 deletions

View File

@ -91,9 +91,8 @@ public:
OutputIterator
operator()(const L1& l1, const L2& l2, OutputIterator it) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_vector lv(new Lazy_construct_rep_with_vector_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
@ -131,7 +130,7 @@ public:
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
// TODO: Instead of using a vector, write an iterator adapter
std::vector<Object> exact_objects;
@ -170,9 +169,8 @@ public:
OutputIterator
operator()(const L1& l1,OutputIterator it) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_vector lv(new Lazy_construct_rep_with_vector_1<AC, EC, E2A, L1>(ac, ec, l1));
// lv.approx() is a std::vector<Object([AK::Point_2,AK::Segment_2])>
@ -199,7 +197,7 @@ public:
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
// TODO: Instead of using a vector, write an iterator adapter
std::vector<Object> exact_objects;
@ -239,9 +237,8 @@ public:
OutputIterator
operator()(const L1& l1,OutputIterator it) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_vector lv(new Lazy_construct_rep_with_vector_1<AC, EC, E2A, L1>(ac, ec, l1));
// lv.approx() is a std::vector<Object([AK::Point_2,AK::Segment_2])>
@ -268,7 +265,7 @@ public:
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
// TODO: Instead of using a vector, write an iterator adapter
std::vector<Object> exact_objects;
@ -315,9 +312,8 @@ template <typename L1>
result_type
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_object lo(new Lazy_construct_rep_1<AC, EC, E2A, L1>(ac, ec, l1));
@ -351,7 +347,7 @@ template <typename L1>
std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's" << std::endl;
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
ET eto = ec(CGAL::exact(l1));
return make_lazy_CK<LK>(eto);
@ -365,9 +361,8 @@ template <typename L1>
result_type
operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_object lo(new Lazy_construct_rep_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
@ -402,7 +397,7 @@ template <typename L1>
std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's" << std::endl;
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
ET eto = ec(CGAL::exact(l1), CGAL::exact(l2));
return make_lazy_CK<LK>(eto);

View File

@ -153,17 +153,17 @@ typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const Args&... args) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(args)...);
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(args)...);
}
@ -175,17 +175,17 @@ typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1));
}
@ -195,17 +195,17 @@ typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ")+ std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2));
}
@ -215,17 +215,17 @@ typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3));
}
@ -235,17 +235,17 @@ typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4));
}
@ -256,17 +256,17 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5));
}
@ -277,17 +277,17 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5), c2a(a6));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5), c2e(a6));
}
@ -299,18 +299,18 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6, const A7 &a7) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5), c2a(a6),
c2a(a7));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5), c2e(a6), c2e(a7));
}
@ -322,18 +322,18 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5), c2a(a6),
c2a(a7), c2a(a8));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5), c2e(a6), c2e(a7),
c2e(a8));
}
@ -347,18 +347,18 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8,
const A9 &a9) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5), c2a(a6),
c2a(a7), c2a(a8), c2a(a9));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5), c2e(a6), c2e(a7),
c2e(a8), c2e(a9));
}
@ -372,18 +372,18 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8,
const A9 &a9, const A10 &a10) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Protect_FPU_rounding<Protection> p;
Ares res = ap(c2a(a1), c2a(a2), c2a(a3), c2a(a4), c2a(a5), c2a(a6),
c2a(a7), c2a(a8), c2a(a9), c2a(a10));
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
return ep(c2e(a1), c2e(a2), c2e(a3), c2e(a4), c2e(a5), c2e(a6), c2e(a7),
c2e(a8), c2e(a9), c2e(a10));
}

View File

@ -1181,12 +1181,12 @@ struct Lazy_construction_bbox
template <typename L1>
result_type operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return ac(CGAL::approx(l1));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return ec(CGAL::exact(l1));
}
@ -1211,12 +1211,12 @@ struct Lazy_construction_nt {
template <typename L1>
result_type operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return new Lazy_rep_1<AC, EC, To_interval<ET>, L1>(ac, ec, l1);
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1)));
}
@ -1225,12 +1225,12 @@ struct Lazy_construction_nt {
template <typename L1, typename L2>
result_type operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return new Lazy_rep_2<AC, EC, To_interval<ET>, L1,L2>(ac, ec, l1,l2);
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2)));
}
@ -1239,12 +1239,12 @@ struct Lazy_construction_nt {
template <typename L1, typename L2, typename L3>
result_type operator()(const L1& l1, const L2& l2, const L3& l3) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return new Lazy_rep_3<AC, EC, To_interval<ET>, L1,L2,L3>(ac, ec, l1,l2,l3);
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)));
}
@ -1253,12 +1253,12 @@ struct Lazy_construction_nt {
template <typename L1, typename L2, typename L3, typename L4>
result_type operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return new Lazy_rep_4<AC, EC, To_interval<ET>, L1,L2,L3,L4>(ac, ec, l1,l2,l3,l4);
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4)));
}
@ -1267,12 +1267,12 @@ struct Lazy_construction_nt {
template <typename L1, typename L2, typename L3, typename L4, typename L5>
result_type operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return new Lazy_rep_5<AC, EC, To_interval<ET>, L1,L2,L3,L4,L5>(ac, ec, l1,l2,l3,l4,l5);
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5)));
}
@ -1425,13 +1425,13 @@ public:
void
operator()(const L1& l1, const L2& l2, R1& r1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
// we suppose that R1 is a Lazy<Something>
r1 = R1(new Lazy_rep_2_1<AC, EC, E2A, L1, L2, R1>(ac, ec, l1, l2));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
typename R1::ET et;
ec(CGAL::exact(l1), CGAL::exact(l2), et);
@ -1490,8 +1490,8 @@ public:
void
operator()(const L1& l1, const L2& l2, R1& r1, R2& r2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
typedef Lazy<std::pair<typename R1::AT, typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, EFT, E2A> Lazy_pair;
Lazy_pair lv(new Lazy_rep_2_2<AC, EC, E2A, L1, L2, R1, R2>(ac, ec, l1, l2));
@ -1499,7 +1499,7 @@ public:
r1 = R1(new Lazy_rep_1<First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv));
r2 = R2(new Lazy_rep_1<Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
typename R1::ET et1, et2;
ec(CGAL::exact(l1), CGAL::exact(l2), et1, et2);
@ -1535,8 +1535,8 @@ public:
OutputIterator
operator()(const L1& l1, const L2& l2, OutputIterator it) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_vector lv(new Lazy_rep_with_vector_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
// lv.approx() is a std::vector<Object([AK::Point_2,AK::Segment_2])>
@ -1556,7 +1556,7 @@ public:
}
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
// TODO: Instead of using a vector, write an iterator adapter
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
std::vector<Object> exact_objects;
@ -1614,8 +1614,8 @@ public:
result_type
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_object lo(new Lazy_rep_1<AC, EC, E2A, L1>(ac, ec, l1));
@ -1635,7 +1635,7 @@ public:
std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl;
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
ET eto = ec(CGAL::exact(l1));
return make_lazy<LK>(eto);
@ -1647,8 +1647,8 @@ public:
result_type
operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
Lazy_object lo(new Lazy_rep_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
@ -1668,7 +1668,7 @@ public:
std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl;
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
ET eto = ec(CGAL::exact(l1), CGAL::exact(l2));
return make_lazy<LK>(eto);
@ -1712,12 +1712,12 @@ public:
result_type
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_1<AC, EC, E2A, L1>(ac, ec, l1));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1))));
}
@ -1727,12 +1727,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2))));
}
@ -1742,12 +1742,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_3<AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))));
}
@ -1757,12 +1757,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_4<AC, EC, E2A, L1, L2, L3, L4>(ac, ec, l1, l2, l3, l4));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4))));
}
@ -1772,12 +1772,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_5<AC, EC, E2A, L1, L2, L3, L4, L5>(ac, ec, l1, l2, l3, l4, l5));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5))));
}
@ -1787,12 +1787,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_6<AC, EC, E2A, L1, L2, L3, L4, L5, L6>(ac, ec, l1, l2, l3, l4, l5, l6));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6))));
}
@ -1802,12 +1802,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6, const L7& l7) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_7<AC, EC, E2A, L1, L2, L3, L4, L5, L6, L7>(ac, ec, l1, l2, l3, l4, l5, l6, l7));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6), CGAL::exact(l7))));
}
@ -1817,12 +1817,12 @@ public:
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6, const L7& l7, const L8& l8) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<Protection> P;
return Handle(new Lazy_rep_8<AC, EC, E2A, L1, L2, L3, L4, L5, L6, L7, L8>(ac, ec, l1, l2, l3, l4, l5, l6, l7, l8));
} catch (Uncertain_conversion_exception) {
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P(CGAL_FE_TONEAREST);
return Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6), CGAL::exact(l7), CGAL::exact(l8))));
}

View File

@ -468,13 +468,13 @@ template <typename ET1, typename ET2>
bool
operator<(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
if (a.identical(b))
return false;
Uncertain<bool> res = a.approx() < b.approx();
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return a.exact() < b.exact();
}
@ -482,13 +482,13 @@ template <typename ET1, typename ET2>
bool
operator==(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
if (a.identical(b))
return true;
Uncertain<bool> res = a.approx() == b.approx();
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return a.exact() == b.exact();
}
@ -534,11 +534,11 @@ template <typename ET>
bool
operator<(const Lazy_exact_nt<ET>& a, int b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = a.approx() < b;
if (is_certain(res))
return res;
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return a.exact() < b;
}
@ -546,11 +546,11 @@ template <typename ET>
bool
operator>(const Lazy_exact_nt<ET>& a, int b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = b < a.approx();
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return b < a.exact();
}
@ -558,11 +558,11 @@ template <typename ET>
bool
operator==(const Lazy_exact_nt<ET>& a, int b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = b == a.approx();
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return b == a.exact();
}
@ -572,11 +572,11 @@ template <typename ET>
bool
operator<(const Lazy_exact_nt<ET>& a, double b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = a.approx() < b;
if (is_certain(res))
return res;
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return a.exact() < b;
}
@ -584,11 +584,11 @@ template <typename ET>
bool
operator>(const Lazy_exact_nt<ET>& a, double b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = b < a.approx();
if (is_certain(res))
return res;
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return b < a.exact();
}
@ -596,11 +596,11 @@ template <typename ET>
bool
operator==(const Lazy_exact_nt<ET>& a, double b)
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain<bool> res = b == a.approx();
if (is_certain(res))
return res;
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return b == a.exact();
}
@ -992,11 +992,11 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
: public std::unary_function< Type, ::CGAL::Sign > {
public:
::CGAL::Sign operator()( const Type& a ) const {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Uncertain< ::CGAL::Sign> res = CGAL_NTS sign(a.approx());
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return CGAL_NTS sign(a.exact());
}
};
@ -1007,13 +1007,13 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
public:
Comparison_result operator()( const Type& a,
const Type& b ) const {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
if (a.identical(b))
return EQUAL;
Uncertain<Comparison_result> res = CGAL_NTS compare(a.approx(), b.approx());
if (is_certain(res))
return get_certain(res);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return CGAL_NTS compare(a.exact(), b.exact());
}
@ -1026,7 +1026,7 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
: public std::unary_function< Type, double > {
public:
double operator()( const Type& a ) const {
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
const Interval_nt<false>& app = a.approx();
double r;
@ -1038,7 +1038,7 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
Lazy_exact_nt<ET>::get_relative_precision_of_to_double()))
return CGAL_NTS to_double(app);
CGAL_PROFILER(std::string("failures of : ") + std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
// Otherwise we trigger exact computation first,
// which will refine the approximation.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005,2006 INRIA Sophia-Antipolis (France).
// Copyright (c) 2005,2006,2008 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
@ -21,13 +21,21 @@
#ifndef CGAL_PROFILE_COUNTER_H
#define CGAL_PROFILE_COUNTER_H
// This file contains the class Profile_counter which is able to keep track
// of a number, and prints a message in the destructor.
// Typically, it can be used as a profile counter in a static variable.
// This file contains 3 classes to help in profiling, together with macros
// triggered by CGAL_PROFILE to enable them:
//
// - Profile_counter which is able to keep track of a number, and prints a
// message in the destructor. Typically, it can be used as a profile counter
// in a static variable.
//
// - Profile_histogram_counter which is similar, but the counter is indexed by
// a value (unsigned int), and the final dump is the histogram of the non-zero
// counters.
//
// - Profile_branch_counter which keeps track of 2 counters, aiming at measuring
// the ratio corresponding to the number of times a branch is taken.
// It also provides the class Profile_histogram_counter which is similar,
// but the counter is indexed by a value (unsigned int), and the final dump
// is the histogram of the non-zero counters. [TODO : to be documented]
// TODO : complete the documentation.
#include <CGAL/config.h>
#include <iostream>
@ -86,14 +94,43 @@ private:
const std::string s;
};
struct Profile_branch_counter
{
Profile_branch_counter(const std::string & ss)
: i(0), j(0), s(ss) {}
void operator++() { ++i; }
void increment_branch() { ++j; }
~Profile_branch_counter()
{
std::cerr << "[CGAL::Profile_branch_counter] "
<< std::setw(10) << j << " / "
<< std::setw(10) << i << " " << s << std::endl;
}
private:
unsigned int i, j;
const std::string s;
};
#ifdef CGAL_PROFILE
# define CGAL_PROFILER(Y) \
{ static CGAL::Profile_counter tmp(Y); ++tmp; }
# define CGAL_HISTOGRAM_PROFILER(Y,Z) \
# define CGAL_HISTOGRAM_PROFILER(Y, Z) \
{ static CGAL::Profile_histogram_counter tmp(Y); tmp(Z); }
# define CGAL_BRANCH_PROFILER(Y, NAME) \
static CGAL::Profile_branch_counter NAME(Y); ++NAME;
# define CGAL_BRANCH_PROFILER_BRANCH(NAME) \
NAME.increment_branch();
#else
# define CGAL_PROFILER(Y)
# define CGAL_HISTOGRAM_PROFILER(Y,Z)
# define CGAL_HISTOGRAM_PROFILER(Y, Z)
# define CGAL_BRANCH_PROFILER(Y, NAME)
# define CGAL_BRANCH_PROFILER_BRANCH(NAME)
#endif
CGAL_END_NAMESPACE

View File

@ -294,18 +294,16 @@ sign(TMC_Vertex_handle vit) const {
CGAL_assertion(!_tmc.is_infinite(ch));
// don't use sign, since the point is constructed:
CGAL_BRANCH_PROFILER(std::string(" NGHK: failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("NGHK: calls to : ") +
std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<true> P;
Sign result = vit->cell()->info().second->sign(vit->point());
if (is_certain(result))
return result;
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("NGHK: failures of : ") +
std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
typedef Exact_predicates_exact_constructions_kernel EK;
Skin_surface_traits_3<EK> exact_traits(shrink_factor());
@ -332,18 +330,16 @@ template <class MixedComplexTraits_3>
Sign
Skin_surface_base_3<MixedComplexTraits_3>::
sign(const Bare_point &p, const Cell_info &info) const {
CGAL_BRANCH_PROFILER(std::string(" NGHK: failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("NGHK: calls to : ") +
std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<true> P;
Sign result = sign_inexact(p,info);
if (is_certain(result))
return result;
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("NGHK: failures of : ") +
std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
return construct_surface
(info.first,
@ -624,10 +620,9 @@ compare(Cell_info &info1,
const Bare_point &p1,
Cell_info &info2,
const Bare_point &p2) const {
CGAL_BRANCH_PROFILER(std::string(" NGHK: failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
try
{
CGAL_PROFILER(std::string("NGHK: calls to : ") +
std::string(CGAL_PRETTY_FUNCTION));
Protect_FPU_rounding<true> P;
Sign result = CGAL_NTS sign(info1.second->value(p1) -
info2.second->value(p2));
@ -635,8 +630,7 @@ compare(Cell_info &info1,
return result;
}
catch (Uncertain_conversion_exception) {}
CGAL_PROFILER(std::string("NGHK: failures of : ") +
std::string(CGAL_PRETTY_FUNCTION));
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
return CGAL_NTS sign(