/usr/include/dlib/time_this.h is in libdlib-dev 18.18-1.
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 | // Copyright (C) 2003  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_TIME_THIs_
#define DLIB_TIME_THIs_
#include "platform.h"
#ifndef WIN32
#include <sys/times.h>
#include <limits.h>
#include <unistd.h>
#include <iostream>
// ----------------------------------------------------------------------------------------
#define TIME_THIS_TO(_tt_op,_tt_out)                                                        \
    {                                                                                       \
        clock_t _tt_start, _tt_end;                                                         \
        tms _tt_timesbuf;                                                                   \
        _tt_start = times(&_tt_timesbuf);                                                   \
        _tt_op;                                                                             \
        _tt_end = times(&_tt_timesbuf);                                                     \
        long _tt_ticks = sysconf(_SC_CLK_TCK);                                              \
        if ((double)(_tt_end-_tt_start)/(double)_tt_ticks < 1)                              \
        {                                                                                   \
            _tt_out << "\ntime: "                                                           \
            << (int)(1000*((double)(_tt_end-_tt_start)/(double)_tt_ticks)) << "ms\n";       \
        }                                                                                   \
        else                                                                                \
        {                                                                                   \
            _tt_out << "\ntime: "                                                           \
                      << (double)(_tt_end-_tt_start)/(double)_tt_ticks << "sec\n";          \
        }                                                                                   \
    }                                                                                       \
#define TIME_THIS(_tt_op)  TIME_THIS_TO(_tt_op,std::cout)
// ----------------------------------------------------------------------------------------
#endif
#ifdef WIN32
#include "windows_magic.h"
#include <windows.h>    // for GetTickCount()
#include <iostream>
// ----------------------------------------------------------------------------------------
#define TIME_THIS_TO(_tt_op,_tt_out)                                                        \
    {                                                                                       \
        unsigned long _tt_count = GetTickCount();                                           \
        _tt_op;                                                                             \
        _tt_count = GetTickCount() - _tt_count;                                             \
        if (_tt_count < 1000)                                                               \
        {                                                                                   \
            _tt_out << "\ntime: " << _tt_count << "ms\n";                                   \
        }                                                                                   \
        else                                                                                \
        {                                                                                   \
            _tt_out << "\ntime: " << static_cast<double>(_tt_count)/1000 << "sec\n";        \
        }                                                                                   \
    }                                                                                       \
#define TIME_THIS(_tt_op) TIME_THIS_TO(_tt_op,std::cout)
// ----------------------------------------------------------------------------------------
#endif
#endif // DLIB_TIME_THIs_
 |