~ubuntu-branches/ubuntu/raring/clucene-core/raring-proposed

« back to all changes in this revision

Viewing changes to src/contribs/benchmarker/Timer.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-08-11 09:33:38 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120811093338-fgrx41ftqew3qt6a
Tags: 2.3.3.4-1
* New upstream release (Closes: #661703).
* Convert package to multiarch.
* Drop obsolete patches:
  - 01_add_missing_include_bug505667.diff
  - 02_posixness_fix_bug530308.diff
* Add patches:
  - Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
  - Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
  - Install-contribs-lib.patch
  - multiarch.patch
* Update debian/compat: bump to 8.
* Update debian/control:
  - update build dependencies (add cmake, libboost-dev and libz-dev).
  - bump Standards-Version to 3.9.3.
  - rename packages due to ABI bump: libclucene0ldbl -> libclucene-core1.
  - add libclucene-contribs1 package.
* Update debian/rules:
  - rewrite to use CMake.
  - add multiarch support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*------------------------------------------------------------------------------
 
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
 
3
*
 
4
* Distributable under the terms of either the Apache License (Version 2.0) or
 
5
* the GNU Lesser General Public License, as specified in the COPYING file.
 
6
------------------------------------------------------------------------------*/
 
7
#pragma once
 
8
 
 
9
class Timer{
 
10
public:
 
11
        int64_t startTime;
 
12
        int64_t stopTime;
 
13
        bool running;
 
14
        Timer(){
 
15
                running=false;
 
16
                reset();
 
17
        }
 
18
        void reset(){
 
19
                startTime=0;
 
20
                stopTime=0;
 
21
                running=false;
 
22
        }
 
23
        void start(){
 
24
                startTime = lucene::util::Misc::currentTimeMillis();
 
25
                running=true;
 
26
        }
 
27
        int32_t split(){
 
28
                return lucene::util::Misc::currentTimeMillis()-startTime;
 
29
        }
 
30
        int32_t stop(){
 
31
                if ( running ){
 
32
                        running=false;
 
33
                        stopTime = lucene::util::Misc::currentTimeMillis();
 
34
                }
 
35
                return stopTime-startTime;
 
36
        }
 
37
        int32_t interval(){
 
38
                if (running)
 
39
                        return lucene::util::Misc::currentTimeMillis()-startTime;
 
40
                else
 
41
                        return stopTime-startTime;
 
42
        }
 
43
 
 
44
};
 
45
 
 
46
 
 
47
typedef int (*PTEST_ROUTINE)(Timer*);
 
48
typedef PTEST_ROUTINE LPTEST_ROUTINE;