Blame src/libpfm4/lib/pfmlib_intel_knl_unc_edc.c

Packit Service a1973e
/*
Packit Service a1973e
 * pfmlib_intel_knl_unc_edc.c : Intel KnightsLanding Integrated EDRAM uncore PMU
Packit Service a1973e
 *
Packit Service a1973e
 * Copyright (c) 2016 Intel Corp. All rights reserved
Packit Service a1973e
 * Contributed by Peinan Zhang <peinan.zhang@intel.com>
Packit Service a1973e
 *
Packit Service a1973e
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit Service a1973e
 * of this software and associated documentation files (the "Software"), to deal
Packit Service a1973e
 * in the Software without restriction, including without limitation the rights
Packit Service a1973e
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
Packit Service a1973e
 * of the Software, and to permit persons to whom the Software is furnished to do so,
Packit Service a1973e
 * subject to the following conditions:
Packit Service a1973e
 *
Packit Service a1973e
 * The above copyright notice and this permission notice shall be included in all
Packit Service a1973e
 * copies or substantial portions of the Software.
Packit Service a1973e
 *
Packit Service a1973e
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Packit Service a1973e
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
Packit Service a1973e
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit Service a1973e
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Packit Service a1973e
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
Packit Service a1973e
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service a1973e
 */
Packit Service a1973e
#include <sys/types.h>
Packit Service a1973e
#include <ctype.h>
Packit Service a1973e
#include <string.h>
Packit Service a1973e
#include <stdlib.h>
Packit Service a1973e
#include <stdio.h>
Packit Service a1973e
Packit Service a1973e
/* private headers */
Packit Service a1973e
#include "pfmlib_priv.h"
Packit Service a1973e
#include "pfmlib_intel_x86_priv.h"
Packit Service a1973e
#include "pfmlib_intel_snbep_unc_priv.h"
Packit Service a1973e
#include "events/intel_knl_unc_edc_events.h"
Packit Service a1973e
Packit Service a1973e
Packit Service a1973e
#define DEFINE_EDC_UCLK_BOX(n) \
Packit Service a1973e
pfmlib_pmu_t intel_knl_unc_edc_uclk##n##_support = { \
Packit Service a1973e
	.desc			= "Intel KnightLanding EDC_UCLK_"#n" uncore", \
Packit Service a1973e
	.name			= "knl_unc_edc_uclk"#n, \
Packit Service a1973e
	.perf_name		= "uncore_edc_uclk_"#n, \
Packit Service a1973e
	.pmu			= PFM_PMU_INTEL_KNL_UNC_EDC_UCLK##n, \
Packit Service a1973e
	.pme_count		= LIBPFM_ARRAY_SIZE(intel_knl_unc_edc_uclk_pe), \
Packit Service a1973e
	.type			= PFM_PMU_TYPE_UNCORE, \
Packit Service a1973e
	.num_cntrs		= 4, \
Packit Service a1973e
	.num_fixed_cntrs	= 0, \
Packit Service a1973e
	.max_encoding		= 1, \
Packit Service a1973e
	.pe			= intel_knl_unc_edc_uclk_pe, \
Packit Service a1973e
        .atdesc                 = snbep_unc_mods,            \
Packit Service a1973e
	.flags			= PFMLIB_PMU_FL_RAW_UMASK,   \
Packit Service a1973e
	.pmu_detect		= pfm_intel_knl_unc_detect,  \
Packit Service a1973e
	.get_event_encoding[PFM_OS_NONE] = pfm_intel_snbep_unc_get_encoding, \
Packit Service a1973e
	 PFMLIB_ENCODE_PERF(pfm_intel_snbep_unc_get_perf_encoding), \
Packit Service a1973e
	 PFMLIB_OS_DETECT(pfm_intel_x86_perf_detect), \
Packit Service a1973e
	.get_event_first	= pfm_intel_x86_get_event_first, \
Packit Service a1973e
	.get_event_next		= pfm_intel_x86_get_event_next, \
Packit Service a1973e
	.event_is_valid		= pfm_intel_x86_event_is_valid, \
Packit Service a1973e
	.validate_table		= pfm_intel_x86_validate_table, \
Packit Service a1973e
	.get_event_info		= pfm_intel_x86_get_event_info, \
Packit Service a1973e
	.get_event_attr_info	= pfm_intel_x86_get_event_attr_info, \
Packit Service a1973e
	PFMLIB_VALID_PERF_PATTRS(pfm_intel_snbep_unc_perf_validate_pattrs), \
Packit Service a1973e
	.get_event_nattrs	= pfm_intel_x86_get_event_nattrs, \
Packit Service a1973e
};
Packit Service a1973e
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(0);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(1);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(2);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(3);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(4);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(5);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(6);
Packit Service a1973e
DEFINE_EDC_UCLK_BOX(7);
Packit Service a1973e
Packit Service a1973e
Packit Service a1973e
#define DEFINE_EDC_ECLK_BOX(n) \
Packit Service a1973e
pfmlib_pmu_t intel_knl_unc_edc_eclk##n##_support = { \
Packit Service a1973e
	.desc			= "Intel KnightLanding EDC_ECLK_"#n" uncore", \
Packit Service a1973e
	.name			= "knl_unc_edc_eclk"#n, \
Packit Service a1973e
	.perf_name		= "uncore_edc_eclk_"#n, \
Packit Service a1973e
	.pmu			= PFM_PMU_INTEL_KNL_UNC_EDC_ECLK##n, \
Packit Service a1973e
	.pme_count		= LIBPFM_ARRAY_SIZE(intel_knl_unc_edc_eclk_pe), \
Packit Service a1973e
	.type			= PFM_PMU_TYPE_UNCORE, \
Packit Service a1973e
	.num_cntrs		= 4, \
Packit Service a1973e
	.num_fixed_cntrs	= 0, \
Packit Service a1973e
	.max_encoding		= 1, \
Packit Service a1973e
	.pe			= intel_knl_unc_edc_eclk_pe, \
Packit Service a1973e
        .atdesc                 = snbep_unc_mods,            \
Packit Service a1973e
	.flags			= PFMLIB_PMU_FL_RAW_UMASK,   \
Packit Service a1973e
	.pmu_detect		= pfm_intel_knl_unc_detect,  \
Packit Service a1973e
	.get_event_encoding[PFM_OS_NONE] = pfm_intel_snbep_unc_get_encoding, \
Packit Service a1973e
	 PFMLIB_ENCODE_PERF(pfm_intel_snbep_unc_get_perf_encoding), \
Packit Service a1973e
	 PFMLIB_OS_DETECT(pfm_intel_x86_perf_detect), \
Packit Service a1973e
	.get_event_first	= pfm_intel_x86_get_event_first, \
Packit Service a1973e
	.get_event_next		= pfm_intel_x86_get_event_next, \
Packit Service a1973e
	.event_is_valid		= pfm_intel_x86_event_is_valid, \
Packit Service a1973e
	.validate_table		= pfm_intel_x86_validate_table, \
Packit Service a1973e
	.get_event_info		= pfm_intel_x86_get_event_info, \
Packit Service a1973e
	.get_event_attr_info	= pfm_intel_x86_get_event_attr_info, \
Packit Service a1973e
	PFMLIB_VALID_PERF_PATTRS(pfm_intel_snbep_unc_perf_validate_pattrs), \
Packit Service a1973e
	.get_event_nattrs	= pfm_intel_x86_get_event_nattrs, \
Packit Service a1973e
};
Packit Service a1973e
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(0);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(1);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(2);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(3);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(4);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(5);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(6);
Packit Service a1973e
DEFINE_EDC_ECLK_BOX(7);
Packit Service a1973e