version 1.4, 2005/11/12 08:10:56 |
version 1.10, 2015/08/09 11:46:43 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/time.c,v 1.3 2000/08/22 05:04:00 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/time.c,v 1.9 2015/08/08 14:19:41 fujimoto Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
|
#include <limits.h> |
|
|
void Ptime(), Pcputime(), Pcurrenttime(), Ptstart(), Ptstop(); |
void Ptime(), Pcputime(), Pcurrenttime(), Ptstart(), Ptstop(); |
|
void Pdcurrenttime(); |
|
|
struct ftab time_tab[] = { |
struct ftab time_tab[] = { |
{"time",Ptime,0}, |
{"time",Ptime,0}, |
{"cputime",Pcputime,1}, |
{"cputime",Pcputime,1}, |
{"currenttime",Pcurrenttime,0}, |
{"currenttime",Pcurrenttime,0}, |
|
{"dcurrenttime",Pdcurrenttime,0}, |
{"tstart",Ptstart,0}, |
{"tstart",Ptstart,0}, |
{"tstop",Ptstop,0}, |
{"tstop",Ptstop,0}, |
{0,0,0}, |
{0,0,0}, |
|
|
t = (int)get_current_time(); STOQ(t,*rp); |
t = (int)get_current_time(); STOQ(t,*rp); |
} |
} |
|
|
|
void Pdcurrenttime(rp) |
|
Real *rp; |
|
{ |
|
double t; |
|
|
|
t = get_current_time(); MKReal(t,*rp); |
|
} |
|
|
void Ptstart(rp) |
void Ptstart(rp) |
pointer *rp; |
pointer *rp; |
{ |
{ |
|
|
Real re,rg,rr; |
Real re,rg,rr; |
NODE a,b,w,r; |
NODE a,b,w,r; |
Q words; |
Q words; |
long t; |
size_t t; |
|
unsigned int u,l; |
|
N n; |
double rtime; |
double rtime; |
double get_rtime(); |
double get_rtime(); |
|
|
rtime = get_rtime(); MKReal(rtime,rr); |
rtime = get_rtime(); MKReal(rtime,rr); |
t = get_allocwords(); |
t = get_allocwords(); |
#if defined(LONG_IS_64BIT) |
if(sizeof(size_t)>sizeof(int)) { |
u = t>>32; l = t&(0xffffffff); |
u = t>>(sizeof(int)*CHAR_BIT); l = t&(~0); |
if ( !u ) STOQ(l,words); |
if ( !u ) STOQ(l,words); |
else { |
else { |
n = NALLOC(2); PL(n)=2; BD(n)[0] = l; BD(n)[1] = u; |
n = NALLOC(2); PL(n)=2; BD(n)[0] = l; BD(n)[1] = u; |
NTOQ(n,1,words); |
NTOQ(n,1,words); |
|
} |
|
}else { |
|
STOQ(t,words); |
} |
} |
#else |
|
STOQ(t,words); |
|
#endif |
|
get_eg(&eg); MKReal(eg.exectime,re); MKReal(eg.gctime,rg); |
get_eg(&eg); MKReal(eg.exectime,re); MKReal(eg.gctime,rg); |
MKNODE(r,rr,0); MKNODE(w,words,r); MKNODE(a,rg,w); MKNODE(b,re,a); |
MKNODE(r,rr,0); MKNODE(w,words,r); MKNODE(a,rg,w); MKNODE(b,re,a); |
MKLIST(*listp,b); |
MKLIST(*listp,b); |