2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-02-04 13:59:01 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
2021-09-24 16:40:29 +00:00
|
|
|
#include "shared/source/utilities/metrics_library.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-03-24 18:21:13 +00:00
|
|
|
class HwPerfCounter : public TagTypeBase {
|
|
|
|
|
public:
|
2018-08-30 13:37:39 +02:00
|
|
|
void initialize() {
|
2020-06-19 10:57:01 +02:00
|
|
|
query = {};
|
2019-05-20 11:19:27 +02:00
|
|
|
report[0] = 0;
|
2018-08-30 13:37:39 +02:00
|
|
|
}
|
2019-05-20 11:19:27 +02:00
|
|
|
|
2022-02-04 13:59:01 +00:00
|
|
|
static constexpr AllocationType getAllocationType() {
|
|
|
|
|
return AllocationType::PROFILING_TAG_BUFFER;
|
2019-02-08 10:27:48 +01:00
|
|
|
}
|
2020-06-19 10:57:01 +02:00
|
|
|
|
2021-03-24 18:21:13 +00:00
|
|
|
static constexpr TagNodeType getTagNodeType() { return TagNodeType::HwPerfCounter; }
|
|
|
|
|
|
2020-06-19 10:57:01 +02:00
|
|
|
template <typename Type>
|
|
|
|
|
static uint32_t getSize(Type &performanceCounters) {
|
|
|
|
|
return sizeof(query) + performanceCounters.getGpuReportSize();
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 11:19:27 +02:00
|
|
|
// Gpu report size is not known during compile time.
|
|
|
|
|
// Such information will be provided by metrics library dll.
|
|
|
|
|
// Bellow variable will be allocated dynamically based on information
|
|
|
|
|
// from metrics library. Take look at CommandStreamReceiver::getEventPerfCountAllocator.
|
2020-06-19 10:57:01 +02:00
|
|
|
union {
|
|
|
|
|
MetricsLibraryApi::QueryHandle_1_0 handle = {};
|
|
|
|
|
uint8_t padding[64];
|
|
|
|
|
} query;
|
|
|
|
|
|
2019-05-20 11:19:27 +02:00
|
|
|
uint8_t report[1] = {};
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
2021-03-24 18:21:13 +00:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|