Copyright (c) 2004, Sun Microsystems, Inc.
All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
cc [ flag... ] file... -lcpc [ library... ] #include <libcpc.h> int cpc_strtoevent(int cpuver, const char *spec, cpc_event_t *event);
char *cpc_eventtostr(cpc_event_t *event);
The cpc_eventtostr() function takes an event and constructs a compact canonical string representation for that event.
Upon successful completion, cpc_eventtostr() returns a pointer to a string. The string returned must be freed by the caller using free(3C). If cpc_eventtostr() fails, a null pointer is returned.
pic0=<eventspec>,pic1=<eventspec> [,sys] [,nouser]
This syntax, which reflects the simplicity of the options available using the %pcr register, forces both counter events to be selected. By default only user events are counted; however, the sys keyword allows system (kernel) events to be counted as well. User event counting can be disabled by specifying the nouser keyword.
The keywords pic0 and pic1 may be omitted; they can be used to resolve ambiguities if they exist.
pic0=<eventspec>,pic1=<eventspec> [,sys[[0|1]]] [,nouser[[0|1]]] [,noedge[[0|1]]] [,pc[[0|1]]]
The syntax and semantics are the same as UltraSPARC, except that is possible to specify whether a particular counter counts user or system events. If unspecified, the specification is presumed to apply to both counters.
There are some additional keywords. The noedge keyword specifies that the counter should count clocks (duration) instead of events. The pc keyword allows the external pin control pins to be set high (defaults to low). When the pin control register is set high, the external pin will be asserted when the associated register overflows. When the pin control register is set low, the external pin will be asserted when the counter has been incremented. The electrical effect of driving the pin is dependent upon how the motherboard manufacturer has chosen to connect it, if it is connected at all.
pic0=<eventspec>,pic1=<eventspec> [,sys[[0|1]]] [,nouser[[0|1]]] [,noedge[[0|1]]] [,pc[[0|1]]] [,inv[[0|1]]] [,int[[0|1]]] [,cmask[0|1]=<maskspec>] [,umask[0|1]=<maskspec>]
This syntax is a straightforward extension of the earlier syntax. The additional inv, int, cmask0, cmask1, umask0, and umask1 keywords allow extended counting semantics. The mask specification is a number between 0 and 255, expressed in hexadecimal, octal or decimal notation.
cpc_event_t event; char *setting = "pic0=EC_ref,pic1=EC_hit"; /* UltraSPARC-specific */ if (cpc_strtoevent(cpuver, setting, &event) != 0) /* can't measure 'setting' on this processor */ else setting = cpc_eventtostr(&event);
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Interface Stability Obsolete |
MT-Level MT-Safe |
These functions are provided as a convenience only. As new processors are usually released asynchronously with software, the library allows the pic0 and pic1 keywords to interpret numeric values specified directly in hexadecimal, octal, or decimal.