| 1 |
/* |
| 2 |
Copyright (c) 2005-2021 Intel Corporation |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
you may not use this file except in compliance with the License. |
| 6 |
You may obtain a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
See the License for the specific language governing permissions and |
| 14 |
limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
/* |
| 18 |
The original source for this example is |
| 19 |
Copyright (c) 1994-2008 John E. Stone |
| 20 |
All rights reserved. |
| 21 |
|
| 22 |
Redistribution and use in source and binary forms, with or without |
| 23 |
modification, are permitted provided that the following conditions |
| 24 |
are met: |
| 25 |
1. Redistributions of source code must retain the above copyright |
| 26 |
notice, this list of conditions and the following disclaimer. |
| 27 |
2. Redistributions in binary form must reproduce the above copyright |
| 28 |
notice, this list of conditions and the following disclaimer in the |
| 29 |
documentation and/or other materials provided with the distribution. |
| 30 |
3. The name of the author may not be used to endorse or promote products |
| 31 |
derived from this software without specific prior written permission. |
| 32 |
|
| 33 |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 34 |
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 35 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 36 |
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 37 |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 38 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 39 |
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 40 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 41 |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 42 |
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 43 |
SUCH DAMAGE. |
| 44 |
*/ |
| 45 |
|
| 46 |
/* |
| 47 |
* util.h - This file contains defines for the timer functions... |
| 48 |
* |
| 49 |
* $Id: util.h,v 1.3 2007-02-22 17:54:17 Exp $ |
| 50 |
*/ |
| 51 |
|
| 52 |
#include "machine.hpp" |
| 53 |
|
| 54 |
#if defined(_WIN32) |
| 55 |
#include <windows.h> |
| 56 |
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) |
| 57 |
#define WIN8UI_EXAMPLE 1 |
| 58 |
#include <thread> |
| 59 |
typedef ULONGLONG timer; |
| 60 |
#ifdef GetTickCount |
| 61 |
#undef GetTickCount |
| 62 |
#endif |
| 63 |
#define GetTickCount GetTickCount64 |
| 64 |
#else |
| 65 |
typedef DWORD timer; |
| 66 |
#endif |
| 67 |
#else |
| 68 |
#include <sys/time.h> |
| 69 |
#include <unistd.h> |
| 70 |
#if defined(STDTIME) |
| 71 |
typedef timeval timer; |
| 72 |
#elif defined(OLDUNIXTIME) |
| 73 |
typedef time_t timer; |
| 74 |
#endif /* OLDUNIXTIME */ /* STDTIME */ |
| 75 |
#endif /* _WIN32 */ |
| 76 |
|
| 77 |
timer gettimer(void); |
| 78 |
flt timertime(timer st, timer fn); |
| 79 |
void rt_sleep(int); |
| 80 |
int rt_meminuse(void); |
| 81 |
void *rt_getmem(unsigned int); |
| 82 |
unsigned int rt_freemem(void *); |
| 83 |
void rtbomb(const char *); |
| 84 |
void rtmesg(const char *); |