jehanne/sys/src/kern/amd64/pmc.h

67 lines
1.2 KiB
C

/* Copyright (C) Charles Forsyth
* See /doc/license/NOTICE.Plan9-9k.txt for details about the licensing.
*/
/* Portions of this file are Copyright (C) 9front's team.
* See /doc/license/9front-mit for details about the licensing.
* See http://code.9front.org/hg/plan9front/ for a list of authors.
*/
typedef struct PmcCtl PmcCtl;
typedef struct PmcCtr PmcCtr;
typedef struct PmcCtlCtrId PmcCtlCtrId;
/*
* HW performance counters
*/
struct PmcCtl {
uint32_t coreno;
int enab;
int user;
int os;
int nodesc;
char descstr[KNAMELEN];
};
struct PmcCtr{
int stale;
Rendez r;
uint64_t ctr;
int ctrset;
PmcCtl;
int ctlset;
};
enum {
PmcMaxCtrs = 4,
};
struct PmcCore{
Lock;
PmcCtr ctr[PmcMaxCtrs];
};
struct PmcCtlCtrId {
char portdesc[KNAMELEN];
char archdesc[KNAMELEN];
};
enum {
PmcIgn = 0,
PmcGet = 1,
PmcSet = 2,
};
enum {
PmcCtlNullval = 0xdead,
};
extern int pmcnregs(void);
extern void pmcinitctl(PmcCtl*);
extern int pmcsetctl(uint32_t, PmcCtl*, uint32_t);
extern int pmctrans(PmcCtl*);
extern int pmcgetctl(uint32_t, PmcCtl*, uint32_t);
extern int pmcdescstr(char*, int);
extern uint64_t pmcgetctr(uint32_t, uint32_t);
extern int pmcsetctr(uint32_t, uint64_t, uint32_t);
extern void pmcconfigure(void);