ticks.c

来自「NIST Handwriting OCR Testbed」· C语言 代码 · 共 36 行

C
36
字号
/*# proc: ticks - returns the number of clock cycles (ticks) used by a process.# proc:# proc: ticksPerSec - returns the system definition for HZ, where 1/HZ seconds# proc:               is a tick (HZ = 60).*//* Timing stuff. This ought to be in a library */#include <sys/types.h>#include <sys/times.h>#include <sys/param.h>/* ticks, Jim Blue, 13-Nov-90 15:41 *		Get number of ticks used by process. */unsigned longticks(){	struct tms buff;		times(&buff);	return buff.tms_utime;}/* ticksPerSec 13-Nov-90 15:41 *		Get number of ticks per second reported by times(). */intticksPerSec(){	return HZ;			/* from param.h */}

⌨️ 快捷键说明

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