2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 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/hw_timestamps.h"
|
|
|
|
#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:
|
2018-08-30 19:37:39 +08:00
|
|
|
void initialize() {
|
2020-06-19 16:57:01 +08:00
|
|
|
query = {};
|
2019-05-20 17:19:27 +08:00
|
|
|
report[0] = 0;
|
2018-08-30 19:37:39 +08:00
|
|
|
}
|
2019-05-20 17:19:27 +08:00
|
|
|
|
2021-03-25 02:21:13 +08:00
|
|
|
static constexpr GraphicsAllocation::AllocationType getAllocationType() {
|
2019-02-08 17:27:48 +08:00
|
|
|
return GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER;
|
|
|
|
}
|
2020-06-19 16:57:01 +08:00
|
|
|
|
2021-03-25 02:21:13 +08:00
|
|
|
static constexpr TagNodeType getTagNodeType() { return TagNodeType::HwPerfCounter; }
|
|
|
|
|
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
|