eina: remove Eina_Counter and use provided Windows posix compatible implementation.
authorAdrien Nader <adrien@notk.org>
Wed, 11 Feb 2015 11:09:59 +0000 (12:09 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Wed, 11 Feb 2015 15:38:15 +0000 (16:38 +0100)
src/lib/eina/eina_counter.c
src/lib/eina/eina_inline_private.h
src/lib/eina/eina_main.c

index 084788e..533d215 100644 (file)
@@ -68,9 +68,6 @@ struct _Eina_Clock
    Eina_Bool valid;
 };
 
-#ifdef _WIN32
-LARGE_INTEGER _eina_counter_frequency;
-#endif
 
 static char *
 _eina_counter_asiprintf(char *base, int *position, const char *format, ...)
@@ -117,52 +114,6 @@ _eina_counter_asiprintf(char *base, int *position, const char *format, ...)
  */
 
 /*============================================================================*
- *                                 Global                                     *
- *============================================================================*/
-
-/**
- * @internal
- * @brief Initialize the eina counter internal structure.
- *
- * @return #EINA_TRUE on success, #EINA_FALSE on failure.
- *
- * This function shuts down the counter module set up by
- * eina_counter_init(). It is called by eina_init().
- *
- * This function sets up the error module of Eina and only on Windows,
- * it initializes the high precision timer. It is also called
- * by eina_init(). It returns 0 on failure, otherwise it returns the
- * number of times it has already been called.
- *
- * @see eina_init()
- */
-Eina_Bool
-eina_counter_init(void)
-{
-#ifdef _WIN32
-   if (!QueryPerformanceFrequency(&_eina_counter_frequency)) return EINA_FALSE;
-#endif /* _WIN2 */
-   return EINA_TRUE;
-}
-
-/**
- * @internal
- * @brief Shut down the counter module.
- *
- * @return #EINA_TRUE on success, #EINA_FALSE on failure.
- *
- * This function shuts down the counter module set up by
- * eina_counter_init(). It is called by eina_shutdown().
- *
- * @see eina_shutdown()
- */
-Eina_Bool
-eina_counter_shutdown(void)
-{
-   return EINA_TRUE;
-}
-
-/*============================================================================*
  *                                   API                                      *
  *============================================================================*/
 
index 752baa0..846081d 100644 (file)
 #ifndef EINA_INLINE_PRIVATE_H_
 # define EINA_INLINE_PRIVATE_H_
 
-#ifndef _WIN32
 # include <time.h>
 # include <sys/time.h>
-#else
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#endif /* _WIN2 */
 
-#ifndef _WIN32
 typedef struct timespec Eina_Nano_Time;
-#else
-typedef LARGE_INTEGER Eina_Nano_Time;
-
-extern LARGE_INTEGER _eina_counter_frequency;
-#endif
 
 static inline int
 _eina_time_get(Eina_Nano_Time *tp)
 {
-#ifndef _WIN32
 # if defined(CLOCK_PROCESS_CPUTIME_ID)
    if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, tp))
      return 0;
@@ -64,9 +51,6 @@ _eina_time_get(Eina_Nano_Time *tp)
    tp->tv_nsec = tv.tv_usec * 1000L;
 
    return 0;
-#else
-   return QueryPerformanceCounter(tp);
-#endif /* _WIN2 */
 }
 
 static inline long int
@@ -74,12 +58,7 @@ _eina_time_convert(Eina_Nano_Time *tp)
 {
   long int r;
 
-#ifndef _WIN32
   r = tp->tv_sec * 1000000000 + tp->tv_nsec;
-#else
-  r = (long int)(((long long int)tp->QuadPart * 1000000000ll) /
-                (long long int)_eina_counter_frequency.QuadPart);
-#endif
 
   return r;
 }
@@ -89,14 +68,8 @@ _eina_time_delta(Eina_Nano_Time *start, Eina_Nano_Time *end)
 {
   long int r;
 
-#ifndef _WIN32
   r = (end->tv_sec - start->tv_sec) * 1000000000 +
     end->tv_nsec - start->tv_nsec;
-#else
-  r = (long int)(((long long int)(end->QuadPart - start->QuadPart)
-                 * 1000000000LL)
-                / (long long int)_eina_counter_frequency.QuadPart);
-#endif
 
   return r;
 }
index 7a9ec9f..aa39d27 100644 (file)
@@ -60,7 +60,6 @@
 #include "eina_list.h"
 #include "eina_matrixsparse.h"
 #include "eina_array.h"
-#include "eina_counter.h"
 #include "eina_benchmark.h"
 #include "eina_magic.h"
 #include "eina_rectangle.h"
@@ -138,7 +137,6 @@ EAPI Eina_Inlist *_eina_tracking = NULL;
    S(ustringshare);
    S(matrixsparse);
    S(convert);
-   S(counter);
    S(benchmark);
    S(rectangle);
    S(strbuf);
@@ -183,7 +181,6 @@ static const struct eina_desc_setup _eina_desc_setup[] = {
    S(ustringshare),
    S(matrixsparse),
    S(convert),
-   S(counter),
    S(benchmark),
    S(rectangle),
    S(strbuf),