pcsample man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

PCSAMPLE(2)							   PCSAMPLE(2)

NAME
       pcsample - program execution time profile

SYNOPSIS
       #include <pcsample.h>

       long pcsample(uintptr_t samples[], long nsamples);

DESCRIPTION
       The  pcsample()	function  provides CPU-use statistics by profiling the
       amount of CPU time expended by a program.

       For profiling dynamically-linked programs and 64-bit  programs,	it  is
       superior	 to the profil(2) function, which assumes that the entire pro‐
       gram 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 profil()
       function is of limited value.

       The pcsample() function is passed an array samples containing  nsamples
       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 nsamples / HZ seconds  of  process  virtual
       time.	The    HZ   value   is	 obtained   by	 invoking   the	  call
       sysconf(_SC_CLK_TCK). See sysconf(3C).

       The sampling can be stopped by a subsequent call to pcsample() with the
       nsamples argument set to 0.  Like profil(), sampling continues across a
       call to fork(2), but is disabled by a call to one of the exec family of
       functions  (see	exec(2)). It is also disabled if an update of the sam‐
       ples[] array causes a memory fault.

RETURN VALUES
       The pcsample() function always returns 0 the first time it  is  called.
       On  subsequent calls, it returns the number of samples that were stored
       during the previous invocation. If nsamples is invalid, it  returns  −1
       and sets errno to indicate the error.

ERRORS
       The pcsample() function will fail if:

       EINVAL
		 The value of nsamples is not valid.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬───────────────────┐
       │  ATTRIBUTE TYPE    │  ATTRIBUTE VALUE	│
       ├────────────────────┼───────────────────┤
       │MT-Level	    │ Async-Signal-Safe │
       ├────────────────────┼───────────────────┤
       │Interface Stability │ Stable		│
       └────────────────────┴───────────────────┘

SEE ALSO
       exec(2), fork(2), profil(2), sysconf(3C), attributes(5)

				 Mar 10, 1998			   PCSAMPLE(2)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net