mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-07-09 17:08:33 +00:00
ggml : make ggml_time_init idempotent (#24422)
This commit is contained in:
parent
defa95c306
commit
1a7c25bfdb
1 changed files with 11 additions and 1 deletions
|
|
@ -525,7 +525,11 @@ const char * ggml_commit(void) {
|
|||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
static int64_t timer_freq, timer_start;
|
||||
void ggml_time_init(void) {
|
||||
static BOOL CALLBACK ggml_time_init_once(PINIT_ONCE once, PVOID param, PVOID *ctx) {
|
||||
UNUSED(once);
|
||||
UNUSED(param);
|
||||
UNUSED(ctx);
|
||||
|
||||
LARGE_INTEGER t;
|
||||
QueryPerformanceFrequency(&t);
|
||||
timer_freq = t.QuadPart;
|
||||
|
|
@ -535,6 +539,12 @@ void ggml_time_init(void) {
|
|||
// We subtract the program start time to reduce the likelihood of that happening.
|
||||
QueryPerformanceCounter(&t);
|
||||
timer_start = t.QuadPart;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
void ggml_time_init(void) {
|
||||
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
||||
InitOnceExecuteOnce(&once, ggml_time_init_once, NULL, NULL);
|
||||
}
|
||||
int64_t ggml_time_ms(void) {
|
||||
LARGE_INTEGER t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue