|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 1030 (0x406) Types: TextFile Names: »ran.c«
└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/bsd/ran.c« └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/bsd/ran.c«
char *malloc(); int rand(); main(argc, argv) char *argv[]; { register int npages = 4096,pagesize, pn, i, niter; int vflag = 0, debug = 0; char *pages, *name; name = argv[0]; argc--, argv++; again: if (argc < 1){ usage: printf("usage: %s [ -v ] [ -p #pages ] niter \n", name); exit(1); } if (strcmp(*argv, "-p") == 0){ argc--, argv++; if(argc < 1) goto usage; npages = atoi(*argv); if (npages <= 0){ printf("%s: Bad page count.\n",*argv); exit(2); } argc--,argv++; goto again; } if (strcmp(*argv, "-v") == 0) { argc--,argv++; vflag++; goto again; } if (strcmp(*argv, "-d") == 0) { argc--,argv++; debug++; goto again; } niter = atoi(*argv); pagesize = 1024; pages = malloc(npages * pagesize); if(pages == (char *) 0){ printf("Can't allocate %d pages ( %2.1f megabytes).\n", npages, (npages * pagesize) / (1024. * 1024.)); exit(3); } for(i= 0; i < niter; i++){ pn = rand() % npages; if(debug) printf("touch page %d\n", pn); pages[pagesize * pn] = 1; } }