Gaudi Framework, version v23r9

Home   Generated: Thu Jul 18 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Timing.h
Go to the documentation of this file.
1 //====================================================================
2 // Timing.h
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/System (The LHCb System service)
6 //
7 // Description: Definition of Systems internals
8 //
9 // Author : M.Frank
10 // Created : 13/1/99
11 //====================================================================
12 #ifndef GAUDIKERNEL_TIMING_H
13 #define GAUDIKERNEL_TIMING_H
14 
15 // Framework include files
16 #include "GaudiKernel/Kernel.h"
17 #include "GaudiKernel/SystemBase.h"
18 
49 namespace System {
52 
55 
57  template <TimeType T>
58  inline long long adjustTime(long long timevalue);
59 
65  GAUDI_API longlong ellapsedTime(TimeType typ = milliSec, InfoType fetch = Times, long pid = -1);
73  GAUDI_API longlong kernelTime(TimeType typ = milliSec, InfoType fetch = Times, long pid = -1);
81  GAUDI_API longlong userTime(TimeType typ = milliSec, InfoType fetch = Times, long pid = -1);
89  GAUDI_API longlong cpuTime(TimeType typ = milliSec, InfoType fetch = Times, long pid = -1);
97  GAUDI_API longlong remainingTime(TimeType typ = milliSec, InfoType fetch = Quota, long pid = -1);
105  GAUDI_API longlong creationTime(TimeType typ = milliSec, InfoType fetch = Times, long pid = -1);
125 
133  class ProcessTime {
134  public:
135  typedef long long TimeValueType;
136 
139 
142  i_kernel(k), i_user(u), i_elapsed(e) {}
143 
145  template <TimeType T>
146  inline TimeValueType kernelTime() const { return adjustTime<T>(i_kernel); }
147 
149  template <TimeType T>
150  inline TimeValueType userTime() const { return adjustTime<T>(i_user); }
151 
153  template <TimeType T>
154  inline TimeValueType elapsedTime() const { return adjustTime<T>(i_elapsed); }
155 
157  template <TimeType T>
158  inline TimeValueType cpuTime() const { return adjustTime<T>(i_user + i_kernel); }
159 
161  inline ProcessTime operator-(const ProcessTime &rhs) const {
162  return ProcessTime(i_kernel - rhs.i_kernel,
163  i_user - rhs.i_user,
164  i_elapsed - rhs.i_elapsed);
165  }
166  private:
169  };
170 
176  GAUDI_API ProcessTime getProcessTime(long pid = -1);
177 
178 }
179 
180 // implementation of the templated adjustTime
181 namespace System {
182  template <>
183  inline long long adjustTime<Year>(long long t) {
184  return (t==-1) ? t : t /= (1LL * 365 * 24 * 60 * 60 * 1000 * 1000 * 10);
185  }
186  template <>
187  inline long long adjustTime<Day>(long long t) {
188  return (t==-1) ? t : t /= (1LL * 24 * 60 * 60 * 1000 * 1000 * 10);
189  }
190  template <>
191  inline long long adjustTime<Hour>(long long t) {
192  return (t==-1) ? t : t /= (1LL * 60 * 60 * 1000 * 1000 * 10);
193  }
194  template <>
195  inline long long adjustTime<Min>(long long t) {
196  return (t==-1) ? t : t /= (60 * 1000 * 1000 * 10);
197  }
198  template <>
199  inline long long adjustTime<Sec>(long long t) {
200  return (t==-1) ? t : t /= (1000 * 1000 * 10);
201  }
202  template <>
203  inline long long adjustTime<milliSec>(long long t) {
204  return (t==-1) ? t : t /= (1000 * 10);
205  }
206  template <>
207  inline long long adjustTime<microSec>(long long t) {
208  return (t==-1) ? t : t /= (10LL);
209  }
210  template <>
211  inline long long adjustTime<nanoSec>(long long t) {
212  return (t==-1) ? t : t *= 100LL;
213  }
214  template <>
215  inline long long adjustTime<Month>(long long t) {
216  return (t==-1) ? t : t /= (1LL * 30 * 24 * 60 * 60 * 1000 * 1000 * 10);
217  }
218  template <>
219  inline long long adjustTime<Native>(long long t) {
220  return t;
221  }
222 }
223 
224 #endif // GAUDIKERNEL_TIMING_H

Generated at Thu Jul 18 2013 12:18:03 for Gaudi Framework, version v23r9 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004