1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

New ACC version.

committer: mfx <mfx> 1088531787 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2004-06-29 17:56:27 +00:00
parent 041865c320
commit 74d70fe1d9
7 changed files with 84 additions and 7 deletions

View File

@ -27,7 +27,7 @@
#ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED 1
#define ACC_VERSION 20040511L
#define ACC_VERSION 20040623L
#if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file

View File

@ -205,6 +205,18 @@
# undef HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_TYPES_H
#elif (ACC_OS_WIN32 && ACC_CC_PELLESC)
# undef HAVE_DIRENT_H
# undef HAVE_DOS_H
# undef HAVE_MALLOC_H
# undef HAVE_SHARE_H
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
# if (__POCC__ < 280)
# else
# define HAVE_SYS_UTIME_H 1
# endif
#elif (ACC_OS_WIN32 && ACC_CC_PGI) && defined(__MINGW32__)
# undef HAVE_UTIME_H
# define HAVE_SYS_UTIME_H 1
@ -462,6 +474,11 @@
# undef HAVE_STRFTIME
# undef HAVE_UTIME
# undef HAVE_VSNPRINTF
#elif (ACC_OS_WIN32 && ACC_CC_PELLESC)
# if (__POCC__ < 280)
# define alloca _alloca
# undef HAVE_UTIME
# endif
#elif (ACC_OS_WIN32 && ACC_CC_PGI) && defined(__MINGW32__)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
@ -592,7 +609,7 @@
#elif (ACC_ARCH_IA32 && (ACC_CC_INTELC && defined(__linux__)))
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#elif (ACC_ARCH_IA32 && (ACC_CC_MWERKS || ACC_CC_PGI))
#elif (ACC_ARCH_IA32 && (ACC_CC_MWERKS || ACC_CC_PELLESC || ACC_CC_PGI))
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#elif (ACC_ARCH_IA32 && (ACC_CC_INTELC || ACC_CC_MSC))

View File

@ -25,6 +25,10 @@
# define ACC_CC_INTELC 1
# define ACC_INFO_CC "Intel C"
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__INTEL_COMPILER)
#elif defined(__POCC__)
# define ACC_CC_PELLESC 1
# define ACC_INFO_CC "Pelles C"
# define ACC_INFO_CCVER ACC_CPP_MACRO_EXPAND(__POCC__)
#elif defined(__GNUC__) && defined(__VERSION__)
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)

View File

@ -42,6 +42,8 @@
# define acc_inline __inline
#elif (ACC_CC_PGI)
# define acc_inline __inline__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
# define acc_inline inline
#endif

View File

@ -315,13 +315,12 @@ ACCLIB_EXTERN(acc_uint32l_t, acc_umuldiv32) (acc_uint32l_t, acc_uint32l_t, acc_u
/*************************************************************************
// uclock
// uclock (real, i.e. "wall" clock)
**************************************************************************/
#if defined(acc_int32e_t)
ACCLIB_EXTERN(int, acc_tsc_read) (acc_uint32e_t*);
ACCLIB_EXTERN(int, acc_tsc_read_add) (acc_uint32e_t*);
#define acc_rdtsc(x) acc_tsc_read(x)
#endif
@ -361,6 +360,47 @@ ACCLIB_EXTERN(void, acc_uclock_read) (acc_uclock_handle_p, acc_uclock_p);
ACCLIB_EXTERN(double, acc_uclock_get_elapsed) (acc_uclock_handle_p, const acc_uclock_p, const acc_uclock_p);
/*************************************************************************
// performance counters (virtual clock)
**************************************************************************/
#if defined(acc_int64l_t)
typedef struct { /* all private */
#if (ACC_OS_POSIX_LINUX)
void* h;
unsigned cpu_type, cpu_features, cpu_khz, cpu_nrctrs;
const char* cpu_name;
#else
void* h;
#endif
} acc_perfctr_handle_t;
typedef struct {
acc_uint64l_t tsc;
#if (ACC_OS_POSIX_LINUX)
acc_uint64l_t pmc[18];
#else
acc_uint64l_t pmc[1];
#endif
} acc_perfctr_clock_t;
#ifndef acc_perfctr_handle_p
#define acc_perfctr_handle_p acc_perfctr_handle_t *
#endif
#ifndef acc_perfctr_clock_p
#define acc_perfctr_clock_p acc_perfctr_clock_t *
#endif
ACCLIB_EXTERN(int, acc_perfctr_open) (acc_perfctr_handle_p);
ACCLIB_EXTERN(int, acc_perfctr_close) (acc_perfctr_handle_p);
ACCLIB_EXTERN(void, acc_perfctr_read) (acc_perfctr_handle_p, acc_perfctr_clock_p);
ACCLIB_EXTERN(double, acc_perfctr_get_elapsed) (acc_perfctr_handle_p, const acc_perfctr_clock_p, const acc_perfctr_clock_p);
ACCLIB_EXTERN(double, acc_perfctr_get_elapsed_tsc) (acc_perfctr_handle_p, acc_uint64l_t);
#endif
/*************************************************************************
// Big Endian / Little Endian
**************************************************************************/

View File

@ -34,7 +34,9 @@ ACCLIB_PUBLIC(acclib_handle_t, acc_get_osfhandle) (int fd)
#elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
return -1; /* FIXME */
#elif (ACC_OS_WIN32 || ACC_OS_WIN64)
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
# if (ACC_CC_PELLESC && (__POCC__ < 280))
return -1; /* FIXME */
# elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
return -1; /* FIXME */
# elif (ACC_CC_WATCOMC && (__WATCOMC__ < 1100))
return _os_handle(fd);

View File

@ -43,7 +43,7 @@
# if 1
# include <mmsystem.h>
# else
# if (ACC_CC_INTELC || ACC_CC_MSC)
# if (ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC)
ACC_EXTERN_C __declspec(dllimport) unsigned long __stdcall timeGetTime(void);
# else
ACC_EXTERN_C unsigned long __stdcall timeGetTime(void);
@ -51,7 +51,7 @@
# endif
# if (ACC_CC_DMC)
# pragma DMC includelib "winmm.lib"
# elif (ACC_CC_INTELC || ACC_CC_MSC)
# elif (ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC)
# pragma comment(lib, "winmm.lib")
# elif (ACC_CC_MWERKS && (__MWERKS__ >= 0x3000))
# pragma comment(lib, "winmm.lib")
@ -94,6 +94,8 @@ ACCLIB_PUBLIC(int, acc_uclock_open) (acc_uclock_handle_p h)
h->qpf = 0.0;
}
}
#elif (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
h->qpf = 0.0;
#endif
h->h = 1;
h->mode = 0;
@ -119,6 +121,10 @@ ACCLIB_PUBLIC(int, acc_uclock_close) (acc_uclock_handle_p h)
}
/*************************************************************************
//
**************************************************************************/
ACCLIB_PUBLIC(void, acc_uclock_read) (acc_uclock_handle_p h, acc_uclock_p c)
{
#if (__ACCLIB_UCLOCK_USE_QPC)
@ -131,6 +137,8 @@ ACCLIB_PUBLIC(void, acc_uclock_read) (acc_uclock_handle_p h, acc_uclock_p c)
}
c->qpc = 0; /* failed */
}
#elif (ACC_HAVE_WINDOWS_H) && defined(acc_int64l_t)
/* c->qpc = 0; */
#endif
{
@ -166,6 +174,10 @@ ACCLIB_PUBLIC(void, acc_uclock_read) (acc_uclock_handle_p h, acc_uclock_p c)
}
/*************************************************************************
//
**************************************************************************/
ACCLIB_PUBLIC(double, acc_uclock_get_elapsed) (acc_uclock_handle_p h, const acc_uclock_p start, const acc_uclock_p stop)
{
double d;