/src/libvpx/vpx_ports/vpx_timer.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 | | * |
4 | | * Use of this source code is governed by a BSD-style license |
5 | | * that can be found in the LICENSE file in the root of the source |
6 | | * tree. An additional intellectual property rights grant can be found |
7 | | * in the file PATENTS. All contributing project authors may |
8 | | * be found in the AUTHORS file in the root of the source tree. |
9 | | */ |
10 | | |
11 | | #ifndef VPX_VPX_PORTS_VPX_TIMER_H_ |
12 | | #define VPX_VPX_PORTS_VPX_TIMER_H_ |
13 | | |
14 | | #include "./vpx_config.h" |
15 | | |
16 | | #include "vpx/vpx_integer.h" |
17 | | |
18 | | #if CONFIG_OS_SUPPORT |
19 | | |
20 | | #if defined(_WIN32) |
21 | | /* |
22 | | * Win32 specific includes |
23 | | */ |
24 | | #undef NOMINMAX |
25 | | #define NOMINMAX |
26 | | #ifndef WIN32_LEAN_AND_MEAN |
27 | | #define WIN32_LEAN_AND_MEAN |
28 | | #endif |
29 | | #include <windows.h> |
30 | | #else |
31 | | /* |
32 | | * POSIX specific includes |
33 | | */ |
34 | | #include <sys/time.h> |
35 | | |
36 | | /* timersub is not provided by msys at this time. */ |
37 | | #ifndef timersub |
38 | | #define timersub(a, b, result) \ |
39 | | do { \ |
40 | | (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ |
41 | | (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ |
42 | | if ((result)->tv_usec < 0) { \ |
43 | | --(result)->tv_sec; \ |
44 | | (result)->tv_usec += 1000000; \ |
45 | | } \ |
46 | | } while (0) |
47 | | #endif |
48 | | #endif |
49 | | |
50 | | struct vpx_usec_timer { |
51 | | #if defined(_WIN32) |
52 | | LARGE_INTEGER begin, end; |
53 | | #else |
54 | | struct timeval begin, end; |
55 | | #endif |
56 | | }; |
57 | | |
58 | 664k | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) { |
59 | | #if defined(_WIN32) |
60 | | QueryPerformanceCounter(&t->begin); |
61 | | #else |
62 | 664k | gettimeofday(&t->begin, NULL); |
63 | 664k | #endif |
64 | 664k | } onyx_if.c:vpx_usec_timer_start Line | Count | Source | 58 | 350k | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) { | 59 | | #if defined(_WIN32) | 60 | | QueryPerformanceCounter(&t->begin); | 61 | | #else | 62 | 350k | gettimeofday(&t->begin, NULL); | 63 | 350k | #endif | 64 | 350k | } |
Unexecuted instantiation: temporal_filter.c:vpx_usec_timer_start vp9_encoder.c:vpx_usec_timer_start Line | Count | Source | 58 | 183k | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) { | 59 | | #if defined(_WIN32) | 60 | | QueryPerformanceCounter(&t->begin); | 61 | | #else | 62 | 183k | gettimeofday(&t->begin, NULL); | 63 | 183k | #endif | 64 | 183k | } |
Unexecuted instantiation: vp9_temporal_filter.c:vpx_usec_timer_start encodeframe.c:vpx_usec_timer_start Line | Count | Source | 58 | 88.0k | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) { | 59 | | #if defined(_WIN32) | 60 | | QueryPerformanceCounter(&t->begin); | 61 | | #else | 62 | 88.0k | gettimeofday(&t->begin, NULL); | 63 | 88.0k | #endif | 64 | 88.0k | } |
vp9_encodeframe.c:vpx_usec_timer_start Line | Count | Source | 58 | 42.2k | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) { | 59 | | #if defined(_WIN32) | 60 | | QueryPerformanceCounter(&t->begin); | 61 | | #else | 62 | 42.2k | gettimeofday(&t->begin, NULL); | 63 | 42.2k | #endif | 64 | 42.2k | } |
|
65 | | |
66 | 525k | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) { |
67 | | #if defined(_WIN32) |
68 | | QueryPerformanceCounter(&t->end); |
69 | | #else |
70 | 525k | gettimeofday(&t->end, NULL); |
71 | 525k | #endif |
72 | 525k | } onyx_if.c:vpx_usec_timer_mark Line | Count | Source | 66 | 275k | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) { | 67 | | #if defined(_WIN32) | 68 | | QueryPerformanceCounter(&t->end); | 69 | | #else | 70 | 275k | gettimeofday(&t->end, NULL); | 71 | 275k | #endif | 72 | 275k | } |
Unexecuted instantiation: temporal_filter.c:vpx_usec_timer_mark vp9_encoder.c:vpx_usec_timer_mark Line | Count | Source | 66 | 120k | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) { | 67 | | #if defined(_WIN32) | 68 | | QueryPerformanceCounter(&t->end); | 69 | | #else | 70 | 120k | gettimeofday(&t->end, NULL); | 71 | 120k | #endif | 72 | 120k | } |
Unexecuted instantiation: vp9_temporal_filter.c:vpx_usec_timer_mark encodeframe.c:vpx_usec_timer_mark Line | Count | Source | 66 | 88.0k | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) { | 67 | | #if defined(_WIN32) | 68 | | QueryPerformanceCounter(&t->end); | 69 | | #else | 70 | 88.0k | gettimeofday(&t->end, NULL); | 71 | 88.0k | #endif | 72 | 88.0k | } |
vp9_encodeframe.c:vpx_usec_timer_mark Line | Count | Source | 66 | 42.2k | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) { | 67 | | #if defined(_WIN32) | 68 | | QueryPerformanceCounter(&t->end); | 69 | | #else | 70 | 42.2k | gettimeofday(&t->end, NULL); | 71 | 42.2k | #endif | 72 | 42.2k | } |
|
73 | | |
74 | 493k | static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { |
75 | | #if defined(_WIN32) |
76 | | LARGE_INTEGER freq, diff; |
77 | | |
78 | | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; |
79 | | |
80 | | QueryPerformanceFrequency(&freq); |
81 | | return diff.QuadPart * 1000000 / freq.QuadPart; |
82 | | #else |
83 | 493k | struct timeval diff; |
84 | | |
85 | 493k | timersub(&t->end, &t->begin, &diff); |
86 | 493k | return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; |
87 | 493k | #endif |
88 | 493k | } onyx_if.c:vpx_usec_timer_elapsed Line | Count | Source | 74 | 242k | static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { | 75 | | #if defined(_WIN32) | 76 | | LARGE_INTEGER freq, diff; | 77 | | | 78 | | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; | 79 | | | 80 | | QueryPerformanceFrequency(&freq); | 81 | | return diff.QuadPart * 1000000 / freq.QuadPart; | 82 | | #else | 83 | 242k | struct timeval diff; | 84 | | | 85 | 242k | timersub(&t->end, &t->begin, &diff); | 86 | 242k | return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; | 87 | 242k | #endif | 88 | 242k | } |
Unexecuted instantiation: temporal_filter.c:vpx_usec_timer_elapsed vp9_encoder.c:vpx_usec_timer_elapsed Line | Count | Source | 74 | 120k | static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { | 75 | | #if defined(_WIN32) | 76 | | LARGE_INTEGER freq, diff; | 77 | | | 78 | | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; | 79 | | | 80 | | QueryPerformanceFrequency(&freq); | 81 | | return diff.QuadPart * 1000000 / freq.QuadPart; | 82 | | #else | 83 | 120k | struct timeval diff; | 84 | | | 85 | 120k | timersub(&t->end, &t->begin, &diff); | 86 | 120k | return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; | 87 | 120k | #endif | 88 | 120k | } |
Unexecuted instantiation: vp9_temporal_filter.c:vpx_usec_timer_elapsed encodeframe.c:vpx_usec_timer_elapsed Line | Count | Source | 74 | 88.0k | static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { | 75 | | #if defined(_WIN32) | 76 | | LARGE_INTEGER freq, diff; | 77 | | | 78 | | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; | 79 | | | 80 | | QueryPerformanceFrequency(&freq); | 81 | | return diff.QuadPart * 1000000 / freq.QuadPart; | 82 | | #else | 83 | 88.0k | struct timeval diff; | 84 | | | 85 | 88.0k | timersub(&t->end, &t->begin, &diff); | 86 | 88.0k | return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; | 87 | 88.0k | #endif | 88 | 88.0k | } |
vp9_encodeframe.c:vpx_usec_timer_elapsed Line | Count | Source | 74 | 42.2k | static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { | 75 | | #if defined(_WIN32) | 76 | | LARGE_INTEGER freq, diff; | 77 | | | 78 | | diff.QuadPart = t->end.QuadPart - t->begin.QuadPart; | 79 | | | 80 | | QueryPerformanceFrequency(&freq); | 81 | | return diff.QuadPart * 1000000 / freq.QuadPart; | 82 | | #else | 83 | 42.2k | struct timeval diff; | 84 | | | 85 | 42.2k | timersub(&t->end, &t->begin, &diff); | 86 | 42.2k | return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec; | 87 | 42.2k | #endif | 88 | 42.2k | } |
|
89 | | |
90 | | #else /* CONFIG_OS_SUPPORT = 0*/ |
91 | | |
92 | | /* Empty timer functions if CONFIG_OS_SUPPORT = 0 */ |
93 | | #ifndef timersub |
94 | | #define timersub(a, b, result) |
95 | | #endif |
96 | | |
97 | | struct vpx_usec_timer { |
98 | | void *dummy; |
99 | | }; |
100 | | |
101 | | static INLINE void vpx_usec_timer_start(struct vpx_usec_timer *t) {} |
102 | | |
103 | | static INLINE void vpx_usec_timer_mark(struct vpx_usec_timer *t) {} |
104 | | |
105 | | static INLINE int vpx_usec_timer_elapsed(struct vpx_usec_timer *t) { return 0; } |
106 | | |
107 | | #endif /* CONFIG_OS_SUPPORT */ |
108 | | |
109 | | #endif // VPX_VPX_PORTS_VPX_TIMER_H_ |