This file is indexed.

/usr/include/viennacl/tools/timer.hpp is in libviennacl-dev 1.7.1+dfsg1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef _VIENNACL_TOOLS_TIMER_HPP_
#define _VIENNACL_TOOLS_TIMER_HPP_

/* =========================================================================
   Copyright (c) 2010-2016, Institute for Microelectronics,
                            Institute for Analysis and Scientific Computing,
                            TU Wien.
   Portions of this software are copyright by UChicago Argonne, LLC.

                            -----------------
                  ViennaCL - The Vienna Computing Library
                            -----------------

   Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at

   (A list of authors and contributors can be found in the manual)

   License:         MIT (X11), see file LICENSE in the base directory
============================================================================= */


/** @file   viennacl/tools/timer.hpp
    @brief  A simple, yet (mostly) sufficiently accurate timer for benchmarking and profiling. */

#include <iostream>


#ifdef _WIN32

#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#undef min
#undef max

namespace viennacl
{
namespace tools
{

/** @brief Simple timer class based on gettimeofday (POSIX) or QueryPerformanceCounter (Windows).
  *
  * Avoids messing with Boost and should be sufficient for benchmarking purposes.
  */
class timer
{
public:

  timer()
  {
    QueryPerformanceFrequency(&freq);
  }

  void start()
  {
    QueryPerformanceCounter((LARGE_INTEGER*) &start_time);
  }

  double get() const
  {
    LARGE_INTEGER  elapsed;
    QueryPerformanceCounter((LARGE_INTEGER*) &end_time);
    elapsed.QuadPart = end_time.QuadPart - start_time.QuadPart;
    return elapsed.QuadPart / static_cast<double>(freq.QuadPart);
  }


private:
  LARGE_INTEGER freq;
  LARGE_INTEGER start_time;
  LARGE_INTEGER end_time;
};

}

}

#else

#include <sys/time.h>

namespace viennacl
{
namespace tools
{

/** @brief Simple timer class based on gettimeofday (POSIX) or QueryPerformanceCounter (Windows).
  *
  * Avoids messing with Boost and should be sufficient for benchmarking purposes.
  */
class timer
{
public:

  timer() : ts(0)
  {}

  void start()
  {
    struct timeval tval;
    gettimeofday(&tval, NULL);
    ts = static_cast<double>(tval.tv_sec * 1000000 + tval.tv_usec);
  }

  double get() const
  {
    struct timeval tval;
    gettimeofday(&tval, NULL);
    double end_time = static_cast<double>(tval.tv_sec * 1000000 + tval.tv_usec);

    return static_cast<double>(end_time-ts) / 1000000.0;
  }

private:
  double ts;
};

}
}



#endif
#endif