Chris Wilson | b98bade | 2013-08-20 21:39:27 +0100 | [diff] [blame] | 1 | /* |
| 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 Wilson | cc45a9a | 2013-08-17 17:38:37 +0100 | [diff] [blame] | 28 | #include <stdint.h> |
| 29 | |
Chris Wilson | b20a6b8 | 2013-08-22 01:30:02 +0100 | [diff] [blame] | 30 | #define MAX_RINGS 4 |
| 31 | |
Chris Wilson | cc45a9a | 2013-08-17 17:38:37 +0100 | [diff] [blame] | 32 | struct gpu_perf { |
Chris Wilson | 1847869 | 2013-08-22 10:59:58 +0000 | [diff] [blame^] | 33 | const char *error; |
Chris Wilson | cc45a9a | 2013-08-17 17:38:37 +0100 | [diff] [blame] | 34 | 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 Wilson | 8cdb5bc | 2013-08-17 18:24:39 +0100 | [diff] [blame] | 41 | int (*func)(struct gpu_perf *, const void *); |
Chris Wilson | cc45a9a | 2013-08-17 17:38:37 +0100 | [diff] [blame] | 42 | } *sample; |
| 43 | |
Chris Wilson | 98572f0 | 2013-08-18 11:15:08 +0100 | [diff] [blame] | 44 | int flip_complete[4]; |
Chris Wilson | cbbd55a | 2013-08-17 20:04:11 +0100 | [diff] [blame] | 45 | struct gpu_perf_comm { |
| 46 | struct gpu_perf_comm *next; |
| 47 | char name[256]; |
| 48 | pid_t pid; |
| 49 | int nr_requests[4]; |
Chris Wilson | cc9de39 | 2013-08-17 20:32:58 +0100 | [diff] [blame] | 50 | void *user_data; |
Chris Wilson | eed59ea | 2013-08-17 21:14:10 +0100 | [diff] [blame] | 51 | |
Chris Wilson | eed59ea | 2013-08-17 21:14:10 +0100 | [diff] [blame] | 52 | uint64_t wait_time; |
Chris Wilson | 67f533f | 2013-08-17 22:33:35 +0100 | [diff] [blame] | 53 | uint64_t busy_time; |
Chris Wilson | cbbd55a | 2013-08-17 20:04:11 +0100 | [diff] [blame] | 54 | } *comm; |
Chris Wilson | 67f533f | 2013-08-17 22:33:35 +0100 | [diff] [blame] | 55 | 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 Wilson | b20a6b8 | 2013-08-22 01:30:02 +0100 | [diff] [blame] | 60 | } *wait[MAX_RINGS]; |
Chris Wilson | cc45a9a | 2013-08-17 17:38:37 +0100 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | void gpu_perf_init(struct gpu_perf *gp, unsigned flags); |
| 64 | int gpu_perf_update(struct gpu_perf *gp); |
Chris Wilson | b98bade | 2013-08-20 21:39:27 +0100 | [diff] [blame] | 65 | |
| 66 | #endif /* GPU_PERF_H */ |