1 /* 2 * Copyright © 2021 Collabora, Ltd. 3 * Author: Antonio Caggiano <antonio.caggiano@collabora.com> 4 * 5 * SPDX-License-Identifier: MIT 6 */ 7 8 #pragma once 9 10 #include <optional> 11 #include <string> 12 #include <vector> 13 14 #include "dev/intel_device_info.h" 15 #include "perf/intel_perf.h" 16 #include "perf/intel_perf_query.h" 17 18 namespace pps 19 { 20 class IntelPerf 21 { 22 public: 23 IntelPerf(int drm_fd); 24 ~IntelPerf(); 25 26 std::vector<struct intel_perf_query_info*> get_queries() const; 27 28 bool open(uint64_t sampling_period_ns, struct intel_perf_query_info *query); 29 void close(); 30 31 bool oa_stream_ready() const; 32 ssize_t read_oa_stream(void *buf, size_t bytes) const; 33 34 int drm_fd = -1; 35 36 void *ralloc_ctx = nullptr; 37 void *ralloc_cfg = nullptr; 38 39 struct intel_perf_context *ctx = nullptr; 40 struct intel_perf_config *cfg = nullptr; 41 42 // Accumulations are stored here 43 struct intel_perf_query_result result = {}; 44 45 struct intel_device_info devinfo = {}; 46 }; 47 48 } // namespace pps 49