Skip to content

Commit 150e43e

Browse files
authored
Merge pull request #1856 from shatyuka/gpu-statistics-darwin
Darwin: Simplify GPU PerformanceStatistics property code
2 parents cc7c2ed + 2cf3ba8 commit 150e43e

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

darwin/Platform.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,9 @@ void Platform_setGPUValues(Meter* mtr, double* totalUsage, unsigned long long* t
365365
return;
366366
}
367367

368-
CFMutableDictionaryRef properties = NULL;
369-
kern_return_t ret = IORegistryEntryCreateCFProperties(dhost->GPUService, &properties, kCFAllocatorDefault, kNilOptions);
370-
if (ret != KERN_SUCCESS || !properties)
371-
return;
372-
373-
CFDictionaryRef perfStats = CFDictionaryGetValue(properties, CFSTR("PerformanceStatistics"));
368+
CFDictionaryRef perfStats = IORegistryEntryCreateCFProperty(dhost->GPUService, CFSTR("PerformanceStatistics"), kCFAllocatorDefault, kNilOptions);
374369
if (!perfStats)
375-
goto cleanup;
370+
return;
376371

377372
assert(CFGetTypeID(perfStats) == CFDictionaryGetTypeID());
378373

@@ -387,7 +382,7 @@ void Platform_setGPUValues(Meter* mtr, double* totalUsage, unsigned long long* t
387382
prevMonotonicMs = host->monotonicMs;
388383

389384
cleanup:
390-
CFRelease(properties);
385+
CFRelease(perfStats);
391386

392387
mtr->values[0] = *totalUsage;
393388
}

0 commit comments

Comments
 (0)