mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
Reorganization directory structure [1/n]
Change-Id: Id1a94577437a4826a32411869f516fec20314ec0
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "performance_counters_linux.h"
|
||||
|
||||
#include "core/device/device.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
////////////////////////////////////////////////////
|
||||
// PerformanceCounters::create
|
||||
////////////////////////////////////////////////////
|
||||
std::unique_ptr<PerformanceCounters> PerformanceCounters::create(Device *device) {
|
||||
auto counter = std::make_unique<PerformanceCountersLinux>();
|
||||
auto gen = device->getHardwareInfo().platform.eRenderCoreFamily;
|
||||
auto &hwHelper = HwHelper::get(gen);
|
||||
UNRECOVERABLE_IF(counter == nullptr);
|
||||
|
||||
counter->clientType.Gen = static_cast<MetricsLibraryApi::ClientGen>(hwHelper.getMetricsLibraryGenId());
|
||||
return counter;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// PerformanceCountersLinux::enableCountersConfiguration
|
||||
//////////////////////////////////////////////////////
|
||||
bool PerformanceCountersLinux::enableCountersConfiguration() {
|
||||
// Release previous counters configuration so the user
|
||||
// can change configuration between kernels.
|
||||
releaseCountersConfiguration();
|
||||
|
||||
// Create oa configuration.
|
||||
if (!metricsLibrary->oaConfigurationCreate(
|
||||
context,
|
||||
oaConfiguration)) {
|
||||
DEBUG_BREAK_IF(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enable oa configuration.
|
||||
if (!metricsLibrary->oaConfigurationActivate(
|
||||
oaConfiguration)) {
|
||||
DEBUG_BREAK_IF(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// PerformanceCountersLinux::releaseCountersConfiguration
|
||||
//////////////////////////////////////////////////////
|
||||
void PerformanceCountersLinux::releaseCountersConfiguration() {
|
||||
// Oa configuration.
|
||||
if (oaConfiguration.IsValid()) {
|
||||
metricsLibrary->oaConfigurationDeactivate(oaConfiguration);
|
||||
metricsLibrary->oaConfigurationDelete(oaConfiguration);
|
||||
oaConfiguration.data = nullptr;
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user