Reformat.
[ardour.git] / libs / ardour / ardour / cycle_timer.h
index 1ec7c7490385301a1d3ce1ff32cdb7b5ad9950c8..146b393a6367399e23a124c1c1c02e698e68b2b9 100644 (file)
@@ -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
     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 <string>
-#include <cstdio>
+#include <iostream>
 
-#include <ardour/cycles.h>
-
-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 ();