get time elapsed from log files
This commit is contained in:
+1
-34
@@ -246,43 +246,10 @@ def extract_measurement_metrics(db_file_path):
|
||||
GROUP BY COM_Dst_endpoint
|
||||
"""
|
||||
).fetchall()
|
||||
|
||||
elapsed_row = conn.execute(
|
||||
"""
|
||||
WITH first_last AS (
|
||||
SELECT
|
||||
(SELECT COM_time FROM MEASUREMENT ORDER BY rowid ASC LIMIT 1) AS start_time,
|
||||
(SELECT COM_time FROM MEASUREMENT ORDER BY rowid DESC LIMIT 1) AS end_time
|
||||
)
|
||||
SELECT
|
||||
ROUND(
|
||||
CASE
|
||||
WHEN end_sec >= start_sec THEN
|
||||
end_sec - start_sec
|
||||
ELSE
|
||||
(end_sec - start_sec) + 86400
|
||||
END
|
||||
) AS elapsed_seconds
|
||||
FROM (
|
||||
SELECT
|
||||
(strftime('%H', start_time) * 3600 +
|
||||
strftime('%M', start_time) * 60 +
|
||||
strftime('%S', start_time)) AS start_sec,
|
||||
|
||||
(strftime('%H', end_time) * 3600 +
|
||||
strftime('%M', end_time) * 60 +
|
||||
strftime('%S', end_time)) AS end_sec
|
||||
FROM first_last
|
||||
);
|
||||
"""
|
||||
).fetchone()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
result = {"duration_seconds": None, "tputResults": []}
|
||||
|
||||
if elapsed_row and elapsed_row["elapsed_seconds"] is not None:
|
||||
result["duration_seconds"] = int(elapsed_row["elapsed_seconds"])
|
||||
result = {"tputResults": []}
|
||||
|
||||
rssi_by_endpoint = {
|
||||
row["COM_Dst_endpoint"]: {
|
||||
|
||||
Reference in New Issue
Block a user