7 #include <SUNRT/clock.h>
10 #define BUFFSZ 100*1024*1024
13 int main(
int argc,
char *argv[])
18 printf(
"%s filename\n",argv[0]);
23 printf(
"Buffer size %d bytes\n",BUFFSZ);
28 char *buff = (
char *)malloc(BUFFSZ + 8*1024);
30 printf(
"Error in malloc\n");
33 unsigned int buffx = (
unsigned int) buff;
37 if(buffx != (
unsigned int)buff) {
39 printf(
"new 0x%x / old 0x%x\n",buffx,(
unsigned int)buff);
43 for(
int i=0;i<BUFFSZ;i++) {
47 double t = record_time();
48 printf(
"setup: %10.8f secs\n", t);
63 for(
int ii=0;ii>=0;ii++) {
69 sprintf(mntname,
"%s_%d",argv[1], ii/1000);
70 fd = open(mntname, O_WRONLY | O_CREAT, 0666);
74 sfs_create_mimage(&desc, seedbuff, 1000);
76 write(fd, seedbuff, desc.sz);
85 for(
int detn=0;detn<10;detn++) {
89 for(
int subn=0;subn<10;subn++) {
91 sprintf(fn,
"/event_%d/det_%d/sub_%d",filen,detn,subn);
93 sprintf(fn,
"sub_%d",subn);
95 float rnd = ((float)rand()/(float)RAND_MAX) * 5000.0;
103 sfs_genfilerec(fn, fsz, file);
106 if(fd <0) perror(
"Bad file?: ");
108 int ret = write(fd, (
char *)file, file->head_sz);
109 if(ret != file->head_sz) perror(
"Bad write?: ");
111 ret = write(fd, (
char *)fp, seeksize(file->sz));
112 if(ret != seeksize(file->sz)) perror(
"Bad write?: ");
124 if(etime - ltime > 10) {
127 double rate = (sent / (1e6*etime));
128 double lrate = ((double)eventsz) / (1e6 * t);
130 printf(
"%6.2f %6.2f\n",lrate, rate);
134 printf(
"sent = %d\n",(
int)sent);