Move the measure_time.h header to the common library
Showing the changes to codec/decoder (1 of 5 files). Show all
Unified · Split
| @@ -1,89 +0,0 @@ | ||
| 1 | −/*! | |
| 2 | − * \copy | |
| 3 | − * Copyright (c) 2009-2013, Cisco Systems | |
| 4 | − * All rights reserved. | |
| 5 | − * | |
| 6 | − * Redistribution and use in source and binary forms, with or without | |
| 7 | − * modification, are permitted provided that the following conditions | |
| 8 | − * are met: | |
| 9 | − * | |
| 10 | − * * Redistributions of source code must retain the above copyright | |
| 11 | − * notice, this list of conditions and the following disclaimer. | |
| 12 | − * | |
| 13 | − * * Redistributions in binary form must reproduce the above copyright | |
| 14 | − * notice, this list of conditions and the following disclaimer in | |
| 15 | − * the documentation and/or other materials provided with the | |
| 16 | − * distribution. | |
| 17 | − * | |
| 18 | − * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 | − * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 | − * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
| 21 | − * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
| 22 | − * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 23 | − * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 24 | − * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 25 | − * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
| 26 | − * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | − * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| 28 | − * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | − * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | − * | |
| 31 | − * | |
| 32 | − * \file measure_time.h | |
| 33 | − * | |
| 34 | − * \brief time cost measure utilization | |
| 35 | − * | |
| 36 | − * \date 04/28/2009 Created | |
| 37 | − * | |
| 38 | − ************************************************************************************* | |
| 39 | − */ | |
| 40 | −#ifndef WELS_TIME_COST_MEASURE_UTIL_H__ | |
| 41 | −#define WELS_TIME_COST_MEASURE_UTIL_H__ | |
| 42 | − | |
| 43 | −#include <stdlib.h> | |
| 44 | − | |
| 45 | −#ifndef _WIN32 | |
| 46 | −#include <sys/time.h> | |
| 47 | −#else | |
| 48 | −#include "typedefs.h" | |
| 49 | −#include <windows.h> | |
| 50 | −#include <sys/timeb.h> | |
| 51 | −#endif | |
| 52 | −#include <time.h> | |
| 53 | − | |
| 54 | −#ifdef __cplusplus | |
| 55 | −extern "C" { | |
| 56 | −#endif//__cplusplus | |
| 57 | − | |
| 58 | −/*! | |
| 59 | − * \brief time cost measure utilization | |
| 60 | − * \param void_t | |
| 61 | − * \return time elapsed since run (unit: microsecond) | |
| 62 | − */ | |
| 63 | − | |
| 64 | −int64_t WelsTime (void_t) { | |
| 65 | −#ifndef _WIN32 | |
| 66 | − struct timeval tv_date; | |
| 67 | − | |
| 68 | − gettimeofday (&tv_date, NULL); | |
| 69 | − return ((int64_t) tv_date.tv_sec * 1000000 + (int64_t) tv_date.tv_usec); | |
| 70 | −#else | |
| 71 | − static int64_t iMtimeFreq = 0; | |
| 72 | − int64_t iMtimeCur = 0; | |
| 73 | − int64_t iResult = 0; | |
| 74 | − if (!iMtimeFreq) { | |
| 75 | − QueryPerformanceFrequency ((LARGE_INTEGER*)&iMtimeFreq); | |
| 76 | − if (!iMtimeFreq) | |
| 77 | − iMtimeFreq = 1; | |
| 78 | − } | |
| 79 | − QueryPerformanceCounter ((LARGE_INTEGER*)&iMtimeCur); | |
| 80 | − iResult = (int64_t) ((double)iMtimeCur * 1e6 / (double)iMtimeFreq + 0.5); | |
| 81 | − return iResult; | |
| 82 | −#endif//WIN32 | |
| 83 | −} | |
| 84 | − | |
| 85 | −#ifdef __cplusplus | |
| 86 | −} | |
| 87 | −#endif | |
| 88 | − | |
| 89 | −#endif//WELS_TIME_COST_MEASURE_UTIL_H__ | |