diff options
author | Richard Lowe <richlowe@richlowe.net> | 2011-03-14 14:05:30 -0400 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2011-03-14 14:05:30 -0400 |
commit | c10c16dec587a0662068f6e2991c29ed3a9db943 (patch) | |
tree | f414286f4bba41d75683ed4fbbaa6bfa4bf7fabd /usr/src/man/man2/pcsample.2 | |
parent | 68caef18a23a498d9e3017b983562c0f4fd8ab23 (diff) | |
download | illumos-joyent-c10c16dec587a0662068f6e2991c29ed3a9db943.tar.gz |
243 system manual pages should live with the software
Reviewed by: garrett@nexenta.com
Reviewed by: gwr@nexenta.com
Reviewed by: trisk@opensolaris.org
Approved by: gwr@nexenta.com
--HG--
extra : rebase_source : 0c599d0bec0dc8865fbba67721a7a6cd6b1feefb
Diffstat (limited to 'usr/src/man/man2/pcsample.2')
-rw-r--r-- | usr/src/man/man2/pcsample.2 | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/usr/src/man/man2/pcsample.2 b/usr/src/man/man2/pcsample.2 new file mode 100644 index 0000000000..a2f08a6acb --- /dev/null +++ b/usr/src/man/man2/pcsample.2 @@ -0,0 +1,93 @@ +'\" te +.\" Copyright (c) 1998, 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] +.TH pcsample 2 "10 Mar 1998" "SunOS 5.11" "System Calls" +.SH NAME +pcsample \- program execution time profile +.SH SYNOPSIS +.LP +.nf +#include <pcsample.h> + +\fBlong\fR \fBpcsample\fR(\fBuintptr_t\fR \fIsamples[]\fR, \fBlong\fR \fInsamples\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBpcsample()\fR function provides CPU-use statistics by profiling the +amount of \fBCPU\fR time expended by a program. +.sp +.LP +For profiling dynamically-linked programs and 64-bit programs, it is superior +to the \fBprofil\fR(2) function, which assumes that the entire program is +contained in a small, contiguous segment of the address space, divides this +segment into "bins", and on each clock tick increments the counter in the bin +where the program is currently executing. With shared libraries creating +discontinuous program segments spread throughout the address space, and with +64-bit address spaces so large that the size of "bins" would be measured in +megabytes, the \fBprofil()\fR function is of limited value. +.sp +.LP +The \fBpcsample()\fR function is passed an array \fIsamples\fR containing +\fInsamples\fR pointer-sized elements. During program execution, the kernel +samples the program counter of the process, storing unadulterated values in the +array on each clock tick. The kernel stops writing to the array when it is +full, which occurs after \fInsamples\fR / \fBHZ\fR seconds of process virtual +time. The \fBHZ\fR value is obtained by invoking the call +\fBsysconf(_SC_CLK_TCK)\fR. See \fBsysconf\fR(3C). +.sp +.LP +The sampling can be stopped by a subsequent call to \fBpcsample()\fR with the +\fInsamples\fR argument set to 0. Like \fBprofil()\fR, sampling continues +across a call to \fBfork\fR(2), but is disabled by a call to one of the +\fBexec\fR family of functions (see \fBexec\fR(2)). It is also disabled if an +update of the \fIsamples\fR\fB[\|]\fR array causes a memory fault. +.SH RETURN VALUES +.sp +.LP +The \fBpcsample()\fR function always returns \fB0\fR the first time it is +called. On subsequent calls, it returns the number of samples that were stored +during the previous invocation. If \fInsamples\fR is invalid, it returns +\fB\(mi1\fR and sets \fBerrno\fR to indicate the error. +.SH ERRORS +.sp +.LP +The \fBpcsample()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBEINVAL\fR\fR +.ad +.RS 10n +.rt +The value of \fInsamples\fR is not valid. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +MT-LevelAsync-Signal-Safe +_ +Interface StabilityStable +.TE + +.SH SEE ALSO +.sp +.LP +\fBexec\fR(2), \fBfork\fR(2), \fBprofil\fR(2), \fBsysconf\fR(3C), +\fBattributes\fR(5) |