Skip to content

Commit fa9efa3

Browse files
committed
ft-analyzer optimize replication by avoiding deep copying and reading unnecessary columns
1 parent 726c3cb commit fa9efa3

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

run_tests_nohup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ echo "📋 Starting tests with nohup... output in ${LOG}"
1212
. .venv/bin/activate && pytest "$@" &
1313
wait %1 # wait for pytest to finish
1414
NEWEST_DIR=$(ls -d logs/[0-9]*/ | sort -r | head -n1)
15-
mv "logs/report.html" "${NEWEST_DIR}"
15+
if ! [ -e "${NEWEST_DIR}/report.html" ]; then
16+
mv "logs/report.html" "${NEWEST_DIR}"
17+
fi

tools/ft-analyzer/ftanalyzer/replicator/flow_replicator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ def replicate(
281281
try:
282282
for chunk in pd.read_csv(
283283
input_file,
284-
dtype=self.CSV_COLUMN_TYPES,
284+
usecols=["START_TIME", "END_TIME"],
285+
dtype={
286+
"START_TIME": np.uint64,
287+
"END_TIME": np.uint64,
288+
},
285289
chunksize=chunksize,
286290
):
287291
start_min = chunk["START_TIME"].min()
@@ -521,7 +525,7 @@ def _process_single_loop(
521525
if self._config.loop.dstip:
522526
dstip_offset += loop_n * self._config.loop.dstip.value
523527

524-
flows = self._flows.copy()
528+
flows = self._flows.copy(deep=False)
525529
flows["START_TIME"] = time_offset + flows["_START_OFFSET"]
526530
flows["END_TIME"] = flows["START_TIME"] + flows["_FLOW_LEN"]
527531

0 commit comments

Comments
 (0)