intel/perf: Hide extended metrics by default

XE architecture enables many more metrics, perhaps too many for
the average user. Reduce reported metrics to smaller subset,
known as non-extended metrics, by default. Can re-enable extended
metrics with env var INTEL_EXTENDED_METRICS=1

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21841>
This commit is contained in:
Felix DeGrood 2023-03-10 16:34:02 +00:00 committed by Marge Bot
parent 6b22a02f90
commit 341f1011a6
3 changed files with 23 additions and 0 deletions

View file

@ -566,6 +566,12 @@ Intel driver environment variables
``offsets``
print offsets of instructions
.. envvar:: INTEL_EXTENDED_METRICS
By default, only a standard set of gpu metrics are advertised. This
reduces time to collect metrics and hides infrequently used metrics.
To enable all metrics, set value to 1.
.. envvar:: INTEL_MEASURE
Collects GPU timestamps over common intervals, and generates a CSV report

View file

@ -49,6 +49,7 @@
#include "util/bitscan.h"
#include "util/macros.h"
#include "util/mesa-sha1.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#define FILE_DEBUG_FLAG DEBUG_PERFMON
@ -170,12 +171,24 @@ read_sysfs_drm_device_file_uint64(struct intel_perf_config *perf,
return read_file_uint64(buf, value);
}
static bool
oa_config_enabled(struct intel_perf_config *perf,
const struct intel_perf_query_info *query) {
// Hide extended metrics unless enabled with env param
bool is_extended_metric = strncmp(query->name, "Ext", 3) == 0;
return perf->enable_all_metrics || !is_extended_metric;
}
static void
register_oa_config(struct intel_perf_config *perf,
const struct intel_device_info *devinfo,
const struct intel_perf_query_info *query,
uint64_t config_id)
{
if (!oa_config_enabled(perf, query))
return;
struct intel_perf_query_info *registered_query =
intel_perf_append_query_info(perf, 0);
@ -718,6 +731,7 @@ oa_metrics_available(struct intel_perf_config *perf, int fd,
}
perf->i915_query_supported = i915_query_perf_config_supported(perf, fd);
perf->enable_all_metrics = debug_get_bool_option("INTEL_EXTENDED_METRICS", false);
perf->i915_perf_version = i915_perf_version(fd);
/* TODO: We should query this from i915 */

View file

@ -327,6 +327,9 @@ struct intel_perf_config {
/* Whether i915 has DRM_I915_QUERY_PERF_CONFIG support. */
bool i915_query_supported;
/* Have extended metrics been enabled */
bool enable_all_metrics;
/* Version of the i915-perf subsystem, refer to i915_drm.h. */
int i915_perf_version;