2011年3月31日

linux获取系统启动ticks

摘要: 函数原型:clock_t times(struct tms *buf);头文件:#include <sys/times.h>times函数返回自系统启动以来已运行的ticks数,返回值clock_t实际是long int类型。传入参数buf可为空。#include <sys/times.h>#include <stdio.h>int main(){ int ticks = times(NULL); printf("current ticks:%d", ticks); return 0;}至于clock_t代表多长时间,可以用sysconf 阅读全文

posted @ 2011-03-31 16:02 loongwong 阅读(1878) 评论(0) 推荐(0) 编辑

导航