version 1.3, 2007/11/11 15:54:03 |
version 1.8, 2009/02/06 10:11:12 |
|
|
#include "private/gc_priv.h" |
/* $OpenXM: OpenXM_contrib2/asir2000/parse/gc_risa.c,v 1.7 2009/02/06 08:58:28 ohara Exp $ */ |
|
|
|
#include "gc.h" |
#include <time.h> |
#include <time.h> |
|
|
void error(char *); |
void error(char *); |
Line 37 void *Risa_GC_realloc(void *p,size_t d) |
|
Line 39 void *Risa_GC_realloc(void *p,size_t d) |
|
|
|
int get_heapsize() |
int get_heapsize() |
{ |
{ |
return GC_heapsize; |
return GC_get_heap_size(); |
} |
} |
|
|
|
#if !defined(BYTES_TO_WORDS) |
|
#define BYTES_TO_WORDS(x) ((x)>>2) |
|
#endif |
|
|
long get_allocwords() |
long get_allocwords() |
{ |
{ |
#if !defined(GC7) |
size_t n = GC_get_total_bytes(); |
return GC_words_allocd_before_gc + GC_words_allocd; |
return (long)BYTES_TO_WORDS(n); /* bytes to words */ |
#else |
|
long n = GC_bytes_allocd_before_gc + GC_bytes_allocd; |
|
return BYTES_TO_WORDS(n); |
|
#endif |
|
} |
} |
|
|
double gctime; |
static double asir_start_time; |
static double gcstart,asir_start_time; |
|
|
|
double get_clock(), get_rtime(), get_current_time(); |
double get_clock(), get_rtime(), get_current_time(); |
|
|
Line 72 double get_rtime() |
|
Line 73 double get_rtime() |
|
return get_current_time() - asir_start_time; |
return get_current_time() - asir_start_time; |
} |
} |
|
|
#if defined(THINK_C) || defined(__MWERKS__) || defined(VISUAL) || defined(MSWIN32) |
|
|
|
#if defined(VISUAL) |
#if defined(VISUAL) |
#include <windows.h> |
#include <windows.h> |
|
|
Line 129 double get_clock() |
|
Line 128 double get_clock() |
|
} else |
} else |
return get_current_time(); |
return get_current_time(); |
} |
} |
#else |
#elif defined(THINK_C) || defined(__MWERKS__) || defined(MSWIN32) |
double get_current_time() |
double get_current_time() |
{ |
{ |
return get_clock(); |
return get_clock(); |
Line 142 double get_clock() |
|
Line 141 double get_clock() |
|
c = clock(); |
c = clock(); |
return (double)c/(double)CLOCKS_PER_SEC; |
return (double)c/(double)CLOCKS_PER_SEC; |
} |
} |
#endif |
|
|
|
#else |
#else |
#include <sys/time.h> |
#include <sys/time.h> |
|
|
Line 170 double get_clock() |
|
Line 167 double get_clock() |
|
} |
} |
#else |
#else |
|
|
#include <sys/time.h> |
|
#include <sys/resource.h> |
#include <sys/resource.h> |
|
|
double get_clock() |
double get_clock() |
Line 186 double get_clock() |
|
Line 182 double get_clock() |
|
#endif |
#endif |
#endif |
#endif |
|
|
void GC_timerstart() { |
#if !defined(NO_ASIR_GC) |
gcstart = get_clock(); |
extern int GC_free_space_numerator; |
|
|
|
void Risa_GC_get_adj(int *nm, int *dn) { |
|
*nm = GC_free_space_numerator; |
|
*dn = GC_free_space_divisor; |
} |
} |
|
|
void GC_timerstop() { |
void Risa_GC_set_adj(int nm, int dn) { |
gctime += get_clock() - gcstart; |
GC_free_space_numerator = nm; |
|
GC_free_space_divisor = dn; |
} |
} |
|
#else |
|
void Risa_GC_get_adj(int *nm, int *dn) { |
|
*nm = 1; |
|
*dn = GC_free_space_divisor; |
|
} |
|
|
|
void Risa_GC_set_adj(int nm, int dn) { |
|
GC_free_space_divisor = dn/nm; |
|
} |
|
|
|
double GC_get_gctime() { |
|
return 0.0; |
|
} |
|
#endif |
|
|
#if defined(MSWIN32) && !defined(VISUAL) |
#if defined(MSWIN32) && !defined(VISUAL) |
#include <signal.h> |
#include <signal.h> |