Simplify PerfCounter initialization

Change-Id: Ia393088a80ac7b439efb5e40b70e593e3891cbc5
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-12-19 12:58:02 +01:00
committed by sys_ocldev
parent 58fa5bd347
commit 2c63a956ad
6 changed files with 42 additions and 64 deletions

View File

@@ -289,32 +289,20 @@ void CommandQueue::updateFromCompletionStamp(const CompletionStamp &completionSt
this->taskLevel = completionStamp.taskLevel;
}
bool CommandQueue::setPerfCountersEnabled(bool perfCountersEnabled, cl_uint configuration) {
bool CommandQueue::setPerfCountersEnabled() {
DEBUG_BREAK_IF(device == nullptr);
if (perfCountersEnabled == this->perfCountersEnabled) {
return true;
}
// Only dynamic configuration (set 0) is supported.
const uint32_t dynamicSet = 0;
if (configuration != dynamicSet) {
return false;
}
auto perfCounters = device->getPerformanceCounters();
bool isCcsEngine = isCcs(getGpgpuEngine().osContext->getEngineType());
if (perfCountersEnabled) {
if (!perfCounters->enable(isCcsEngine)) {
perfCounters->shutdown();
return false;
}
} else {
perfCountersEnabled = perfCounters->enable(isCcsEngine);
if (!perfCountersEnabled) {
perfCounters->shutdown();
}
this->perfCountersEnabled = perfCountersEnabled;
return true;
} // namespace NEO
return perfCountersEnabled;
}
PerformanceCounters *CommandQueue::getPerfCounters() {
return device->getPerformanceCounters();