X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fcycle_timer.h;h=146b393a6367399e23a124c1c1c02e698e68b2b9;hb=844b7d0f684eaf01a8d553f935027f496a09c3ad;hp=1ec7c7490385301a1d3ce1ff32cdb7b5ad9950c8;hpb=8af0757b61990767f2a85e68f535a5af9976fd79;p=ardour.git diff --git a/libs/ardour/ardour/cycle_timer.h b/libs/ardour/ardour/cycle_timer.h index 1ec7c74903..146b393a63 100644 --- a/libs/ardour/ardour/cycle_timer.h +++ b/libs/ardour/ardour/cycle_timer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis 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 @@ -15,36 +15,33 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __ardour_cycle_timer_h__ #define __ardour_cycle_timer_h__ #include -#include +#include -#include - -using std::string; +#include "ardour/cycles.h" class CycleTimer { private: static float cycles_per_usec; - uint32_t long entry; - uint32_t long exit; - string _name; - + cycles_t _entry; + cycles_t _exit; + std::string _name; + public: - CycleTimer(string name) : _name (name){ + CycleTimer(std::string name) : _name (name){ if (cycles_per_usec == 0) { cycles_per_usec = get_mhz (); } - entry = get_cycles(); + _entry = get_cycles(); } ~CycleTimer() { - exit = get_cycles(); - printf ("%s: %.9f usecs (%lu-%lu)\n", _name.c_str(), (float) (exit - entry) / cycles_per_usec, entry, exit); + _exit = get_cycles(); + std::cerr << _name << ": " << (float) (_exit - _entry) / cycles_per_usec << " (" << _entry << ", " << _exit << ')' << std::endl; } static float get_mhz ();