Skip to content

Commit f7bbd80

Browse files
committed
ft-analyzer add time tracking for replication and validation
1 parent aad4a8a commit f7bbd80

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

tools/ft-analyzer/ftanalyzer/models/precise_model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
77
"""
88

9+
import logging
910
import operator
1011
from functools import reduce
1112
from os import PathLike
13+
import time
1214
from typing import List, Optional, Union
1315

1416
import pandas as pd
@@ -128,6 +130,8 @@ def validate_precise(
128130
Report containing results of individual performed tests.
129131
"""
130132

133+
start = time.time()
134+
131135
self._report = PreciseReport()
132136
if segments is None:
133137
segments = [None]
@@ -188,6 +192,9 @@ def validate_precise(
188192
)
189193
self._report_flows(flows, PMTestCategory.UNEXPECTED)
190194

195+
end = time.time()
196+
logging.getLogger().info("Precisely validated in %.2f seconds.", (end - start))
197+
191198
return self._report
192199

193200
@staticmethod

tools/ft-analyzer/ftanalyzer/models/statistical_model.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ def validate(
317317
SMException
318318
When duplicated metrics in a single validation rule are present.
319319
"""
320+
start = time.time()
320321

321322
report = StatisticalReport(self._log_dir)
322323
all_flow_masks = []
@@ -403,6 +404,11 @@ def validate(
403404
for objects in zip(statistic_objects.values(), ref_statistic_objects.values()):
404405
report.add_statistic_object(*objects)
405406

407+
end = time.time()
408+
logging.getLogger().info(
409+
"Statistically validated in %.2f seconds.", (end - start)
410+
)
411+
406412
return report
407413

408414
def _filter_multicast(self):

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import re
1919
from dataclasses import dataclass
2020
import tempfile
21+
import time
2122
from typing import Any, Iterable, List, Optional, Union
2223

2324
import numpy as np
@@ -261,6 +262,8 @@ def replicate(
261262
FlowReplicatorException
262263
When source CSV file cannot be read.
263264
"""
265+
start = time.time()
266+
264267
if not output_file:
265268
output_file = tempfile.NamedTemporaryFile(
266269
delete=False, suffix=".csv", prefix="tmp_ref_"
@@ -349,6 +352,8 @@ def replicate(
349352
)
350353
first_write = False
351354

355+
end = time.time()
356+
logging.getLogger().info("CSV replicated in %.2f seconds.", (end - start))
352357
return output_file
353358

354359
@staticmethod

0 commit comments

Comments
 (0)