This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author danielhrisca
Recipients Mariatta, danielhrisca, docs@python, kh90909, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2020-11-13.19:36:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605296206.94.0.729395466034.issue37205@roundup.psfhosted.org>
In-reply-to
Content
I'm actually surprised that this problem gets so little interest. It's probably so obscure that most people don't even realize it.

Why isn't it implemented using winapi calls for the windows platform?

I took inspiration from this SO thread https://stackoverflow.com/questions/56502111/should-time-perf-counter-be-consistent-across-processes-in-python-on-windows
 
and came up with this function for 64 bit Python (a few more lines would be needed for error checking)

#include <windows.h>
static PyObject* perf_counter(PyObject* self, PyObject* args)
{
	PyObject* ret;

	QueryPerformanceFrequency(lpFrequency);
	QueryPerformanceCounter(lpPerformanceCount);
	
	ret = PyFloat_FromDouble(((double) lpPerformanceCount->QuadPart ) / lpFrequency->QuadPart);
	
	return ret;
}
History
Date User Action Args
2020-11-13 19:36:46danielhriscasetrecipients: + danielhrisca, paul.moore, vstinner, tim.golden, docs@python, zach.ware, steve.dower, Mariatta, kh90909
2020-11-13 19:36:46danielhriscasetmessageid: <1605296206.94.0.729395466034.issue37205@roundup.psfhosted.org>
2020-11-13 19:36:46danielhriscalinkissue37205 messages
2020-11-13 19:36:46danielhriscacreate