From 81e9de58c50566da8ae45c0ea7a55e7a7066ea75 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 27 Feb 2023 15:02:07 +0800 Subject: [PATCH] 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. --- UnixBench/src/fstime.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UnixBench/src/fstime.c b/UnixBench/src/fstime.c index 822c88e..99aa139 100644 --- a/UnixBench/src/fstime.c +++ b/UnixBench/src/fstime.c @@ -48,8 +48,8 @@ char SCCSid[] = "@(#) @(#)fstime.c:3.5 -- 5/15/91 19:30:19"; #define COUNTSIZE 256 #define HALFCOUNT (COUNTSIZE/2) /* Half of COUNTSIZE */ -#define FNAME0 "dummy0" -#define FNAME1 "dummy1" +char FNAME0[] = "dummy0-XXXXXXXXXX"; +char FNAME1[] = "dummy1-XXXXXXXXXX"; int w_test(int timeSecs); int r_test(int timeSecs); @@ -170,6 +170,10 @@ char *argv[]; } */ + int pid = getpid(); + snprintf(FNAME0 + sizeof("dummy0"), sizeof(FNAME0) - sizeof("dummy0"), "%d", pid); + snprintf(FNAME1 + sizeof("dummy1"), sizeof(FNAME1) - sizeof("dummy1"), "%d", pid); + if((f = creat(FNAME0, 0600)) == -1) { perror("fstime: creat"); exit(1);