- Add two header <CGAL/Surface_mesher/Profile_timer.h> and

<CGAL/Surface_mesher/Profile_counter.h> that wrap the one in CGAL/.
- Add profilers to several parts of Surface_mesher code.
This commit is contained in:
Laurent Rineau 2009-01-23 15:01:25 +00:00
parent 811da8f5b0
commit f709e20493
4 changed files with 99 additions and 12 deletions

View File

@ -30,6 +30,8 @@
#include <queue>
#include <CGAL/Surface_mesher/Profile_timer.h>
#ifdef CGAL_SURFACE_MESHER_DEBUG_IMPLICIT_ORACLE
# define CGAL_SURFACE_MESHER_DEBUG_CLIPPED_SEGMENT
#endif
@ -226,6 +228,8 @@ namespace CGAL {
Object operator()(const Surface_3& surface, Segment_3 s)
// s is passed by value, because it is clipped below
{
CGAL_SURFACE_MESHER_TIME_PROFILER("Implificit_surface_oracle::Intersect_3::operator()");
CGAL_SURFACE_MESHER_PROFILER("Implificit_surface_oracle::Intersect_3::operator()");
typename GT::Construct_point_on_3 point_on =
GT().construct_point_on_3_object();

View File

@ -0,0 +1,54 @@
// Copyright (c) 2008 GeometryFactory (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Laurent Rineau
// This file is an adaptation of <CGAL/Profile_timer.h>, so that the
// macros are prefixed with CGAL_SURFACE_MESHER_ instead of CGAL_.
#ifndef CGAL_SURFACE_MESHER_PROFILE_COUNTER_H
#define CGAL_SURFACE_MESHER_PROFILE_COUNTER_H
#include <CGAL/Profile_counter.h>
#ifdef CGAL_SURFACE_MESHER_PROFILE
# define CGAL_SURFACE_MESHER_PROFILER(Y) \
{ static CGAL::Profile_counter tmp(Y); ++tmp; }
# define CGAL_SURFACE_MESHER_HISTOGRAM_PROFILER(Y, Z) \
{ static CGAL::Profile_histogram_counter tmp(Y); tmp(Z); }
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER(Y, NAME) \
static CGAL::Profile_branch_counter NAME(Y); ++NAME;
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH(NAME) \
NAME.increment_branch();
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_3(Y, NAME) \
static CGAL::Profile_branch_counter_3 NAME(Y); ++NAME;
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH_1(NAME) \
NAME.increment_branch_1();
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH_2(NAME) \
NAME.increment_branch_2();
#else
# define CGAL_SURFACE_MESHER_PROFILER(Y)
# define CGAL_SURFACE_MESHER_HISTOGRAM_PROFILER(Y, Z)
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER(Y, NAME)
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH(NAME)
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_3(Y, NAME)
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH_1(NAME)
# define CGAL_SURFACE_MESHER_BRANCH_PROFILER_BRANCH_2(NAME)
#endif
#endif // CGAL_SURFACE_MESHER_PROFILE_COUNTER_H

View File

@ -0,0 +1,35 @@
// Copyright (c) 2008 GeometryFactory (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Laurent Rineau
// This file is an adaptation of <CGAL/Profile_timer.h>, so that the
// macros are prefixed with CGAL_SURFACE_MESHER_ instead of CGAL_.
#ifndef CGAL_SURFACE_MESHER_PROFILE_TIMER_H
#define CGAL_SURFACE_MESHER_PROFILE_TIMER_H
#include <CGAL/Profile_timer.h>
#ifdef CGAL_SURFACE_MESHER_PROFILE
# define CGAL_SURFACE_MESHER_TIME_PROFILER(NAME) \
static CGAL::Profile_timer CGAL_profile_timer_tmp(NAME); \
CGAL::Profile_timer::Local CGAL_local_profile_timer_tmp(&CGAL_profile_timer_tmp);
#else
# define CGAL_SURFACE_MESHER_TIME_PROFILER(NAME)
#endif
#endif // CGAL_SURFACE_MESHER_TIME_PROFILER

View File

@ -38,17 +38,8 @@
#include <CGAL/Surface_mesher/Verbose_flag.h>
#include <CGAL/Surface_mesher/Types_generators.h>
#include <CGAL/Profile_counter.h>
#ifdef CGAL_SURFACE_MESHER_PROFILE
# define CGAL_SURFACE_MESHER_PROFILER(Y) \
{ static CGAL::Profile_counter tmp(Y); ++tmp; }
# define CGAL_SURFACE_MESHER_HISTOGRAM_PROFILER(Y,Z) \
{ static CGAL::Profile_histogram_counter tmp(Y); tmp(Z); }
#else
# define CGAL_SURFACE_MESHER_PROFILER(Y)
# define CGAL_SURFACE_MESHER_HISTOGRAM_PROFILER(Y,Z)
#endif
#include <CGAL/Surface_mesher/Profile_counter.h>
#include <CGAL/Surface_mesher/Profile_timer.h>
namespace CGAL {
@ -771,7 +762,10 @@ namespace CGAL {
++nbsteps;
timer.start();
while (!is_algorithm_done()) {
{
CGAL_SURFACE_MESHER_TIME_PROFILER("Surface_mesher::one_step()");
one_step (visitor);
}
std::cerr
<< boost::format("\r \r"
"(%1%,%2%,%3%) (%|4$.1f| vertices/s)")