Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Timer.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file basic/gpu/Timer.hh
11 /// @brief High-resolution Timer (ns resolution, but on *nix only)
12 /// @author Luki Goldschmidt (luki@mbi.ucla.edu)
13 
14 #ifndef INCLUDED_basic_gpu_Timer_hh
15 #define INCLUDED_basic_gpu_Timer_hh
16 
17 #ifdef WIN32
18 #include <time.h>
19 #else
20 #include <sys/time.h>
21 #endif
22 
23 #include <basic/Tracer.hh>
24 
25 namespace basic {
26 namespace gpu {
27 
28 class Timer {
29 #ifdef WIN32
30  clock_t start, end;
31 #else
32  struct timeval start, end;
33 #endif
34  const char *tag_;
36 public:
37  Timer(const char *tag);
38  Timer(basic::Tracer::TracerProxy& t, const char *tag =NULL);
39  Timer();
40  ~Timer();
41  void Report(const char *tag =NULL);
42  void Reset();
43  double GetTime();
44 };
45 
46 } // gpu
47 } // basic
48 
49 #endif // INCLUDED_basic_gpu_Timer_hh
void Report(const char *tag=NULL)
Definition: Timer.cc:69
double GetTime()
Definition: Timer.cc:62
struct timeval start end
Definition: Timer.hh:32
void Reset()
Definition: Timer.cc:58
const char * tag_
Definition: Timer.hh:34
Tracer IO system.
Small inner class acting as a proxy to an object that hold it.
Definition: Tracer.hh:228
basic::Tracer::TracerProxy * t_
Definition: Timer.hh:35
rule< Scanner, tag_closure::context_t > tag
Definition: Tag.cc:373