xref: /aosp_15_r20/external/mesa3d/src/intel/ds/intel_pps_perf.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2021 Collabora, Ltd.
3  * Author: Antonio Caggiano <[email protected]>
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    struct intel_perf_context *ctx = nullptr;
37    struct intel_perf_config *cfg = nullptr;
38 
39    // Accumulations are stored here
40    struct intel_perf_query_result result = {};
41 
42    struct intel_device_info devinfo = {};
43 };
44 
45 } // namespace pps
46