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

📄 t_stamp.c

📁 CCSM Research Tools: Community Atmosphere Model (CAM)
💻 C
字号:
/*** $Id: t_stamp.c,v 1.1 2001/04/19 00:03:08 rosinski Exp $*/#include <sys/time.h>     /* gettimeofday */ #include <sys/times.h>    /* times */#include <unistd.h>       /* gettimeofday */#include "gpt.h"/*** t_stamp: Compute timestamp of usr, sys, and wallclock time (seconds)**** Output arguments:**   wall: wallclock**   usr:  user time**   sys:  system time**** Return value: 0 (success) or -1 (failure)*/int t_stamp (double *wall, double *usr, double *sys){  struct timeval tp;         /* argument to gettimeofday */  struct tms buf;            /* argument to times */  *usr = 0;  *sys = 0;  if (times (&buf) == -1)    return t_error ("t_stamp: times() failed. Timing bogus\n");  *usr = buf.tms_utime / (double) ticks_per_sec;  *sys = buf.tms_stime / (double) ticks_per_sec;  gettimeofday (&tp, NULL);  *wall = tp.tv_sec + 1.e-6*tp.tv_usec;  return 0;}

⌨️ 快捷键说明

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