blob: 53699f75fb3433bcb336fe10583863b18e9a0215 [file] [log] [blame]
Chris Wilsonb98bade2013-08-20 21:39:27 +01001/*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#ifndef GPU_PERF_H
26#define GPU_PERF_H
27
Chris Wilsoncc45a9a2013-08-17 17:38:37 +010028#include <stdint.h>
29
Chris Wilsonb20a6b82013-08-22 01:30:02 +010030#define MAX_RINGS 4
31
Chris Wilsoncc45a9a2013-08-17 17:38:37 +010032struct gpu_perf {
Chris Wilson18478692013-08-22 10:59:58 +000033 const char *error;
Chris Wilsoncc45a9a2013-08-17 17:38:37 +010034 int page_size;
35 int nr_cpus;
36 int nr_events;
37 int *fd;
38 void **map;
39 struct gpu_perf_sample {
40 uint64_t id;
Chris Wilson8cdb5bc2013-08-17 18:24:39 +010041 int (*func)(struct gpu_perf *, const void *);
Chris Wilsoncc45a9a2013-08-17 17:38:37 +010042 } *sample;
43
Chris Wilson98572f02013-08-18 11:15:08 +010044 int flip_complete[4];
Chris Wilsoncbbd55a2013-08-17 20:04:11 +010045 struct gpu_perf_comm {
46 struct gpu_perf_comm *next;
47 char name[256];
48 pid_t pid;
49 int nr_requests[4];
Chris Wilsoncc9de392013-08-17 20:32:58 +010050 void *user_data;
Chris Wilsoneed59ea2013-08-17 21:14:10 +010051
Chris Wilsoneed59ea2013-08-17 21:14:10 +010052 uint64_t wait_time;
Chris Wilson67f533f2013-08-17 22:33:35 +010053 uint64_t busy_time;
Chris Wilsoncbbd55a2013-08-17 20:04:11 +010054 } *comm;
Chris Wilson67f533f2013-08-17 22:33:35 +010055 struct gpu_perf_time {
56 struct gpu_perf_time *next;
57 struct gpu_perf_comm *comm;
58 uint32_t seqno;
59 uint64_t time;
Chris Wilsonb20a6b82013-08-22 01:30:02 +010060 } *wait[MAX_RINGS];
Chris Wilsoncc45a9a2013-08-17 17:38:37 +010061};
62
63void gpu_perf_init(struct gpu_perf *gp, unsigned flags);
64int gpu_perf_update(struct gpu_perf *gp);
Chris Wilsonb98bade2013-08-20 21:39:27 +010065
66#endif /* GPU_PERF_H */