Path: blob/21.2-virgl/src/panfrost/perf/pan_perf.h
4560 views
/*1* Copyright © 2021 Collabora, Ltd.2* Author: Antonio Caggiano <[email protected]>3*4* Permission is hereby granted, free of charge, to any person obtaining a copy5* of this software and associated documentation files (the "Software"), to deal6* in the Software without restriction, including without limitation the rights7* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8* copies of the Software, and to permit persons to whom the Software is9* furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be included in12* all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN20* THE SOFTWARE.21*/2223#ifndef PAN_PERF_H24#define PAN_PERF_H2526#include <stdint.h>2728#if defined(__cplusplus)29extern "C" {30#endif3132#define PAN_PERF_MAX_CATEGORIES 433#define PAN_PERF_MAX_COUNTERS 643435struct panfrost_device;36struct panfrost_perf_category;37struct panfrost_perf;3839enum panfrost_perf_counter_units {40PAN_PERF_COUNTER_UNITS_CYCLES,41PAN_PERF_COUNTER_UNITS_JOBS,42PAN_PERF_COUNTER_UNITS_TASKS,43PAN_PERF_COUNTER_UNITS_PRIMITIVES,44PAN_PERF_COUNTER_UNITS_BEATS,45PAN_PERF_COUNTER_UNITS_REQUESTS,46PAN_PERF_COUNTER_UNITS_WARPS,47PAN_PERF_COUNTER_UNITS_QUADS,48PAN_PERF_COUNTER_UNITS_TILES,49PAN_PERF_COUNTER_UNITS_INSTRUCTIONS,50PAN_PERF_COUNTER_UNITS_TRANSACTIONS,51PAN_PERF_COUNTER_UNITS_THREADS,52PAN_PERF_COUNTER_UNITS_BYTES,53PAN_PERF_COUNTER_UNITS_PIXELS,54PAN_PERF_COUNTER_UNITS_ISSUES,55};5657struct panfrost_perf_counter {58const char *name;59const char *desc;60const char *symbol_name;61enum panfrost_perf_counter_units units;62// Offset of this counter's value within the counters memory block63uint32_t offset;6465const struct panfrost_perf_category *category;66};6768struct panfrost_perf_category {69const char *name;7071struct panfrost_perf_counter counters[PAN_PERF_MAX_COUNTERS];72uint32_t n_counters;73};7475struct panfrost_perf_config {76struct panfrost_perf_category categories[PAN_PERF_MAX_CATEGORIES];77uint32_t n_categories;78};7980struct panfrost_perf {81struct panfrost_device *dev;8283const struct panfrost_perf_config* cfg;8485// Memory where to dump counter values86uint32_t *counter_values;87uint32_t n_counter_values;88};8990uint32_t91panfrost_perf_counter_read(const struct panfrost_perf_counter *counter,92const struct panfrost_perf *perf);9394void95panfrost_perf_init(struct panfrost_perf *perf, struct panfrost_device *dev);9697int98panfrost_perf_enable(struct panfrost_perf *perf);99100int101panfrost_perf_disable(struct panfrost_perf *perf);102103int104panfrost_perf_dump(struct panfrost_perf *perf);105106#if defined(__cplusplus)107} // extern "C"108#endif109110#endif // PAN_PERF_H111112113