xref: /freebsd/lib/libpmc/pmc_configure_logfile.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1f28834c1SJoseph Koshy.\" Copyright (c) 2007 Joseph Koshy.  All rights reserved.
2f28834c1SJoseph Koshy.\"
3f28834c1SJoseph Koshy.\" Redistribution and use in source and binary forms, with or without
4f28834c1SJoseph Koshy.\" modification, are permitted provided that the following conditions
5f28834c1SJoseph Koshy.\" are met:
6f28834c1SJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright
7f28834c1SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer.
8f28834c1SJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright
9f28834c1SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer in the
10f28834c1SJoseph Koshy.\"    documentation and/or other materials provided with the distribution.
11f28834c1SJoseph Koshy.\"
12*026dbd29SChristian Brueffer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13*026dbd29SChristian Brueffer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14*026dbd29SChristian Brueffer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15*026dbd29SChristian Brueffer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16*026dbd29SChristian Brueffer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17*026dbd29SChristian Brueffer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18*026dbd29SChristian Brueffer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19*026dbd29SChristian Brueffer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20*026dbd29SChristian Brueffer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21*026dbd29SChristian Brueffer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22*026dbd29SChristian Brueffer.\" SUCH DAMAGE.
23f28834c1SJoseph Koshy.\"
24f28834c1SJoseph Koshy.Dd November 24, 2007
25f28834c1SJoseph Koshy.Dt PMC_CONFIGURE_LOGFILE 3
26aa12cea2SUlrich Spörlein.Os
27f28834c1SJoseph Koshy.Sh NAME
28f28834c1SJoseph Koshy.Nm pmc_configure_logfile ,
29f28834c1SJoseph Koshy.Nm pmc_flush_logfile ,
30dceed24aSFabien Thomas.Nm pmc_writelog ,
31dceed24aSFabien Thomas.Nm pmc_close_logfile
32f28834c1SJoseph Koshy.Nd log file management
33f28834c1SJoseph Koshy.Sh LIBRARY
34f28834c1SJoseph Koshy.Lb libpmc
35f28834c1SJoseph Koshy.Sh SYNOPSIS
36f28834c1SJoseph Koshy.In pmc.h
37f28834c1SJoseph Koshy.Ft int
38f28834c1SJoseph Koshy.Fn pmc_configure_logfile "int fd"
39f28834c1SJoseph Koshy.Ft int
40f28834c1SJoseph Koshy.Fn pmc_flush_logfile void
41f28834c1SJoseph Koshy.Ft int
42f28834c1SJoseph Koshy.Fn pmc_writelog "uint32_t userdata"
43dceed24aSFabien Thomas.Ft int
44dceed24aSFabien Thomas.Fn pmc_close_logfile void
45f28834c1SJoseph Koshy.Sh DESCRIPTION
46f28834c1SJoseph KoshyThe functions manage logging of
47f28834c1SJoseph Koshy.Xr hwpmc 4
48f28834c1SJoseph Koshyevents.
49f28834c1SJoseph Koshy.Pp
50f28834c1SJoseph KoshyFunction
51f28834c1SJoseph Koshy.Fn pmc_configure_logfile
52f28834c1SJoseph Koshyis used to turn on and turn off logging.
53f28834c1SJoseph KoshyIf argument
54f28834c1SJoseph Koshy.Fa fd
55f28834c1SJoseph Koshyis a valid file handle returned by a prior call to
56f28834c1SJoseph Koshy.Xr open 2
57f28834c1SJoseph Koshyor
58f28834c1SJoseph Koshy.Xr socket 2
59f28834c1SJoseph Koshythen performance events will be logged to the file corresponding
60f28834c1SJoseph Koshyto the specified handle.
61f28834c1SJoseph KoshyIf the value of argument
62f28834c1SJoseph Koshy.Fa fd
63f28834c1SJoseph Koshyis -1 then logging will be stopped after any pending data is flushed.
64f28834c1SJoseph Koshy.Pp
65f28834c1SJoseph KoshyFunction
66f28834c1SJoseph Koshy.Fn pmc_flush_logfile
67f28834c1SJoseph Koshywill force all log data queued inside the
68f28834c1SJoseph Koshy.Xr hwpmc 4
69f28834c1SJoseph Koshydriver to be written out.
70f28834c1SJoseph Koshy.Pp
71f28834c1SJoseph KoshyFunction
72f28834c1SJoseph Koshy.Fn pmc_writelog
73f28834c1SJoseph Koshywill append a log entry containing the value of argument
74f28834c1SJoseph Koshy.Fa userdata
75f28834c1SJoseph Koshyto the log file.
76dceed24aSFabien Thomas.Pp
77dceed24aSFabien ThomasFunction
78dceed24aSFabien Thomas.Fn pmc_close_logfile
79dceed24aSFabien Thomaswill flush all pending log data and close
80dceed24aSFabien Thomas.Xr hwpmc 4 Ns Ap s
81dceed24aSFabien Thomasside of the stream.
82f28834c1SJoseph Koshy.Sh RETURN VALUES
83f28834c1SJoseph Koshy.Rv -std
84f28834c1SJoseph Koshy.Sh ERRORS
85f28834c1SJoseph KoshyA call to
86f28834c1SJoseph Koshy.Fn pmc_configure_logfile
87f28834c1SJoseph Koshymay fail with the following errors:
88f28834c1SJoseph Koshy.Bl -tag -width Er
89f28834c1SJoseph Koshy.It Bq Er EAGAIN
90f28834c1SJoseph KoshyThe
91f28834c1SJoseph Koshy.Xr hwpmc 4
92f28834c1SJoseph Koshydriver was not able to create a helper process due to system limits
93f28834c1SJoseph Koshybeing reached.
94f28834c1SJoseph Koshy.It Bq Er EBUSY
95f28834c1SJoseph KoshyFunction
96f28834c1SJoseph Koshy.Fn pmc_configure_logfile
97f28834c1SJoseph Koshywas called with a log file already configured.
98f28834c1SJoseph Koshy.It Bq Er EINVAL
99f28834c1SJoseph KoshyFunction
100f28834c1SJoseph Koshy.Fn pmc_configure_logfile
101f28834c1SJoseph Koshywas called with an argument of -1 without a log file being previously
102f28834c1SJoseph Koshyconfigured.
103f28834c1SJoseph Koshy.It Bq Er ENOMEM
104f28834c1SJoseph KoshyThe system encountered a memory shortage when servicing this request.
105f28834c1SJoseph Koshy.El
106f28834c1SJoseph Koshy.Pp
107f28834c1SJoseph KoshyA call to
108f28834c1SJoseph Koshy.Fn pmc_flush_logfile
109f28834c1SJoseph Koshymay fail with the following errors:
110f28834c1SJoseph Koshy.Bl -tag -width Er
111f28834c1SJoseph Koshy.It Bq Er EINVAL
112f28834c1SJoseph KoshyFunction
113f28834c1SJoseph Koshy.Fn pmc_flush_logfile
114f28834c1SJoseph Koshywas called without a log file being previously configured.
115f28834c1SJoseph Koshy.El
116f28834c1SJoseph Koshy.Pp
117f28834c1SJoseph KoshyA call to
118f28834c1SJoseph Koshy.Fn pmc_writelog
119f28834c1SJoseph Koshymay fail with the following errors:
120f28834c1SJoseph Koshy.Bl -tag -width Er
121f28834c1SJoseph Koshy.It Bq Er EINVAL
122f28834c1SJoseph KoshyFunction
123f28834c1SJoseph Koshy.Fn pmc_writelog
124f28834c1SJoseph Koshywas called without a log file being previously configured.
125f28834c1SJoseph Koshy.It Bq Er ENOMEM
126f28834c1SJoseph KoshyThe system encountered a memory shortage when servicing this
127f28834c1SJoseph Koshyrequest.
128f28834c1SJoseph Koshy.El
129f28834c1SJoseph Koshy.Sh SEE ALSO
130f28834c1SJoseph Koshy.Xr pmc 3 ,
131f28834c1SJoseph Koshy.Xr hwpmc 4
132