11 int main(int argc, char ** argv)
13 int i, rc = 0, do_open;
15 long int start, last, end, count;
18 printf("Usage %s <-o|-m> filenamebase <count|-time>\n",
23 if (strcmp(argv[1], "-o") == 0) {
25 } else if (strcmp(argv[1], "-m") == 0) {
28 printf("Usage %s {-o|-m} filenamebase <count|-time>\n",
33 if (strlen(argv[2]) > 4080) {
34 printf("name too long\n");
38 start = last = time(0);
40 end = strtol(argv[3], NULL, 0);
50 for (i = 0; i < count && time(0) < end; i++) {
51 sprintf(filename, "%s%d", argv[2], i);
53 int fd = open(filename, O_CREAT|O_RDWR, 0644);
55 printf("open(%s) error: %s\n", filename,
62 rc = mknod(filename, S_IFREG| 0444, 0);
64 printf("mknod(%s) error: %s\n",
65 filename, strerror(errno));
70 if ((i % 10000) == 0) {
71 printf(" - created %d (time %ld ; total %ld ; last %ld)\n",
72 i, time(0), time(0) - start, time(0) - last);
76 printf("total: %d creates in %ld seconds: %f creates/second\n", i,
77 time(0) - start, ((float)i / (time(0) - start)));