|
15 | 15 | # See the License for the specific language governing permissions and |
16 | 16 | # limitations under the License. |
17 | 17 |
|
| 18 | +import datetime |
18 | 19 | import math |
19 | 20 | import os |
20 | 21 | import pickle |
@@ -946,13 +947,20 @@ def makeIndex(self, id, index, printCharts=False, profilerCount=30, profilerStac |
946 | 947 | print(" cd %s" % s) |
947 | 948 | os.chdir(s) |
948 | 949 |
|
| 950 | + # Create timestamped log subdirectory to avoid conflicts between runs |
| 951 | + now = datetime.datetime.now() |
| 952 | + timeStamp = now.strftime("%Y.%m.%d.%H.%M.%S") |
| 953 | + runLogDir = f"{constants.LOGS_DIR}/{id}/{timeStamp}" |
| 954 | + os.makedirs(runLogDir, exist_ok=True) |
| 955 | + print(f" log dir {runLogDir}") |
| 956 | + |
949 | 957 | try: |
950 | 958 | cmd = [] |
951 | 959 | cmd += index.javaCommand.split() |
952 | 960 | w = lambda *xs: [cmd.append(str(x)) for x in xs] |
953 | 961 | w("-classpath", classPathToString(getClassPath(index.checkout))) |
954 | 962 |
|
955 | | - jfrOutput = f"{constants.LOGS_DIR}/bench-index-{id}-{index.getName()}.jfr" |
| 963 | + jfrOutput = f"{runLogDir}/bench-index-{id}-{index.getName()}.jfr" |
956 | 964 |
|
957 | 965 | # 77: always enable Java Flight Recorder profiling |
958 | 966 | w( |
@@ -1048,16 +1056,16 @@ def makeIndex(self, id, index, printCharts=False, profilerCount=30, profilerStac |
1048 | 1056 | if index.quantizeKNNGraph: |
1049 | 1057 | w("-quantizeKNNGraph") |
1050 | 1058 |
|
1051 | | - fullLogFile = "%s/%s.%s.log" % (constants.LOGS_DIR, id, index.getName()) |
| 1059 | + fullLogFile = "%s/%s.%s.log" % (runLogDir, id, index.getName()) |
1052 | 1060 |
|
1053 | 1061 | print(" log %s" % fullLogFile) |
1054 | 1062 |
|
1055 | 1063 | t0 = time.time() |
1056 | 1064 | if VMSTAT_PATH is not None: |
1057 | | - vmstatLogFile = f"{constants.LOGS_DIR}/{id}.vmstat.log" |
| 1065 | + vmstatLogFile = f"{runLogDir}/{id}.vmstat.log" |
1058 | 1066 | else: |
1059 | 1067 | vmstatLogFile = None |
1060 | | - topLogFile = f"{constants.LOGS_DIR}/{id}.top.log" |
| 1068 | + topLogFile = f"{runLogDir}/{id}.top.log" |
1061 | 1069 | run(cmd, fullLogFile, vmstatLogFile=vmstatLogFile, topLogFile=topLogFile) |
1062 | 1070 | t1 = time.time() |
1063 | 1071 | if printCharts and IndexChart.Gnuplot is not None: |
|
0 commit comments