Skip to content

Commit 81e9de5

Browse files
authored
fstime.c - Seperate r/w files for each parallel (#85)
* fstime.c - Seperate r/w files for each parallel Existing workload is using 1 read file and 1 write file for file read/write/copy test. In multi-parallel scenario, it leads to high file lock contention, while read/write/copy is not stressed. This change seperates r/w files for each parallel to satisfy the multi-parallel test purpose.
1 parent 6705203 commit 81e9de5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

UnixBench/src/fstime.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ char SCCSid[] = "@(#) @(#)fstime.c:3.5 -- 5/15/91 19:30:19";
4848
#define COUNTSIZE 256
4949
#define HALFCOUNT (COUNTSIZE/2) /* Half of COUNTSIZE */
5050

51-
#define FNAME0 "dummy0"
52-
#define FNAME1 "dummy1"
51+
char FNAME0[] = "dummy0-XXXXXXXXXX";
52+
char FNAME1[] = "dummy1-XXXXXXXXXX";
5353

5454
int w_test(int timeSecs);
5555
int r_test(int timeSecs);
@@ -170,6 +170,10 @@ char *argv[];
170170
}
171171
*/
172172

173+
int pid = getpid();
174+
snprintf(FNAME0 + sizeof("dummy0"), sizeof(FNAME0) - sizeof("dummy0"), "%d", pid);
175+
snprintf(FNAME1 + sizeof("dummy1"), sizeof(FNAME1) - sizeof("dummy1"), "%d", pid);
176+
173177
if((f = creat(FNAME0, 0600)) == -1) {
174178
perror("fstime: creat");
175179
exit(1);

0 commit comments

Comments
 (0)