libpmc.c (d56c5d4becf2371b8fe7055a547028a9576febde) libpmc.c (c5153e190bd2410c60a50e108a7a60cde9a3c4bc)
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

--- 1967 unchanged lines hidden (view full) ---

1976 errno = ENXIO;
1977 return -1;
1978 }
1979
1980 *pci = &cpu_info;
1981 return 0;
1982}
1983
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

--- 1967 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 ---