mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Windows implementation of getmillisecs(). (#1369)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1369 Test Plan: Imported from OSS Reviewed By: mdouze Differential Revision: D23314738 Pulled By: beauby fbshipit-source-id: 72590eea929edcd8bd133c65265778b6cf6574a9
This commit is contained in:
parent
e3044c407e
commit
2ccecbcd7e
@ -14,9 +14,16 @@
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#undef NOMINMAX
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif // !_MSC_VER
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
@ -65,11 +72,22 @@ int sgemv_(const char *trans, FINTEGER *m, FINTEGER *n, float *alpha,
|
||||
|
||||
namespace faiss {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
double getmillisecs() {
|
||||
LARGE_INTEGER ts;
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&ts);
|
||||
|
||||
return (ts.QuadPart * 1e3) / freq.QuadPart;
|
||||
}
|
||||
#else // _MSC_VER
|
||||
double getmillisecs () {
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, nullptr);
|
||||
return tv.tv_sec * 1e3 + tv.tv_usec * 1e-3;
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
|
||||
uint64_t get_cycles () {
|
||||
#ifdef __x86_64__
|
||||
|
Loading…
x
Reference in New Issue
Block a user