Blame src/libpfm4/lib/pfmlib_montecito_priv.h

Packit 577717
/*
Packit 577717
 * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
Packit 577717
 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
Packit 577717
 *
Packit 577717
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit 577717
 * of this software and associated documentation files (the "Software"), to deal
Packit 577717
 * in the Software without restriction, including without limitation the rights
Packit 577717
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 577717
 * of the Software, and to permit persons to whom the Software is furnished to do so,
Packit 577717
 * subject to the following conditions:
Packit 577717
 *
Packit 577717
 * The above copyright notice and this permission notice shall be included in all
Packit 577717
 * copies or substantial portions of the Software.
Packit 577717
 *
Packit 577717
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Packit 577717
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
Packit 577717
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit 577717
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Packit 577717
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
Packit 577717
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit 577717
 *
Packit 577717
 * This file is part of libpfm, a performance monitoring support library for
Packit 577717
 * applications on Linux.
Packit 577717
 */
Packit 577717
#ifndef __PFMLIB_MONTECITO_PRIV_H__
Packit 577717
#define __PFMLIB_MONTECITO_PRIV_H__
Packit 577717
Packit 577717
/*
Packit 577717
 * Event type definitions
Packit 577717
 *
Packit 577717
 * The virtual events are not really defined in the specs but are an artifact used
Packit 577717
 * to quickly and easily setup EAR and/or BTB. The event type encodes the exact feature
Packit 577717
 * which must be configured in combination with a counting monitor.
Packit 577717
 * For instance, DATA_EAR_CACHE_LAT4 is a virtual D-EAR cache event. If the user
Packit 577717
 * requests this event, this will configure a counting monitor to count DATA_EAR_EVENTS
Packit 577717
 * and PMC11 will be configured for cache mode. The latency is encoded in the umask, here
Packit 577717
 * it would correspond to 4 cycles.
Packit 577717
 *
Packit 577717
 */
Packit 577717
#define PFMLIB_MONT_EVENT_NORMAL	0x0 /* standard counter */
Packit 577717
#define PFMLIB_MONT_EVENT_ETB		0x1 /* virtual event used with ETB configuration */
Packit 577717
#define PFMLIB_MONT_EVENT_IEAR_TLB	0x2 /* virtual event used for I-EAR TLB configuration */	
Packit 577717
#define PFMLIB_MONT_EVENT_IEAR_CACHE	0x3 /* virtual event used for I-EAR cache configuration */	
Packit 577717
#define PFMLIB_MONT_EVENT_DEAR_TLB	0x4 /* virtual event used for D-EAR TLB configuration */	
Packit 577717
#define PFMLIB_MONT_EVENT_DEAR_CACHE	0x5 /* virtual event used for D-EAR cache configuration */	
Packit 577717
#define PFMLIB_MONT_EVENT_DEAR_ALAT	0x6 /* virtual event used for D-EAR ALAT configuration */
Packit 577717
Packit 577717
#define event_is_ear(e)	       ((e)->pme_type >= PFMLIB_MONT_EVENT_IEAR_TLB &&(e)->pme_type <= PFMLIB_MONT_EVENT_DEAR_ALAT)
Packit 577717
#define event_is_iear(e)       ((e)->pme_type == PFMLIB_MONT_EVENT_IEAR_TLB || (e)->pme_type == PFMLIB_MONT_EVENT_IEAR_CACHE)
Packit 577717
#define event_is_dear(e)       ((e)->pme_type >= PFMLIB_MONT_EVENT_DEAR_TLB && (e)->pme_type <= PFMLIB_MONT_EVENT_DEAR_ALAT)
Packit 577717
#define event_is_ear_cache(e)  ((e)->pme_type == PFMLIB_MONT_EVENT_DEAR_CACHE || (e)->pme_type == PFMLIB_MONT_EVENT_IEAR_CACHE)
Packit 577717
#define event_is_ear_tlb(e)    ((e)->pme_type == PFMLIB_MONT_EVENT_IEAR_TLB || (e)->pme_type == PFMLIB_MONT_EVENT_DEAR_TLB)
Packit 577717
#define event_is_ear_alat(e)   ((e)->pme_type == PFMLIB_MONT_EVENT_DEAR_ALAT)
Packit 577717
#define event_is_etb(e)	       ((e)->pme_type == PFMLIB_MONT_EVENT_ETB)
Packit 577717
Packit 577717
/*
Packit 577717
 * Itanium encoding structure
Packit 577717
 * (code must be first 8 bits)
Packit 577717
 */
Packit 577717
typedef struct {
Packit 577717
	unsigned long pme_code:8;	/* major event code */
Packit 577717
	unsigned long pme_type:3;	/* see definitions above */
Packit 577717
	unsigned long pme_caf:2;	/* Active, Floating, Causal, Self-Floating */
Packit 577717
	unsigned long pme_ig1:3;	/* ignored */
Packit 577717
	unsigned long pme_umask:16;	/* unit mask*/
Packit 577717
	unsigned long pme_ig:32;	/* ignored */
Packit 577717
} pme_mont_entry_code_t;		
Packit 577717
Packit 577717
typedef union {
Packit 577717
	unsigned long  	      pme_vcode;
Packit 577717
	pme_mont_entry_code_t pme_mont_code;	/* must not be larger than vcode */
Packit 577717
} pme_mont_code_t;
Packit 577717
Packit 577717
typedef union {
Packit 577717
	unsigned long qual;		/* generic qualifier */
Packit 577717
	struct {
Packit 577717
		unsigned long pme_iar:1;	/* instruction address range supported */
Packit 577717
		unsigned long pme_opm:1;	/* opcode match supported */
Packit 577717
		unsigned long pme_dar:1;	/* data address range supported */
Packit 577717
		unsigned long pme_all:1;	/* supports all_thrd=1 */
Packit 577717
		unsigned long pme_mesi:1;	/* event supports MESI */
Packit 577717
		unsigned long pme_res1:11;	/* reserved */
Packit 577717
		unsigned long pme_group:3;	/* event group */
Packit 577717
		unsigned long pme_set:4;	/* event set*/
Packit 577717
		unsigned long pme_res2:41;	/* reserved */
Packit 577717
	} pme_qual;
Packit 577717
} pme_mont_qualifiers_t;
Packit 577717
Packit 577717
typedef struct {
Packit 577717
	char			*pme_name;
Packit 577717
	pme_mont_code_t		pme_entry_code;
Packit 577717
	unsigned long	 	pme_counters;		/* supported counters */
Packit 577717
	unsigned int		pme_maxincr;
Packit 577717
	pme_mont_qualifiers_t	pme_qualifiers;
Packit 577717
	char			*pme_desc;	/* text description of the event */
Packit 577717
} pme_mont_entry_t;
Packit 577717
Packit 577717
Packit 577717
/*
Packit 577717
 * We embed the umask value into the event code. Because it really is
Packit 577717
 * like a subevent.
Packit 577717
 * pme_code:
Packit 577717
 * 	- lower 16 bits: major event code
Packit 577717
 * 	- upper 16 bits: unit mask
Packit 577717
 */
Packit 577717
#define pme_code	pme_entry_code.pme_mont_code.pme_code
Packit 577717
#define pme_umask	pme_entry_code.pme_mont_code.pme_umask
Packit 577717
#define pme_used	pme_qualifiers.pme_qual_struct.pme_used
Packit 577717
#define pme_type	pme_entry_code.pme_mont_code.pme_type
Packit 577717
#define pme_caf		pme_entry_code.pme_mont_code.pme_caf
Packit 577717
Packit 577717
#define event_opcm_ok(e) ((e)->pme_qualifiers.pme_qual.pme_opm==1)
Packit 577717
#define event_iarr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_iar==1)
Packit 577717
#define event_darr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_dar==1)
Packit 577717
#define event_all_ok(e)  ((e)->pme_qualifiers.pme_qual.pme_all==1)
Packit 577717
#define event_mesi_ok(e)  ((e)->pme_qualifiers.pme_qual.pme_mesi==1)
Packit 577717
Packit 577717
#endif /* __PFMLIB_MONTECITO_PRIV_H__ */