libpmc.c (145351) | libpmc.c (145774) |
---|---|
1/*- 2 * Copyright (c) 2003,2004 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003,2004 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libpmc/libpmc.c 145351 2005-04-21 05:50:25Z jkoshy $"); | 28__FBSDID("$FreeBSD: head/lib/libpmc/libpmc.c 145774 2005-05-01 14:11:49Z jkoshy $"); |
29 30#include <sys/types.h> 31#include <sys/module.h> 32#include <sys/pmc.h> 33#include <sys/syscall.h> 34 35#include <ctype.h> 36#include <errno.h> --- 1939 unchanged lines hidden (view full) --- 1976 errno = ENXIO; 1977 return -1; 1978 } 1979 1980 *pci = &cpu_info; 1981 return 0; 1982} 1983 | 29 30#include <sys/types.h> 31#include <sys/module.h> 32#include <sys/pmc.h> 33#include <sys/syscall.h> 34 35#include <ctype.h> 36#include <errno.h> --- 1939 unchanged lines hidden (view full) --- 1976 errno = ENXIO; 1977 return -1; 1978 } 1979 1980 *pci = &cpu_info; 1981 return 0; 1982} 1983 |
1984int 1985pmc_width(pmc_id_t pmcid, uint32_t *width) 1986{ 1987 unsigned int i; 1988 enum pmc_class cl; 1989 1990 cl = PMC_ID_TO_CLASS(pmcid); 1991 for (i = 0; i < cpu_info.pm_nclass; i++) 1992 if (cpu_info.pm_classes[i].pm_class == cl) { 1993 *width = cpu_info.pm_classes[i].pm_width; 1994 return 0; 1995 } 1996 return EINVAL; 1997} 1998 1999int 2000pmc_capabilities(pmc_id_t pmcid, uint32_t *caps) 2001{ 2002 unsigned int i; 2003 enum pmc_class cl; 2004 2005 cl = PMC_ID_TO_CLASS(pmcid); 2006 for (i = 0; i < cpu_info.pm_nclass; i++) 2007 if (cpu_info.pm_classes[i].pm_class == cl) { 2008 *caps = cpu_info.pm_classes[i].pm_caps; 2009 return 0; 2010 } 2011 return EINVAL; 2012} 2013 |
|
1984const char * 1985pmc_name_of_cputype(enum pmc_cputype cp) 1986{ 1987 if ((int) cp >= PMC_CPU_FIRST && 1988 cp <= PMC_CPU_LAST) 1989 return pmc_cputype_names[cp]; 1990 errno = EINVAL; 1991 return NULL; --- 157 unchanged lines hidden --- | 2014const char * 2015pmc_name_of_cputype(enum pmc_cputype cp) 2016{ 2017 if ((int) cp >= PMC_CPU_FIRST && 2018 cp <= PMC_CPU_LAST) 2019 return pmc_cputype_names[cp]; 2020 errno = EINVAL; 2021 return NULL; --- 157 unchanged lines hidden --- |