1677d4530SJoseph Koshy.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. 2677d4530SJoseph Koshy.\" 3677d4530SJoseph Koshy.\" Redistribution and use in source and binary forms, with or without 4677d4530SJoseph Koshy.\" modification, are permitted provided that the following conditions 5677d4530SJoseph Koshy.\" are met: 6677d4530SJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright 7677d4530SJoseph Koshy.\" notice, this list of conditions and the following disclaimer. 8677d4530SJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright 9677d4530SJoseph Koshy.\" notice, this list of conditions and the following disclaimer in the 10677d4530SJoseph Koshy.\" documentation and/or other materials provided with the distribution. 11677d4530SJoseph Koshy.\" 12026dbd29SChristian Brueffer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13026dbd29SChristian Brueffer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14026dbd29SChristian Brueffer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15026dbd29SChristian Brueffer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16026dbd29SChristian Brueffer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17026dbd29SChristian Brueffer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18026dbd29SChristian Brueffer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19026dbd29SChristian Brueffer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20026dbd29SChristian Brueffer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21026dbd29SChristian Brueffer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22026dbd29SChristian Brueffer.\" SUCH DAMAGE. 23677d4530SJoseph Koshy.\" 24677d4530SJoseph Koshy.Dd November 25, 2007 25677d4530SJoseph Koshy.Dt PMC_READ 3 26aa12cea2SUlrich Spörlein.Os 27677d4530SJoseph Koshy.Sh NAME 28677d4530SJoseph Koshy.Nm pmc_read , 29677d4530SJoseph Koshy.Nm pmc_rw , 30*79a9c323SEnji Cooper.Nm pmc_write 31abb0a58eSJoseph Koshy.Nd read and write hardware performance counters 32677d4530SJoseph Koshy.Sh LIBRARY 33677d4530SJoseph Koshy.Lb libpmc 34677d4530SJoseph Koshy.Sh SYNOPSIS 35677d4530SJoseph Koshy.In pmc.h 36677d4530SJoseph Koshy.Ft int 37677d4530SJoseph Koshy.Fn pmc_read "pmc_id_t pmc" "pmc_value_t *value" 38677d4530SJoseph Koshy.Ft int 39677d4530SJoseph Koshy.Fn pmc_rw "pmc_id_t pmc" "pmc_value_t newvalue" "pmc_value_t *oldvaluep" 40677d4530SJoseph Koshy.Ft int 41677d4530SJoseph Koshy.Fn pmc_write "pmc_id_t pmc" "pmc_value_t value" 42677d4530SJoseph Koshy.Sh DESCRIPTION 43677d4530SJoseph KoshyThese functions read and write the current value of a PMC. 44677d4530SJoseph Koshy.Pp 45677d4530SJoseph KoshyFunction 46677d4530SJoseph Koshy.Fn pmc_read 47c2025a76SJoel Dahlwill read the current value of the PMC specified by argument 48677d4530SJoseph Koshy.Fa pmc 49677d4530SJoseph Koshyand write it to the location specified by argument 50677d4530SJoseph Koshy.Fa value . 51677d4530SJoseph Koshy.Pp 52677d4530SJoseph KoshyFunction 53677d4530SJoseph Koshy.Fn pmc_write 54677d4530SJoseph Koshywill set the current value of the PMC specified by argument 55677d4530SJoseph Koshy.Fa pmc 56677d4530SJoseph Koshyto the value specified by argument 57677d4530SJoseph Koshy.Fa value . 58677d4530SJoseph Koshy.Pp 59677d4530SJoseph KoshyFunction 60677d4530SJoseph Koshy.Fn pmc_rw 61677d4530SJoseph Koshycombines a read and a write into a single atomic operation. 62677d4530SJoseph Koshy.Pp 63abb0a58eSJoseph KoshyFor write operations the PMC should be a quiescent state. 64677d4530SJoseph Koshy.Sh RETURN VALUES 65677d4530SJoseph Koshy.Rv -std 66677d4530SJoseph Koshy.Sh ERRORS 67677d4530SJoseph KoshyA call to these functions may fail with the following errors: 68677d4530SJoseph Koshy.Bl -tag -width Er 69677d4530SJoseph Koshy.It Bq Er EBUSY 70677d4530SJoseph KoshyA write operation specified a currently running PMC. 71677d4530SJoseph Koshy.It Bq Er EINVAL 72677d4530SJoseph KoshyArgument 73677d4530SJoseph Koshy.Fa pmc 74677d4530SJoseph Koshyspecified a PMC not in a readable state. 75677d4530SJoseph Koshy.It Bq Er EINVAL 76677d4530SJoseph KoshyThe PMC specified by argument 77677d4530SJoseph Koshy.Fa pmc 78677d4530SJoseph Koshywas not owned by the current process. 79677d4530SJoseph Koshy.El 80677d4530SJoseph Koshy.Sh SEE ALSO 81677d4530SJoseph Koshy.Xr pmc 3 , 82677d4530SJoseph Koshy.Xr hwpmc 4 83