home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / program / funnel / clock.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-23  |  5.0 KB  |  108 lines

  1. /*##############################################################################
  2.  
  3. FUNNNELWEB COPYRIGHT
  4. ====================
  5. FunnelWeb is a literate-programming macro preprocessor.
  6.  
  7. Copyright (C) 1992 Ross N. Williams.
  8.  
  9.    Ross N. Williams
  10.    ross@spam.adelaide.edu.au
  11.    16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  12.  
  13. This program is free software; you can redistribute it and/or modify
  14. it under the terms of Version 2 of the GNU General Public License as
  15. published by the Free Software Foundation.
  16.  
  17. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  18. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  19. See Version 2 of the GNU General Public License for more details.
  20.  
  21. You should have received a copy of Version 2 of the GNU General Public
  22. License along with this program. If not, you can FTP the license from
  23. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  24. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. Section 2a of the license requires that all changes to this file be
  27. recorded prominently in this file. Please record all changes here.
  28.  
  29. Programmers:
  30.    RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  31.  
  32. Changes:
  33.    07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  34.  
  35. ##############################################################################*/
  36.  
  37.  
  38. /******************************************************************************/
  39. /*                                  CLOCK.H                                   */
  40. /******************************************************************************/
  41. /*                                                                            */
  42. /* This package implements a clock abstraction that is used to generate       */
  43. /* timing statistics which are useful for performance tuning. The package     */
  44. /* allows the measurement of both real and CPU time. This package gets its    */
  45. /* raw information from the tim_cpu() and tim_real() functions of the machine */
  46. /* dependent module "machin".                                                 */
  47. /*                                                                            */
  48. /******************************************************************************/
  49.  
  50. /* Ensure that the body of this header file is included at most once.         */
  51. #ifndef DONE_CLOCK
  52. #define DONE_CLOCK
  53.  
  54. /******************************************************************************/
  55.  
  56. #include "style.h"
  57.  
  58. /******************************************************************************/
  59.  
  60. /* The following clock type is supposed to be an ADT so don't frob any of its */
  61. /* fields manually!                                                           */
  62. typedef struct
  63.   {
  64.    ulong ck_mhead; /* Magic number helps detect corruptions.                  */
  65.    bool  ck_run;   /* TRUE iff the clock is running.                          */
  66.    float ck_csum;  /* Accumulated CPU time.                                   */
  67.    float ck_rsum;  /* Accumulated real time.                                  */
  68.    float ck_csta;  /* ck_run => CPU  time when clock was started.             */
  69.    float ck_rsta;  /* ck_run => Real time when clock was started.             */
  70.    ulong ck_mtail; /* Magic number helps detect corruptions.                  */
  71.   } ck_t;
  72.  
  73. typedef ck_t *p_ck_t;
  74.  
  75. /******************************************************************************/
  76.  
  77. EXPORT void ck_ini P_((p_ck_t));
  78. /* Initializes the clock. After this call, the argument clock will be in the  */
  79. /* STOPPED state and all its registers will be zero.  A clock must be         */
  80. /* initialized before any other operations are performed on it.               */
  81.  
  82. EXPORT void ck_start P_((p_ck_t));
  83. /* Changes the clock from the STOPPED state to the RUNNING state. Starts      */
  84. /* accumulating real time and CPU time on its registers.                      */
  85. /* Raises an error if the clock is not in the STOPPED state.                  */
  86.  
  87. EXPORT void ck_stop P_((p_ck_t));
  88. /* Changes the clock from the RUNNING state to the STOPPED state. Stops       */
  89. /* accumulating real time and CPU time on its registers.                      */
  90. /* Raises an error if the clock is not in the RUNNING state.                  */
  91.  
  92. EXPORT float ck_cpu P_((p_ck_t));
  93. /* Returns the number of seconds of CPU time accumulated on the clock.        */
  94. /* Raises an error if the clock is not in the STOPPED state.                  */
  95.  
  96. EXPORT float ck_real P_((p_ck_t));
  97. /* Returns the number of seconds of real time accumulated on the clock.       */
  98. /* Raises an error if the clock is not in the STOPPED state.                  */
  99.  
  100. /******************************************************************************/
  101.  
  102. /* For #ifndef preventing multiple inclusion of the body of this header file. */
  103. #endif
  104.  
  105. /******************************************************************************/
  106. /*                              End of CLOCK.H                                */
  107. /******************************************************************************/
  108.