[project @ 1998-02-02 17:27:26 by simonm]
[ghc-hetmet.git] / ghc / lib / cbits / getCPUTime.lc
diff --git a/ghc/lib/cbits/getCPUTime.lc b/ghc/lib/cbits/getCPUTime.lc
deleted file mode 100644 (file)
index d3d7b2a..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-%
-% (c) The GRASP/AQUA Project, Glasgow University, 1995
-%
-\subsection[getCPUTime.lc]{getCPUTime Runtime Support}
-
-\begin{code}
-
-#ifndef _AIX
-#define NON_POSIX_SOURCE /*needed for solaris2 only?*/
-#endif
-
-/* how is this to work given we have not read platform.h yet? */
-#ifdef hpux_TARGET_OS
-#define _INCLUDE_HPUX_SOURCE
-#endif
-
-#include "rtsdefs.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#if defined(HAVE_SYS_RESOURCE_H) && ! irix_TARGET_OS
-#include <sys/resource.h>
-#endif
-
-#ifdef HAVE_SYS_TIMEB_H
-#include <sys/timeb.h>
-#endif
-
-#ifdef hpux_TARGET_OS
-#include <sys/syscall.h>
-#define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
-#define HAVE_GETRUSAGE
-#endif
-
-StgInt 
-clockTicks ()
-{
- return (
-#if defined(CLK_TCK)
-    CLK_TCK
-#else
-    sysconf(_SC_CLK_TCK)
-#endif
-    ); 
-}
-
-/* 
- * Our caller wants a pointer to four StgInts,
- * user seconds, user nanoseconds, system seconds, system nanoseconds.
- * Yes, the timerval has unsigned components, but nanoseconds take only
- * 30 bits, and our CPU usage would have to be over 68 years for the 
- * seconds to overflow 31 bits.
- */
-
-StgByteArray
-getCPUTime(StgByteArray cpuStruct)
-{
-    StgInt *cpu=(StgInt *)cpuStruct;
-
-#if defined(HAVE_GETRUSAGE) && ! irix_TARGET_OS
-    struct rusage t;
-
-    getrusage(RUSAGE_SELF, &t);
-    cpu[0] = t.ru_utime.tv_sec;
-    cpu[1] = 1000 * t.ru_utime.tv_usec;
-    cpu[2] = t.ru_stime.tv_sec;
-    cpu[3] = 1000 * t.ru_stime.tv_usec;
-
-#else
-# if defined(HAVE_TIMES)
-    struct tms t;
-#  if defined(CLK_TCK)
-#   define ticks CLK_TCK
-#  else
-    long ticks;
-    ticks = sysconf(_SC_CLK_TCK);
-#  endif
-
-    times(&t);
-    cpu[0] = t.tms_utime / ticks;
-    cpu[1] = (t.tms_utime - cpu[0] * ticks) * (1000000000 / ticks);
-    cpu[2] = t.tms_stime / ticks;
-    cpu[3] = (t.tms_stime - cpu[2] * ticks) * (1000000000 / ticks);
-
-# else
-    return NULL;
-# endif
-#endif
-    return (StgByteArray) cpuStruct;
-}
-
-\end{code}
-