v05i029: xfroot, Patch2

Dan Heller argv at island.uu.net
Wed Nov 22 11:55:22 AEST 1989


Submitted-by: Ed Kubaitis <uunet!ux1.cso.uiuc.edu!ejk>
Posting-number: Volume 5, Issue 29
Archive-name: xfroot/patch2
Patch-To: xfroot: Volume 5, Issue 3,7

This patch makes the following changes to xfroot:

    1. Eliminate process startup and XOpenDisplay cp time from points/second
       calculation.

    2. Increase number of possible different automatically generated random 
       fractals from 32K to 1M.

It was generated by diff against the xfroot.c with xfroot/patch1 applied, 
though it does not depend on that patch. A complete xfroot.shar with both
this patch and xfroot/patch1 is available via anonymous ftp from 
uxc.cso.uiuc.edu in pub/xfroot/xfroot.shar or by email request to:

Ed Kubaitis (ejk at ux1.cso.uiuc.edu)
------------------------------------------

*** xfroot.c.patch1	Sun Oct  1 11:59:57 1989
--- xfroot.c	Fri Nov 17 07:44:17 1989
***************
*** 39,45
  #define HZ  60      /* see REAMDME */
  
  #define Ranf() (double)((Ranfseed=(Ranfseed*1629+1)%1048576)/1048576.)
! #define Ranfset(l) (Ranfseed=((abs(l)*1629)+1)%1048576)
  long    Ranfseed=4326;
  
  int     mxp=0, np=0;       /* max in-range points, in-range points */

--- 39,45 -----
  #define HZ  60      /* see REAMDME */
  
  #define Ranf() (double)((Ranfseed=(Ranfseed*1629+1)%1048576)/1048576.)
! #define Ranfset(l) (Ranfseed=(((abs(l)%1048576)*1629)+1)%1048576)
  long    Ranfseed=4326;
  
  int     mxp=0, np=0;       /* max in-range points, in-range points */
***************
*** 53,59
  
  
  main(argc, argv) int argc; char *argv[]; {
!    struct tms t;
  
     preset(argc, argv);
  

--- 53,60 -----
  
  
  main(argc, argv) int argc; char *argv[]; {
!    struct tms t0, t1;
!    int ticks;
  
     preset(argc, argv);
  
***************
*** 57,62
  
     preset(argc, argv);
  
     hopalong(); 
  
     times(&t);

--- 58,64 -----
  
     preset(argc, argv);
  
+    times(&t0);
     hopalong(); 
     times(&t1);
  
***************
*** 58,63
     preset(argc, argv);
  
     hopalong(); 
  
     times(&t);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",

--- 60,66 -----
  
     times(&t0);
     hopalong(); 
+    times(&t1);
  
     ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
***************
*** 59,65
  
     hopalong(); 
  
!    times(&t);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  	  nP, np, (100*np)/nP, 
            (int)((double)nP/((double)(t.tms_utime + t.tms_stime)/(double)HZ)));

--- 62,68 -----
     hopalong(); 
     times(&t1);
  
!    ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  	  nP, np, (100*np)/nP, 
            (int)((double)nP/((double)ticks/(double)HZ)));
***************
*** 62,68
     times(&t);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  	  nP, np, (100*np)/nP, 
!           (int)((double)nP/((double)(t.tms_utime + t.tms_stime)/(double)HZ)));
  
     setroot(W,H,bmap);
     XCloseDisplay(dpy);

--- 65,71 -----
     ticks = (t1.tms_utime + t1.tms_stime) - (t0.tms_utime + t0.tms_stime);
     printf("xfroot: %d points   %d(%d%%) in-range   %d points/cp_second\n",
  	  nP, np, (100*np)/nP, 
!           (int)((double)nP/((double)ticks/(double)HZ)));
  
     setroot(W,H,bmap);
     XCloseDisplay(dpy);
***************
*** 144,150
     if (!bmap) { fprintf(stderr, "xfroot: malloc failed.\n"); exit(1);}
     bzero(bmap, bmn);
  
!    Ranfset(time(0)%getpid()); hopset(); 
  
     if (!mxp && !mxP) {
        mxp = (int) (0.25 * (float)(W*H));

--- 147,153 -----
     if (!bmap) { fprintf(stderr, "xfroot: malloc failed.\n"); exit(1);}
     bzero(bmap, bmn);
  
!    Ranfset(time(0)); hopset(); 
  
     if (!mxp && !mxP) {
        mxp = (int) (0.25 * (float)(W*H));



More information about the Comp.sources.x mailing list