Best Python code snippet using pytest-benchmark
pep418.py
Source:pep418.py
...91 GetCurrentProcess.restype = HANDLE92 _GetProcessTimes = windll.kernel32.GetProcessTimes93 _GetProcessTimes.argtypes = (HANDLE, FILETIME_p, FILETIME_p, FILETIME_p, FILETIME_p)94 _GetProcessTimes.restype = BOOL95 def filetime2py(obj):96 return (obj.dwHighDateTime << 32) + obj.dwLowDateTime97 def GetProcessTimes(handle):98 creation_time = FILETIME()99 exit_time = FILETIME()100 kernel_time = FILETIME()101 user_time = FILETIME()102 ok = _GetProcessTimes(handle,103 byref(creation_time), byref(exit_time),104 byref(kernel_time), byref(user_time))105 if not ok:106 raise ctypes_winerror()107 return (filetime2py(creation_time), filetime2py(exit_time),108 filetime2py(kernel_time), filetime2py(user_time))109 _GetSystemTimeAsFileTime = windll.kernel32.GetSystemTimeAsFileTime110 _GetSystemTimeAsFileTime.argtypes = (FILETIME_p,)111 _GetSystemTimeAsFileTime.restype = None112 def GetSystemTimeAsFileTime():113 system_time = FILETIME()114 _GetSystemTimeAsFileTime(byref(system_time))115 return filetime2py(system_time)116 libc_name = ctypes.util.find_library('c')117 if libc_name:118 libc = ctypes.CDLL(libc_name, use_errno=True)119 clock_t = ctypes.c_ulong120 if sys.platform == 'darwin':121 mach_absolute_time = libc.mach_absolute_time122 mach_absolute_time.argtypes = ()123 mach_absolute_time.restype = ctypes.c_uint64124 has_mach_absolute_time = True125 class mach_timebase_info_data_t(ctypes.Structure):126 _fields_ = (127 ('numer', ctypes.c_uint32),128 ('denom', ctypes.c_uint32),129 )...
4a91107d34c429454e341349d8e18063_pep418.py
Source:4a91107d34c429454e341349d8e18063_pep418.py
...85 GetCurrentProcess.restype = HANDLE86 _GetProcessTimes = windll.kernel32.GetProcessTimes87 _GetProcessTimes.argtypes = (HANDLE, FILETIME_p, FILETIME_p, FILETIME_p, FILETIME_p)88 _GetProcessTimes.restype = BOOL89 def filetime2py(obj):90 return (obj.dwHighDateTime << 32) + obj.dwLowDateTime91 def GetProcessTimes(handle):92 creation_time = FILETIME()93 exit_time = FILETIME()94 kernel_time = FILETIME()95 user_time = FILETIME()96 ok = _GetProcessTimes(handle,97 byref(creation_time), byref(exit_time),98 byref(kernel_time), byref(user_time))99 if not ok:100 raise ctypes_winerror()101 return (filetime2py(creation_time), filetime2py(exit_time),102 filetime2py(kernel_time), filetime2py(user_time))103 _GetSystemTimeAsFileTime = windll.kernel32.GetSystemTimeAsFileTime104 _GetSystemTimeAsFileTime.argtypes = (FILETIME_p,)105 _GetSystemTimeAsFileTime.restype = None106 def GetSystemTimeAsFileTime():107 system_time = FILETIME()108 _GetSystemTimeAsFileTime(byref(system_time))109 return filetime2py(system_time)110 libc_name = ctypes.util.find_library('c')111 if libc_name:112 libc = ctypes.CDLL(libc_name, use_errno=True)113 clock_t = ctypes.c_ulong114 if sys.platform == 'darwin':115 mach_absolute_time = libc.mach_absolute_time116 mach_absolute_time.argtypes = ()117 mach_absolute_time.restype = ctypes.c_uint64118 has_mach_absolute_time = True119 class mach_timebase_info_data_t(ctypes.Structure):120 _fields_ = (121 ('numer', ctypes.c_uint32),122 ('denom', ctypes.c_uint32),123 )...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!