/* debug.h */ /* Copyright (C) 2006 Icare - http://www.icare.univ-lille1.fr Fabrice Ducos, fabrice.ducos@icare.univ-lille1.fr This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (License version 2 or later). This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. If you have any questions or concerns regarding this program, please email to problem@icare.univ-lille1.fr For general information about the ICARE Project, please email to icare-contact@univ-lille.fr */ #ifndef DEBUG_H #define DEBUG_H #include #include #ifdef DEBUG #define Debug(code) do { code } while (0) #else #define Debug(code) #endif #ifdef DEBUG #define PDEBUG do { std::cerr << __FILE__ << ": " << __LINE__ << ": " << __PRETTY_FUNCTION__ << std::endl; } while (0) #else #define PDEBUG #endif #ifdef DISABLE #define Disable(code) #endif #ifdef BENCH #include #define Bench(code) \ do { \ clock_t t0 = clock(); \ code; \ clock_t t1 = clock(); \ double t01 = (t1 - t0)/static_cast(CLOCKS_PER_SEC); \ std::cout << __FILE__ ": " << __LINE__ << ": " << t01 << " s (" << t1 - t0 << " us)" << std::endl; \ } while (0) #else #define Bench(code) do { code } while (0) #endif #endif