Server IP : 103.119.228.120 / Your IP : 3.149.23.123 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/include/pgsql/server/portability/ |
Upload File : |
/*------------------------------------------------------------------------- * * instr_time.h * portable high-precision interval timing * * This file provides an abstraction layer to hide portability issues in * interval timing. On Unix we use gettimeofday(), but on Windows that * gives a low-precision result so we must use QueryPerformanceCounter() * instead. These macros also give some breathing room to use other * high-precision-timing APIs on yet other platforms. * * The basic data type is instr_time, which all callers should treat as an * opaque typedef. instr_time can store either an absolute time (of * unspecified reference time) or an interval. The operations provided * for it are: * * INSTR_TIME_IS_ZERO(t) is t equal to zero? * * INSTR_TIME_SET_ZERO(t) set t to zero (memset is acceptable too) * * INSTR_TIME_SET_CURRENT(t) set t to current time * * INSTR_TIME_ADD(x, y) x += y * * INSTR_TIME_SUBTRACT(x, y) x -= y * * INSTR_TIME_ACCUM_DIFF(x, y, z) x += (y - z) * * INSTR_TIME_GET_DOUBLE(t) convert t to double (in seconds) * * INSTR_TIME_GET_MILLISEC(t) convert t to double (in milliseconds) * * INSTR_TIME_GET_MICROSEC(t) convert t to uint64 (in microseconds) * * Note that INSTR_TIME_SUBTRACT and INSTR_TIME_ACCUM_DIFF convert * absolute times to intervals. The INSTR_TIME_GET_xxx operations are * only useful on intervals. * * When summing multiple measurements, it's recommended to leave the * running sum in instr_time form (ie, use INSTR_TIME_ADD or * INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end. * * Beware of multiple evaluations of the macro arguments. * * * Copyright (c) 2001-2012, PostgreSQL Global Development Group * * src/include/portability/instr_time.h * *------------------------------------------------------------------------- */ #ifndef INSTR_TIME_H #define INSTR_TIME_H #ifndef WIN32 #include <sys/time.h> typedef struct timeval instr_time; #define INSTR_TIME_IS_ZERO(t) ((t).tv_usec == 0 && (t).tv_sec == 0) #define INSTR_TIME_SET_ZERO(t) ((t).tv_sec = 0, (t).tv_usec = 0) #define INSTR_TIME_SET_CURRENT(t) gettimeofday(&(t), NULL) #define INSTR_TIME_ADD(x,y) \ do { \ (x).tv_sec += (y).tv_sec; \ (x).tv_usec += (y).tv_usec; \ /* Normalize */ \ while ((x).tv_usec >= 1000000) \ { \ (x).tv_usec -= 1000000; \ (x).tv_sec++; \ } \ } while (0) #define INSTR_TIME_SUBTRACT(x,y) \ do { \ (x).tv_sec -= (y).tv_sec; \ (x).tv_usec -= (y).tv_usec; \ /* Normalize */ \ while ((x).tv_usec < 0) \ { \ (x).tv_usec += 1000000; \ (x).tv_sec--; \ } \ } while (0) #define INSTR_TIME_ACCUM_DIFF(x,y,z) \ do { \ (x).tv_sec += (y).tv_sec - (z).tv_sec; \ (x).tv_usec += (y).tv_usec - (z).tv_usec; \ /* Normalize after each add to avoid overflow/underflow of tv_usec */ \ while ((x).tv_usec < 0) \ { \ (x).tv_usec += 1000000; \ (x).tv_sec--; \ } \ while ((x).tv_usec >= 1000000) \ { \ (x).tv_usec -= 1000000; \ (x).tv_sec++; \ } \ } while (0) #define INSTR_TIME_GET_DOUBLE(t) \ (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0) #define INSTR_TIME_GET_MILLISEC(t) \ (((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0) #define INSTR_TIME_GET_MICROSEC(t) \ (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec) #else /* WIN32 */ typedef LARGE_INTEGER instr_time; #define INSTR_TIME_IS_ZERO(t) ((t).QuadPart == 0) #define INSTR_TIME_SET_ZERO(t) ((t).QuadPart = 0) #define INSTR_TIME_SET_CURRENT(t) QueryPerformanceCounter(&(t)) #define INSTR_TIME_ADD(x,y) \ ((x).QuadPart += (y).QuadPart) #define INSTR_TIME_SUBTRACT(x,y) \ ((x).QuadPart -= (y).QuadPart) #define INSTR_TIME_ACCUM_DIFF(x,y,z) \ ((x).QuadPart += (y).QuadPart - (z).QuadPart) #define INSTR_TIME_GET_DOUBLE(t) \ (((double) (t).QuadPart) / GetTimerFrequency()) #define INSTR_TIME_GET_MILLISEC(t) \ (((double) (t).QuadPart * 1000.0) / GetTimerFrequency()) #define INSTR_TIME_GET_MICROSEC(t) \ ((uint64) (((double) (t).QuadPart * 1000000.0) / GetTimerFrequency())) static inline double GetTimerFrequency(void) { LARGE_INTEGER f; QueryPerformanceFrequency(&f); return (double) f.QuadPart; } #endif /* WIN32 */ #endif /* INSTR_TIME_H */