17ec681f3Smrg/* 27ec681f3Smrg * Copyright © 2021 Collabora, Ltd. 37ec681f3Smrg * Author: Antonio Caggiano <antonio.caggiano@collabora.com> 47ec681f3Smrg * 57ec681f3Smrg * SPDX-License-Identifier: MIT 67ec681f3Smrg */ 77ec681f3Smrg 87ec681f3Smrg#pragma once 97ec681f3Smrg 107ec681f3Smrg#include <optional> 117ec681f3Smrg#include <string> 127ec681f3Smrg#include <vector> 137ec681f3Smrg 147ec681f3Smrg#include <intel/dev/intel_device_info.h> 157ec681f3Smrg#include <intel/perf/intel_perf.h> 167ec681f3Smrg#include <intel/perf/intel_perf_query.h> 177ec681f3Smrg 187ec681f3Smrgnamespace pps 197ec681f3Smrg{ 207ec681f3Smrgint perf_ioctl(int fd, unsigned long request, void *arg); 217ec681f3Smrg 227ec681f3Smrgclass IntelPerf 237ec681f3Smrg{ 247ec681f3Smrg public: 257ec681f3Smrg IntelPerf(int drm_fd); 267ec681f3Smrg 277ec681f3Smrg IntelPerf(const IntelPerf &) = delete; 287ec681f3Smrg IntelPerf &operator=(const IntelPerf &) = delete; 297ec681f3Smrg 307ec681f3Smrg IntelPerf(IntelPerf &&); 317ec681f3Smrg IntelPerf &operator=(IntelPerf &&) noexcept; 327ec681f3Smrg 337ec681f3Smrg ~IntelPerf(); 347ec681f3Smrg 357ec681f3Smrg std::optional<struct intel_perf_query_info> find_query_by_name(const std::string &name) const; 367ec681f3Smrg 377ec681f3Smrg std::vector<struct intel_perf_query_info*> get_queries() const; 387ec681f3Smrg 397ec681f3Smrg bool open(uint64_t sampling_period_ns); 407ec681f3Smrg void close(); 417ec681f3Smrg 427ec681f3Smrg bool oa_stream_ready() const; 437ec681f3Smrg ssize_t read_oa_stream(void *buf, size_t bytes) const; 447ec681f3Smrg 457ec681f3Smrg int drm_fd = -1; 467ec681f3Smrg 477ec681f3Smrg void *ralloc_ctx = nullptr; 487ec681f3Smrg void *ralloc_cfg = nullptr; 497ec681f3Smrg 507ec681f3Smrg struct intel_perf_context *ctx = nullptr; 517ec681f3Smrg struct intel_perf_config *cfg = nullptr; 527ec681f3Smrg 537ec681f3Smrg struct intel_device_info devinfo = {}; 547ec681f3Smrg 557ec681f3Smrg std::optional<struct intel_perf_query_info> query = std::nullopt; 567ec681f3Smrg}; 577ec681f3Smrg 587ec681f3Smrg} // namespace pps 59