1.\" Copyright (c) 2007 Joseph Koshy.  All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22.\" SUCH DAMAGE.
23.\"
24.Dd November 24, 2007
25.Dt PMC_NAME_OF_CAPABILITY 3
26.Os
27.Sh NAME
28.Nm pmc_name_of_capability ,
29.Nm pmc_name_of_class ,
30.Nm pmc_name_of_cputype ,
31.Nm pmc_name_of_disposition ,
32.Nm pmc_name_of_event ,
33.Nm pmc_name_of_mode ,
34.Nm pmc_name_of_state
35.Nd human readable names for numeric constants used by
36.Xr pmc 3
37and
38.Xr hwpmc 4
39.Sh LIBRARY
40.Lb libpmc
41.Sh SYNOPSIS
42.In pmc.h
43.Ft "const char *"
44.Fn pmc_name_of_capability "enum pmc_caps pc"
45.Ft "const char *"
46.Fn pmc_name_of_class "enum pmc_class pc"
47.Ft "const char *"
48.Fn pmc_name_of_cputype "enum pmc_cputype ct"
49.Ft "const char *"
50.Fn pmc_name_of_disposition "enum pmc_disp pd"
51.Ft "const char *"
52.Fn pmc_name_of_event "enum pmc_event pe"
53.Ft "const char *"
54.Fn pmc_name_of_mode "enum pmc_mode pm"
55.Ft "const char *"
56.Fn pmc_name_of_state "enum pmc_state ps"
57.Sh DESCRIPTION
58These convenience functions translate numeric constants used by the
59.Lb libpmc
60to
61.Vt "const char *"
62pointers to human readable representations of their arguments.
63.Pp
64Function
65.Fn pmc_name_of_capability
66translates a PMC capability flag given in argument
67.Fa pc
68to a human readable string.
69PMC capabilities are described in
70.Xr pmc 3 .
71.Pp
72Function
73.Fn pmc_name_of_class
74translates the PMC class value specified in argument
75.Fa pc
76to a human readable name.
77PMC classes are described in
78.Xr pmc 3 .
79.Pp
80Function
81.Fn pmc_name_of_cputype
82translates the CPU type value specified in argument
83.Fa ct
84to a human readable name.
85CPU types known to the library are described in
86.Xr pmc 3 .
87.Pp
88Function
89.Fn pmc_name_of_disposition
90translates the PMC row disposition specified in argument
91.Fa pd
92to a human readable name.
93PMC row dispositions are described in
94.Xr hwpmc 4 .
95.Pp
96Function
97.Fn pmc_name_of_event
98translates the PMC event number specified by argument
99.Fa pe
100to a string.
101PMC event names are documented in section
102.Sx EVENT SPECIFIERS
103of
104.Xr pmc 3 .
105.Pp
106Function
107.Fn pmc_name_of_mode
108translates the PMC mode specified by argument
109.Fa pm
110to a human readable string.
111PMC modes are described in
112.Xr pmc 3 .
113.Pp
114Function
115.Fn pmc_name_of_state
116translates the value of argument
117.Fa ps
118to a human readable name.
119.Sh IMPLEMENTATION NOTES
120The returned pointers point to static storage inside the PMC
121library and should not be freed by the caller.
122.Sh RETURN VALUES
123These functions return a non-NULL pointer on successful completion.
124In case of an error, a NULL pointer is returned and the global
125variable
126.Va errno
127is set to indicate the error.
128.Sh ERRORS
129A call to these functions may fail with the following errors:
130.Bl -tag -width Er
131.It Bq Er EINVAL
132The function argument specified an invalid value.
133.El
134.Sh SEE ALSO
135.Xr pmc 3 ,
136.Xr pmc_cpuinfo 3 ,
137.Xr pmc_pmcinfo 3 ,
138.Xr hwpmc 4
139