2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-12-16 19:01:27 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
2021-09-25 00:40:29 +08:00
|
|
|
#include "shared/source/utilities/metrics_library.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-03-25 02:21:13 +08:00
|
|
|
class HwPerfCounter : public TagTypeBase {
|
|
|
|
public:
|
2024-12-16 19:01:27 +08:00
|
|
|
using ValueT = uint8_t;
|
|
|
|
|
|
|
|
void initialize(uint8_t initValue) {
|
2020-06-19 16:57:01 +08:00
|
|
|
query = {};
|
2024-12-16 19:01:27 +08:00
|
|
|
report[0] = initValue;
|
2018-08-30 19:37:39 +08:00
|
|
|
}
|
2019-05-20 17:19:27 +08:00
|
|
|
|
2022-02-04 21:59:01 +08:00
|
|
|
static constexpr AllocationType getAllocationType() {
|
2023-12-11 22:24:36 +08:00
|
|
|
return AllocationType::profilingTagBuffer;
|
2019-02-08 17:27:48 +08:00
|
|
|
}
|
2020-06-19 16:57:01 +08:00
|
|
|
|
2023-12-05 20:06:54 +08:00
|
|
|
static constexpr TagNodeType getTagNodeType() { return TagNodeType::hwPerfCounter; }
|
2021-03-25 02:21:13 +08:00
|
|
|
|
2020-06-19 16:57:01 +08:00
|
|
|
template <typename Type>
|
|
|
|
static uint32_t getSize(Type &performanceCounters) {
|
|
|
|
return sizeof(query) + performanceCounters.getGpuReportSize();
|
|
|
|
}
|
|
|
|
|
2019-05-20 17:19:27 +08: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 16:57:01 +08:00
|
|
|
union {
|
|
|
|
MetricsLibraryApi::QueryHandle_1_0 handle = {};
|
|
|
|
uint8_t padding[64];
|
|
|
|
} query;
|
|
|
|
|
2019-05-20 17:19:27 +08:00
|
|
|
uint8_t report[1] = {};
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2021-03-25 02:21:13 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|