⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.4.t

📁 早期freebsd实现
💻 T
字号:
.\" Copyright (c) 1983, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)1.4.t	8.1 (Berkeley) 6/8/93.\".sh "Timers.NH 3Real time.PPThe system's notion of the current Greenwich time and the current timezone is set and returned by the call by the calls:.DS#include <sys/time.h>settimeofday(tvp, tzp);struct timeval *tp;struct timezone *tzp;gettimeofday(tp, tzp);result struct timeval *tp;result struct timezone *tzp;.DEwhere the structures are defined in \fI<sys/time.h>\fP as:.DS._fstruct timeval {	long	tv_sec;	/* seconds since Jan 1, 1970 */	long	tv_usec;	/* and microseconds */};struct timezone {	int	tz_minuteswest;	/* of Greenwich */	int	tz_dsttime;	/* type of dst correction to apply */};.DEThe precision of the system clock is hardware dependent.Earlier versions of UNIX contained only a 1-second resolution versionof this call, which remains as a library routine:.DStime(tvsec)result long *tvsec;.DEreturning only the tv_sec field from the \fIgettimeofday\fP call..NH 3Interval time.PPThe system provides each process with three interval timers,defined in \fI<sys/time.h>\fP:.DS._d#define	ITIMER_REAL	0	/* real time intervals */#define	ITIMER_VIRTUAL	1	/* virtual time intervals */#define	ITIMER_PROF	2	/* user and system virtual time */.DEThe ITIMER_REAL timer decrementsin real time.  It could be used by a library routine tomaintain a wakeup service queue.  A SIGALRM signal is deliveredwhen this timer expires..PPThe ITIMER_VIRTUAL timer decrements in process virtual time.It runs only when the process is executing.  A SIGVTALRM signalis delivered when it expires..PPThe ITIMER_PROF timer decrements both in process virtual time and whenthe system is running on behalf of the process.It is designed to be used by processes to statistically profiletheir execution.A SIGPROF signal is delivered when it expires..PPA timer value is defined by the \fIitimerval\fP structure:.DS._fstruct itimerval {	struct	timeval it_interval;	/* timer interval */	struct	timeval it_value;	/* current value */};.DEand a timer is set or read by the call:.DSgetitimer(which, value);int which; result struct itimerval *value;setitimer(which, value, ovalue);int which; struct itimerval *value; result struct itimerval *ovalue;.DEThe third argument to \fIsetitimer\fP specifies an optional structureto receive the previous contents of the interval timer.A timer can be disabled by specifying a timer value of 0..PPThe system rounds argument timer intervals to be not less than theresolution of its clock.  This clock resolution can be determinedby loading a very small value into a timer and reading the timer back tosee what value resulted..PPThe \fIalarm\fP system call of earlier versions of UNIX is providedas a library routine using the ITIMER_REAL timer.  The processprofiling facilities of earlier versions of UNIXremain becauseit is not always possible to guaranteethe automatic restart of system calls after receipt of a signal.The \fIprofil\fP call arranges for the kernel to begin gatheringexecution statistics for a process:.DSprofil(buf, bufsize, offset, scale);result char *buf; int bufsize, offset, scale;.DEThis begins sampling of the program counter, with statistics maintainedin the user-provided buffer.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -