Changeset ea986d in git


Ignore:
Timestamp:
Mar 27, 1997, 9:26:06 PM (27 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a6815bc36646e83a9fa1fd030f6cedf55e4441b5
Parents:
34ab5de9eb181b0ef28b8bbee6004e8363496a04
Message:
*** empty log message ***


git-svn-id: file:///usr/local/Singular/svn/trunk@122 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/subexpr.cc

    r34ab5de rea986d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 static char rcsid[] = "$Header: /exports/cvsroot-2/cvsroot/Singular/subexpr.cc,v 1.8 1997-03-27 12:42:50 Singular Exp $";
     4static char rcsid[] = "$Header: /exports/cvsroot-2/cvsroot/Singular/subexpr.cc,v 1.9 1997-03-27 20:26:03 obachman Exp $";
    55/* $Log: not supported by cvs2svn $
     6// Revision 1.8  1997/03/27  12:42:50  Singular
     7// * hannes: added rString, sleftv->String for RING_CMD, QRING_CMD,
     8//             string(ring), string(qring) in iparith.cc
     9//             TEST_OPT_PROT for hilbert driven std
     10//
    611// Revision 1.7  1997/03/26  17:07:27  Singular
    712// * hannes/wichmann: added fglm
     
    318323      case VCOLMAX:
    319324      case VTIMER:
     325#ifdef HAVE_RTIMER
     326        case VRTIMER:
     327#endif         
    320328      case VOICE:
    321329      case VMAXDEG:
     
    352360      case VCOLMAX:
    353361      case VTIMER:
     362#ifdef HAVE_RTIMER
     363        case VRTIMER:
     364#endif         
    354365      case VOICE:
    355366      case VMAXDEG:
     
    708719      case VCOLMAX:
    709720      case VTIMER:
     721#ifdef HAVE_RTIMER
     722        case VRTIMER:
     723#endif         
    710724      case VOICE:
    711725      case VMAXDEG:
     
    816830      case VCOLMAX:    return (void *)colmax;
    817831      case VTIMER:     return (void *)getTimer();
     832#ifdef HAVE_RTIMER
     833      case VRTIMER:    return (void *)getRTimer();
     834#endif
    818835      case VOICE:      return (void *)(myynest+1);
    819836      case VMAXDEG:    return (void *)Kstd1_deg;
  • Singular/tesths.cc

    r34ab5de rea986d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 static char rcsid[] = "$Id: tesths.cc,v 1.3 1997-03-26 17:07:28 Singular Exp $";
     4static char rcsid[] = "$Id: tesths.cc,v 1.4 1997-03-27 20:26:04 obachman Exp $";
    55/*
    66* ABSTRACT - initialize SINGULARs components, run Script and start SHELL
     
    2727#include "version.h"
    2828#include "silink.h"
     29#include "timer.h"
    2930
    3031/*0 implementation*/
     
    5657  for (;(argc > 1) && (!feBatch); --argc, ++argv)
    5758  {
    58     if ((argv[1][0] != '-') ||(argv[1][1] == '-'))
    59       break;
    60     for (i=1;argv[1][i]!='\0';i++)
     59    if (strcmp(argv[1], "-m") == 0)
    6160    {
    62       switch (argv[1][i])
    63       {
    64         case 'V':
    65         case 'v':{
    66                   printf("Singular %s%c %s(%d) %s %s\n",
    67                           S_VERSION1,(VERSION%10)+'a',S_VERSION2,
    68                           S_SUBVERSION,__DATE__,__TIME__);
    69                   printf("with ");
     61      {
     62        if (argc > 2)
     63        {
     64          char* ptr = NULL;
     65          double mintime = strtod(argv[2], &ptr);
     66          if (errno != ERANGE && ptr != argv[2])
     67          {
     68            argc--;
     69            argv++;
     70            SetMinDisplayTime(mintime);
     71          }
     72          else
     73            printf("Can not convert %s to a float\n", argv[2]);
     74        }
     75        else
     76        {
     77          printf("Need a float to set mintime");
     78        }
     79      }
     80    }
     81    else if (strcmp(argv[1], "-d") == 0)
     82    {
     83      if (argc > 2)
     84      {
     85        char* ptr = NULL;
     86        long res = strtol(argv[2], &ptr, 10);
     87        if (errno != ERANGE && ptr != argv[2])
     88        {
     89          argc--;
     90          argv++;
     91          SetTimerResolution(res);
     92        }
     93        else
     94          printf("Can not convert %s to an integer\n", argv[2]);
     95      }
     96      else
     97      {
     98        printf("Need an integer to set timer resolution");
     99      }
     100    }
     101    else
     102    {
     103   
     104      if ((argv[1][0] != '-') ||(argv[1][1] == '-'))
     105        break;
     106      for (i=1;argv[1][i]!='\0';i++)
     107      {
     108        switch (argv[1][i])
     109        {
     110            case 'V':
     111            case 'v':{
     112              printf("Singular %s%c %s(%d) %s %s\n",
     113                     S_VERSION1,(VERSION%10)+'a',S_VERSION2,
     114                     S_SUBVERSION,__DATE__,__TIME__);
     115              printf("with ");
    70116#ifdef HAVE_LIBFACTORY
    71                   printf("factory,");
     117              printf("factory,");
    72118#endif
    73119#ifdef HAVE_LIBFACTORY
    74                   printf("fac(p),");
     120              printf("fac(p),");
    75121#endif
    76122#ifdef SRING
    77                   printf("super algebra,");
     123              printf("super algebra,");
    78124#endif
    79125#ifdef DRING
    80                   printf("Weyl algebra,");
     126              printf("Weyl algebra,");
    81127#endif
    82128#ifdef HAVE_GMP
    83                   printf("GMP,");
     129              printf("GMP,");
    84130#endif
    85131#ifdef HAVE_DBM
    86                   printf("DBM,");
     132              printf("DBM,");
    87133#endif
    88134#ifdef HAVE_MPSR
    89                   printf("MP,");
     135              printf("MP,");
    90136#endif
    91137#ifdef HAVE_READLINE
    92                   printf("RL,");
     138              printf("RL,");
    93139#endif
    94140#ifdef HAVE_FEREAD
    95                   printf("SRL,");
     141              printf("SRL,");
    96142#endif
    97143#ifdef TEST
    98                   printf("TESTs,");
     144              printf("TESTs,");
    99145#endif
    100146#if YYDEBUG
    101                   printf("YYDEBUG,");
     147              printf("YYDEBUG,");
    102148#endif
    103149#ifdef MDEBUG
    104                   printf("MDEBUG=%d,",MDEBUG);
     150              printf("MDEBUG=%d,",MDEBUG);
    105151#endif
    106152#ifndef __OPTIMIZE__
    107                   printf("-g,");
    108 #endif
    109                   printf("random=%d\n",siRandomStart);
     153              printf("-g,");
     154#endif
     155              printf("random=%d\n",siRandomStart);
    110156#ifdef MSDOS
    111                   char *p=getenv("SPATH");
    112 #else
    113                   char *p=getenv("SingularPath");
    114 #endif
    115                   if (p!=NULL)
    116                     printf("search path:%s\n\n",p);
    117                   else
    118                     printf("standard search path:/usr/local/Singular\n\n");
    119                   break;
    120                  }
    121         case 'e': if ((argv[1][i+1]>'0') && (argv[1][i+1]<='9'))
    122                   {
    123                     i++;
    124                     si_echo = (int)(argv[1][i] - '0');
    125                   }
    126                   else si_echo = 2;
    127                   break;
    128         case 'r': siRandomStart = 0;
    129                   while((argv[1][i+1]>='0') && (argv[1][i+1]<='9'))
    130                   {
    131                     i++;
    132                     siRandomStart = siRandomStart*10+(int)(argv[1][i] - '0');
    133                   }
     157              char *p=getenv("SPATH");
     158#else
     159              char *p=getenv("SingularPath");
     160#endif
     161              if (p!=NULL)
     162                printf("search path:%s\n\n",p);
     163              else
     164                printf("standard search path:/usr/local/Singular\n\n");
     165              break;
     166            }
     167            case 'e': if ((argv[1][i+1]>'0') && (argv[1][i+1]<='9'))
     168            {
     169              i++;
     170              si_echo = (int)(argv[1][i] - '0');
     171            }
     172            else si_echo = 2;
     173            break;
     174            case 'r': siRandomStart = 0;
     175              while((argv[1][i+1]>='0') && (argv[1][i+1]<='9'))
     176              {
     177                i++;
     178                siRandomStart = siRandomStart*10+(int)(argv[1][i] - '0');
     179              }
    134180#ifdef buildin_rand
    135                   siSeed=siRandomStart;
    136 #else
    137                   srand((unsigned int)siRandomStart);
    138 #endif
    139                   break;
    140         case 'x': tclmode=TRUE;
    141                   break;
     181              siSeed=siRandomStart;
     182#else
     183              srand((unsigned int)siRandomStart);
     184#endif
     185              break;
     186            case 'x': tclmode=TRUE;
     187              break;
    142188#ifdef HAVE_MPSR
    143         case 'b': feBatch=TRUE;
    144 #endif
    145         case 'q': verbose &= ~(Sy_bit(0)|Sy_bit(V_LOAD_LIB));
    146                   break;
    147         case 't':
    148                   #ifdef HAVE_FEREAD
    149                   fe_use_fgets=TRUE;
    150                   #endif
    151                   break;
    152         default : printf("Unknown option -%c\n",argv[1][i]);
    153         printf("Usage: %s [-bteqvx] [file]\n",thisfile);
    154         exit(1);
     189            case 'b': feBatch=TRUE;
     190#endif
     191            case 'q': verbose &= ~(Sy_bit(0)|Sy_bit(V_LOAD_LIB));
     192              break;
     193            case 't':
     194#ifdef HAVE_FEREAD
     195              fe_use_fgets=TRUE;
     196#endif
     197              break;
     198            default : printf("Unknown option -%c\n",argv[1][i]);
     199              printf("Usage: %s [-bteqvx] [file]\n",thisfile);
     200              exit(1);
     201        }
    155202      }
    156203    }
    157204  }
     205 
    158206
    159207  /*. say hello */
  • Singular/timer.cc

    r34ab5de rea986d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 static char rcsid[] = "$Id: timer.cc,v 1.2 1997-03-24 14:26:05 Singular Exp $";
     4static char rcsid[] = "$Id: timer.cc,v 1.3 1997-03-27 20:26:04 obachman Exp $";
    55/*
    66*  ABSTRACT - get the computing time
    77*/
     8
     9#include "mod2.h"
    810
    911//the mpw timer is quite the same as the dos timer:
     
    1315
    1416int        timerv = 0;
     17#ifdef TIME_SEC
     18static double timer_resolution = 1.0;
     19#else
     20static double timer_resolution = 10.0;
     21#endif
     22
     23static double mintime = 0.5;
     24
     25void SetTimerResolution(int res)
     26{
     27  timer_resolution = (double) res;
     28}
     29
     30void SetMinDisplayTime(double mtime)
     31{
     32  mintime = mtime;
     33}
     34
    1535
    1636#ifndef MSDOS
     
    4363#endif
    4464
    45 #include "mod2.h"
    4665#include "timer.h"
    4766#include "febase.h"
    48 #define HALF_SEC 30
    4967/*3
    5068* the start time of the timer
     
    83101  curr = t_rec.tms_utime - siStartTime;
    84102
    85 #ifdef TIME_SEC
    86   double f =  ((double)curr)/ (double)HZ;
     103  double f =  ((double)curr) * timer_resolution / (double)HZ;
    87104  return (int)(f+0.5);
    88 #else
    89   return (int)curr;
    90 #endif
    91105}
    92106
    93107/*2
    94108* stops timer, writes string s and the time since last call of startTimer
    95 * if this time is > 0.5 sec
     109* if this time is > mintime sec
    96110*/
    97111void writeTime(void* v)
     
    101115  times(&t_rec);
    102116  curr = t_rec.tms_utime - startl;
    103   if (curr < (clock_t)HALF_SEC) return;
    104 
    105   double f =  ((double)curr)/ (double)HZ;
    106   Print("//%s %.2f sec\n" ,v ,f);
    107 }
     117
     118  double f =  ((double)curr) / (double)HZ;
     119  if (f > mintime)
     120    Print("//%s %.2f sec\n" ,v ,f);
     121}
     122
     123#ifdef HAVE_RTIMER
     124#include <sys/time.h>
     125/*0 Real timer implementation*/
     126int rtimerv = 0;
     127static struct timeval  startRl;
     128static struct timeval  siStartRTime;
     129static struct timezone tzp;
     130void initRTimer()
     131{
     132  gettimeofday(&startRl, &tzp);
     133}
     134
     135void startRTimer()
     136{
     137  gettimeofday(&siStartRTime, &tzp);
     138}
     139
     140/*2
     141* returns the time since a fixed point in resolutions
     142*/
     143int getRTimer()
     144{
     145  struct timeval now;
     146 
     147  gettimeofday(&now, &tzp);
     148
     149  if (startRl.tv_usec > now.tv_usec)
     150  {
     151    now.tv_usec += 1000000;
     152    now.tv_sec --;
     153  }
     154 
     155  double f =((double)  (now.tv_sec - startRl.tv_sec))*timer_resolution +
     156    ((double) (now.tv_usec - startRl.tv_usec))*timer_resolution /
     157    (double) 1000000;
     158 
     159  return (int)(f+0.5);
     160}
     161
     162/*2
     163* stops timer, writes string s and the time since last call of startTimer
     164* if this time is > mintime
     165*/
     166void writeRTime(void* v)
     167{
     168  struct timeval now;
     169
     170  gettimeofday(&now, &tzp);
     171
     172  if (siStartRTime.tv_usec > now.tv_usec)
     173  {
     174    now.tv_usec += 1000000;
     175    now.tv_sec --;
     176  }
     177 
     178  double f =((double)  (now.tv_sec - siStartRTime.tv_sec)) +
     179    ((double) (now.tv_usec - siStartRTime.tv_usec)) /
     180    (double) 1000000;
     181
     182  if (f > mintime)
     183   Print("//%s %.2f sec \n" ,v ,f);
     184}
     185#endif
     186
    108187#else
    109188
     
    147226{
    148227  clock_t curr = clock() - siStartTime;
    149 #ifdef TIME_SEC
    150   double f =  ((double)curr)/ (double)CLOCKS_PER_SEC;
     228  double f =  ((double)curr)*timer_resolution/ (double)CLOCKS_PER_SEC;
    151229  return (int)(f+0.5);
    152 #else
    153   return (int)curr;
    154 #endif
    155230}
    156231/*2
     
    161236{
    162237  clock_t curr = clock() - startl;
    163   if (curr < (clock_t)CLOCKS_PER_SEC) return;
    164 
    165238  double f =  ((double)curr) / CLOCKS_PER_SEC;
    166   Print("//%s %.1f sec\n" ,v ,f);
    167 }
    168 #endif
     239  if (f > mintime)
     240    Print("//%s %.1f sec\n" ,v ,f);
     241}
     242#endif
  • Singular/timer.h

    r34ab5de rea986d  
    77* ABSTRACT
    88*/
    9 /* $Id: timer.h,v 1.2 1997-03-24 14:26:05 Singular Exp $ */
     9/* $Id: timer.h,v 1.3 1997-03-27 20:26:05 obachman Exp $ */
    1010
    1111extern int timerv;
     
    1414
    1515int initTimer();
    16 int  getTimer(); /* unit: sec */
     16int  getTimer();
     17
     18#ifdef HAVE_RTIMER
     19extern int rtimerv;
     20void startRTimer(void);
     21void writeRTime(void* s);
     22
     23void initRTimer();
     24int  getRTimer();
    1725#endif
    1826
     27void SetTimerResolution(int res);
     28void SetMinDisplayTime(double mtime);
     29
     30#endif
     31
  • Singular/tok.h

    r34ab5de rea986d  
    77* ABSTRACT
    88*/
    9 /* $Id: tok.h,v 1.3 1997-03-26 17:07:29 Singular Exp $ */
     9/* $Id: tok.h,v 1.4 1997-03-27 20:26:06 obachman Exp $ */
    1010
    1111#ifndef MYYSTYPE
     
    6262  EXTGCD_CMD,
    6363  FAC_CMD,
     64  FIND_CMD,
    6465  FACSTD_CMD,
    6566  FGLM_CMD,
    66   FIND_CMD,
    6767  GCD_CMD,
    6868  INSERT_CMD,
     
    110110  VCOLMAX,
    111111  VTIMER,
     112#ifdef HAVE_RTIMER
     113  VRTIMER,
     114#endif 
    112115  TRACE,
    113116  VOICE,
Note: See TracChangeset for help on using the changeset viewer.