xref: /freebsd/lib/libpmc/pmc_configure_logfile.3 (revision aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744)
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.\"
12f28834c1SJoseph Koshy.\" This software is provided by Joseph Koshy ``as is'' and
13f28834c1SJoseph Koshy.\" any express or implied warranties, including, but not limited to, the
14f28834c1SJoseph Koshy.\" implied warranties of merchantability and fitness for a particular purpose
15f28834c1SJoseph Koshy.\" are disclaimed.  in no event shall Joseph Koshy be liable
16f28834c1SJoseph Koshy.\" for any direct, indirect, incidental, special, exemplary, or consequential
17f28834c1SJoseph Koshy.\" damages (including, but not limited to, procurement of substitute goods
18f28834c1SJoseph Koshy.\" or services; loss of use, data, or profits; or business interruption)
19f28834c1SJoseph Koshy.\" however caused and on any theory of liability, whether in contract, strict
20f28834c1SJoseph Koshy.\" liability, or tort (including negligence or otherwise) arising in any way
21f28834c1SJoseph Koshy.\" out of the use of this software, even if advised of the possibility of
22f28834c1SJoseph Koshy.\" such damage.
23f28834c1SJoseph Koshy.\"
24f28834c1SJoseph Koshy.\" $FreeBSD$
25f28834c1SJoseph Koshy.\"
26f28834c1SJoseph Koshy.Dd November 24, 2007
27f28834c1SJoseph Koshy.Dt PMC_CONFIGURE_LOGFILE 3
28*aa12cea2SUlrich Spörlein.Os
29f28834c1SJoseph Koshy.Sh NAME
30f28834c1SJoseph Koshy.Nm pmc_configure_logfile ,
31f28834c1SJoseph Koshy.Nm pmc_flush_logfile ,
32f28834c1SJoseph Koshy.Nm pmc_writelog
33f28834c1SJoseph Koshy.Nd log file management
34f28834c1SJoseph Koshy.Sh LIBRARY
35f28834c1SJoseph Koshy.Lb libpmc
36f28834c1SJoseph Koshy.Sh SYNOPSIS
37f28834c1SJoseph Koshy.In pmc.h
38f28834c1SJoseph Koshy.Ft int
39f28834c1SJoseph Koshy.Fn pmc_configure_logfile "int fd"
40f28834c1SJoseph Koshy.Ft int
41f28834c1SJoseph Koshy.Fn pmc_flush_logfile void
42f28834c1SJoseph Koshy.Ft int
43f28834c1SJoseph Koshy.Fn pmc_writelog "uint32_t userdata"
44f28834c1SJoseph Koshy.Sh DESCRIPTION
45f28834c1SJoseph KoshyThe functions manage logging of
46f28834c1SJoseph Koshy.Xr hwpmc 4
47f28834c1SJoseph Koshyevents.
48f28834c1SJoseph Koshy.Pp
49f28834c1SJoseph KoshyFunction
50f28834c1SJoseph Koshy.Fn pmc_configure_logfile
51f28834c1SJoseph Koshyis used to turn on and turn off logging.
52f28834c1SJoseph KoshyIf argument
53f28834c1SJoseph Koshy.Fa fd
54f28834c1SJoseph Koshyis a valid file handle returned by a prior call to
55f28834c1SJoseph Koshy.Xr open 2
56f28834c1SJoseph Koshyor
57f28834c1SJoseph Koshy.Xr socket 2
58f28834c1SJoseph Koshythen performance events will be logged to the file corresponding
59f28834c1SJoseph Koshyto the specified handle.
60f28834c1SJoseph KoshyIf the value of argument
61f28834c1SJoseph Koshy.Fa fd
62f28834c1SJoseph Koshyis -1 then logging will be stopped after any pending data is flushed.
63f28834c1SJoseph Koshy.Pp
64f28834c1SJoseph KoshyFunction
65f28834c1SJoseph Koshy.Fn pmc_flush_logfile
66f28834c1SJoseph Koshywill force all log data queued inside the
67f28834c1SJoseph Koshy.Xr hwpmc 4
68f28834c1SJoseph Koshydriver to be written out.
69f28834c1SJoseph Koshy.Pp
70f28834c1SJoseph KoshyFunction
71f28834c1SJoseph Koshy.Fn pmc_writelog
72f28834c1SJoseph Koshywill append a log entry containing the value of argument
73f28834c1SJoseph Koshy.Fa userdata
74f28834c1SJoseph Koshyto the log file.
75f28834c1SJoseph Koshy.Sh RETURN VALUES
76f28834c1SJoseph Koshy.Rv -std
77f28834c1SJoseph Koshy.Sh ERRORS
78f28834c1SJoseph KoshyA call to
79f28834c1SJoseph Koshy.Fn pmc_configure_logfile
80f28834c1SJoseph Koshymay fail with the following errors:
81f28834c1SJoseph Koshy.Bl -tag -width Er
82f28834c1SJoseph Koshy.It Bq Er EAGAIN
83f28834c1SJoseph KoshyThe
84f28834c1SJoseph Koshy.Xr hwpmc 4
85f28834c1SJoseph Koshydriver was not able to create a helper process due to system limits
86f28834c1SJoseph Koshybeing reached.
87f28834c1SJoseph Koshy.It Bq Er EBUSY
88f28834c1SJoseph KoshyFunction
89f28834c1SJoseph Koshy.Fn pmc_configure_logfile
90f28834c1SJoseph Koshywas called with a log file already configured.
91f28834c1SJoseph Koshy.It Bq Er EINVAL
92f28834c1SJoseph KoshyFunction
93f28834c1SJoseph Koshy.Fn pmc_configure_logfile
94f28834c1SJoseph Koshywas called with an argument of -1 without a log file being previously
95f28834c1SJoseph Koshyconfigured.
96f28834c1SJoseph Koshy.It Bq Er ENOMEM
97f28834c1SJoseph KoshyThe system encountered a memory shortage when servicing this request.
98f28834c1SJoseph Koshy.El
99f28834c1SJoseph Koshy.Pp
100f28834c1SJoseph KoshyA call to
101f28834c1SJoseph Koshy.Fn pmc_flush_logfile
102f28834c1SJoseph Koshymay fail with the following errors:
103f28834c1SJoseph Koshy.Bl -tag -width Er
104f28834c1SJoseph Koshy.It Bq Er EINVAL
105f28834c1SJoseph KoshyFunction
106f28834c1SJoseph Koshy.Fn pmc_flush_logfile
107f28834c1SJoseph Koshywas called without a log file being previously configured.
108f28834c1SJoseph Koshy.El
109f28834c1SJoseph Koshy.Pp
110f28834c1SJoseph KoshyA call to
111f28834c1SJoseph Koshy.Fn pmc_writelog
112f28834c1SJoseph Koshymay fail with the following errors:
113f28834c1SJoseph Koshy.Bl -tag -width Er
114f28834c1SJoseph Koshy.It Bq Er EINVAL
115f28834c1SJoseph KoshyFunction
116f28834c1SJoseph Koshy.Fn pmc_writelog
117f28834c1SJoseph Koshywas called without a log file being previously configured.
118f28834c1SJoseph Koshy.It Bq Er ENOMEM
119f28834c1SJoseph KoshyThe system encountered a memory shortage when servicing this
120f28834c1SJoseph Koshyrequest.
121f28834c1SJoseph Koshy.El
122f28834c1SJoseph Koshy.Sh SEE ALSO
123f28834c1SJoseph Koshy.Xr pmc 3 ,
124f28834c1SJoseph Koshy.Xr hwpmc 4
125