Skip to content
Snippets Groups Projects
Commit f3500570 authored by Emma Anholt's avatar Emma Anholt Committed by Matt Turner
Browse files

intel/perf: Move some static blocks of C code out of the python script.


Now my editor can help me format code as I type.

Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit 12e065dd)

Part-of: <mesa/mesa!16405>
parent 502823ae
No related branches found
No related tags found
No related merge requests found
......@@ -686,53 +686,7 @@ def main():
c(textwrap.dedent("""\
#include "perf/intel_perf.h"
#define MIN(a, b) ((a < b) ? (a) : (b))
#define MAX(a, b) ((a > b) ? (a) : (b))
static struct intel_perf_query_info *
intel_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = rzalloc(perf, struct intel_perf_query_info);
query->perf = perf;
query->kind = INTEL_PERF_QUERY_TYPE_OA;
query->n_counters = 0;
query->oa_metrics_set_id = 0; /* determined at runtime, via sysfs */
query->counters = rzalloc_array(query, struct intel_perf_query_counter, ncounters);
return query;
}
static struct intel_perf_query_info *
hsw_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
query->oa_format = I915_OA_FORMAT_A45_B8_C8;
/* Accumulation buffer offsets... */
query->gpu_time_offset = 0;
query->a_offset = query->gpu_time_offset + 1;
query->b_offset = query->a_offset + 45;
query->c_offset = query->b_offset + 8;
query->perfcnt_offset = query->c_offset + 8;
query->rpstat_offset = query->perfcnt_offset + 2;
return query;
}
static struct intel_perf_query_info *
bdw_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
/* Accumulation buffer offsets... */
query->gpu_time_offset = 0;
query->gpu_clock_offset = query->gpu_time_offset + 1;
query->a_offset = query->gpu_clock_offset + 1;
query->b_offset = query->a_offset + 36;
query->c_offset = query->b_offset + 8;
query->perfcnt_offset = query->c_offset + 8;
query->rpstat_offset = query->perfcnt_offset + 2;
return query;
}
#include "perf/intel_perf_setup.h"
"""))
# Print out all equation functions.
......
/*
* Copyright © 2018 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef INTEL_PERF_SETUP_H
#define INTEL_PERF_SETUP_H
#include "perf/intel_perf.h"
#define MIN(a, b) ((a < b) ? (a) : (b))
#define MAX(a, b) ((a > b) ? (a) : (b))
static struct intel_perf_query_info *
intel_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = rzalloc(perf, struct intel_perf_query_info);
query->perf = perf;
query->kind = INTEL_PERF_QUERY_TYPE_OA;
query->n_counters = 0;
query->oa_metrics_set_id = 0; /* determined at runtime, via sysfs */
query->counters = rzalloc_array(query, struct intel_perf_query_counter, ncounters);
return query;
}
static struct intel_perf_query_info *
hsw_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
query->oa_format = I915_OA_FORMAT_A45_B8_C8;
/* Accumulation buffer offsets... */
query->gpu_time_offset = 0;
query->a_offset = query->gpu_time_offset + 1;
query->b_offset = query->a_offset + 45;
query->c_offset = query->b_offset + 8;
query->perfcnt_offset = query->c_offset + 8;
query->rpstat_offset = query->perfcnt_offset + 2;
return query;
}
static struct intel_perf_query_info *
bdw_query_alloc(struct intel_perf_config *perf, int ncounters)
{
struct intel_perf_query_info *query = intel_query_alloc(perf, ncounters);
query->oa_format = I915_OA_FORMAT_A32u40_A4u32_B8_C8;
/* Accumulation buffer offsets... */
query->gpu_time_offset = 0;
query->gpu_clock_offset = query->gpu_time_offset + 1;
query->a_offset = query->gpu_clock_offset + 1;
query->b_offset = query->a_offset + 36;
query->c_offset = query->b_offset + 8;
query->perfcnt_offset = query->c_offset + 8;
query->rpstat_offset = query->perfcnt_offset + 2;
return query;
}
#endif /* INTEL_PERF_SETUP_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment