summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrien Nader <adrien@notk.org>2015-02-11 12:09:59 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-11 16:38:15 +0100
commit9d1504dba11ed3d7c7f6c82fb1d1b5a7acbe4474 (patch)
treea63248b0486262244a6c69fec36e5028613b38a6 /src
parent2cb0c1cadc46e1d89fea4e27399b36ce9f1526ff (diff)
eina: remove Eina_Counter and use provided Windows posix compatible implementation.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_counter.c49
-rw-r--r--src/lib/eina/eina_inline_private.h27
-rw-r--r--src/lib/eina/eina_main.c3
3 files changed, 0 insertions, 79 deletions
diff --git a/src/lib/eina/eina_counter.c b/src/lib/eina/eina_counter.c
index 084788eddb..533d2154c8 100644
--- a/src/lib/eina/eina_counter.c
+++ b/src/lib/eina/eina_counter.c
@@ -68,9 +68,6 @@ struct _Eina_Clock
68 Eina_Bool valid; 68 Eina_Bool valid;
69}; 69};
70 70
71#ifdef _WIN32
72LARGE_INTEGER _eina_counter_frequency;
73#endif
74 71
75static char * 72static char *
76_eina_counter_asiprintf(char *base, int *position, const char *format, ...) 73_eina_counter_asiprintf(char *base, int *position, const char *format, ...)
@@ -117,52 +114,6 @@ _eina_counter_asiprintf(char *base, int *position, const char *format, ...)
117 */ 114 */
118 115
119/*============================================================================* 116/*============================================================================*
120 * Global *
121 *============================================================================*/
122
123/**
124 * @internal
125 * @brief Initialize the eina counter internal structure.
126 *
127 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
128 *
129 * This function shuts down the counter module set up by
130 * eina_counter_init(). It is called by eina_init().
131 *
132 * This function sets up the error module of Eina and only on Windows,
133 * it initializes the high precision timer. It is also called
134 * by eina_init(). It returns 0 on failure, otherwise it returns the
135 * number of times it has already been called.
136 *
137 * @see eina_init()
138 */
139Eina_Bool
140eina_counter_init(void)
141{
142#ifdef _WIN32
143 if (!QueryPerformanceFrequency(&_eina_counter_frequency)) return EINA_FALSE;
144#endif /* _WIN2 */
145 return EINA_TRUE;
146}
147
148/**
149 * @internal
150 * @brief Shut down the counter module.
151 *
152 * @return #EINA_TRUE on success, #EINA_FALSE on failure.
153 *
154 * This function shuts down the counter module set up by
155 * eina_counter_init(). It is called by eina_shutdown().
156 *
157 * @see eina_shutdown()
158 */
159Eina_Bool
160eina_counter_shutdown(void)
161{
162 return EINA_TRUE;
163}
164
165/*============================================================================*
166 * API * 117 * API *
167 *============================================================================*/ 118 *============================================================================*/
168 119
diff --git a/src/lib/eina/eina_inline_private.h b/src/lib/eina/eina_inline_private.h
index 752baa0d6f..846081dd88 100644
--- a/src/lib/eina/eina_inline_private.h
+++ b/src/lib/eina/eina_inline_private.h
@@ -19,27 +19,14 @@
19#ifndef EINA_INLINE_PRIVATE_H_ 19#ifndef EINA_INLINE_PRIVATE_H_
20# define EINA_INLINE_PRIVATE_H_ 20# define EINA_INLINE_PRIVATE_H_
21 21
22#ifndef _WIN32
23# include <time.h> 22# include <time.h>
24# include <sys/time.h> 23# include <sys/time.h>
25#else
26# define WIN32_LEAN_AND_MEAN
27# include <windows.h>
28# undef WIN32_LEAN_AND_MEAN
29#endif /* _WIN2 */
30 24
31#ifndef _WIN32
32typedef struct timespec Eina_Nano_Time; 25typedef struct timespec Eina_Nano_Time;
33#else
34typedef LARGE_INTEGER Eina_Nano_Time;
35
36extern LARGE_INTEGER _eina_counter_frequency;
37#endif
38 26
39static inline int 27static inline int
40_eina_time_get(Eina_Nano_Time *tp) 28_eina_time_get(Eina_Nano_Time *tp)
41{ 29{
42#ifndef _WIN32
43# if defined(CLOCK_PROCESS_CPUTIME_ID) 30# if defined(CLOCK_PROCESS_CPUTIME_ID)
44 if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, tp)) 31 if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, tp))
45 return 0; 32 return 0;
@@ -64,9 +51,6 @@ _eina_time_get(Eina_Nano_Time *tp)
64 tp->tv_nsec = tv.tv_usec * 1000L; 51 tp->tv_nsec = tv.tv_usec * 1000L;
65 52
66 return 0; 53 return 0;
67#else
68 return QueryPerformanceCounter(tp);
69#endif /* _WIN2 */
70} 54}
71 55
72static inline long int 56static inline long int
@@ -74,12 +58,7 @@ _eina_time_convert(Eina_Nano_Time *tp)
74{ 58{
75 long int r; 59 long int r;
76 60
77#ifndef _WIN32
78 r = tp->tv_sec * 1000000000 + tp->tv_nsec; 61 r = tp->tv_sec * 1000000000 + tp->tv_nsec;
79#else
80 r = (long int)(((long long int)tp->QuadPart * 1000000000ll) /
81 (long long int)_eina_counter_frequency.QuadPart);
82#endif
83 62
84 return r; 63 return r;
85} 64}
@@ -89,14 +68,8 @@ _eina_time_delta(Eina_Nano_Time *start, Eina_Nano_Time *end)
89{ 68{
90 long int r; 69 long int r;
91 70
92#ifndef _WIN32
93 r = (end->tv_sec - start->tv_sec) * 1000000000 + 71 r = (end->tv_sec - start->tv_sec) * 1000000000 +
94 end->tv_nsec - start->tv_nsec; 72 end->tv_nsec - start->tv_nsec;
95#else
96 r = (long int)(((long long int)(end->QuadPart - start->QuadPart)
97 * 1000000000LL)
98 / (long long int)_eina_counter_frequency.QuadPart);
99#endif
100 73
101 return r; 74 return r;
102} 75}
diff --git a/src/lib/eina/eina_main.c b/src/lib/eina/eina_main.c
index 7a9ec9fb74..aa39d27d03 100644
--- a/src/lib/eina/eina_main.c
+++ b/src/lib/eina/eina_main.c
@@ -60,7 +60,6 @@
60#include "eina_list.h" 60#include "eina_list.h"
61#include "eina_matrixsparse.h" 61#include "eina_matrixsparse.h"
62#include "eina_array.h" 62#include "eina_array.h"
63#include "eina_counter.h"
64#include "eina_benchmark.h" 63#include "eina_benchmark.h"
65#include "eina_magic.h" 64#include "eina_magic.h"
66#include "eina_rectangle.h" 65#include "eina_rectangle.h"
@@ -138,7 +137,6 @@ EAPI Eina_Inlist *_eina_tracking = NULL;
138 S(ustringshare); 137 S(ustringshare);
139 S(matrixsparse); 138 S(matrixsparse);
140 S(convert); 139 S(convert);
141 S(counter);
142 S(benchmark); 140 S(benchmark);
143 S(rectangle); 141 S(rectangle);
144 S(strbuf); 142 S(strbuf);
@@ -183,7 +181,6 @@ static const struct eina_desc_setup _eina_desc_setup[] = {
183 S(ustringshare), 181 S(ustringshare),
184 S(matrixsparse), 182 S(matrixsparse),
185 S(convert), 183 S(convert),
186 S(counter),
187 S(benchmark), 184 S(benchmark),
188 S(rectangle), 185 S(rectangle),
189 S(strbuf), 186 S(strbuf),