get_milliseconds function

This commit is contained in:
Matthew Stidham
2021-02-04 11:52:21 -08:00
parent f1495b1ac6
commit 0483b7dec3
3 changed files with 10 additions and 5 deletions

View File

@@ -8,9 +8,10 @@ from pprint import pprint
import time
import random
import string
import datetime
import argparse
import LANforge.LFUtils
from LANforge.LFUtils import *
import argparse
from LANforge import LFRequest
import LANforge.LFRequest
@@ -550,6 +551,10 @@ class LFCliBase:
chars = string.ascii_letters
return ''.join(random.choice(chars) for x in range(size))
def get_milliseconds(self,
timestamp):
return (timestamp - datetime.datetime(1970,1,1)).total_seconds()*1000
Help_Mode = """Station WiFi modes: use the number value below:
auto : 0,
a : 1,

View File

@@ -1249,14 +1249,14 @@ class L3CXProfile(LFCliBase):
header_row.append('Timestamp milliseconds')
df = pd.DataFrame(full_test_data_list)
df["Timestamp milliseconds"] = (df["Timestamp"] - datetime.datetime(1970,1,1)).dt.total_seconds()*1000
df["Timestamp milliseconds"] = [self.get_milliseconds(x) for x in df["Timestamp"]]
#round entire column
df["Timestamp milliseconds"]=df["Timestamp milliseconds"].astype(int)
df["Timestamp"]=df["Timestamp"].apply(lambda x:x.strftime("%m/%d/%Y %I:%M:%S"))
df=df[["Timestamp","Timestamp milliseconds", *header_row[:-2]]]
#compare previous data to current data
systeminfo = ast.literal_eval(requests.get('http://'+str(self.lfclient_host)+':'+str(self.lfclient_port)).text)
systeminfo = self.json_get('/')
df['LFGUI Release'] = systeminfo['VersionInfo']['BuildVersion']
df['Script Name'] = script_name
@@ -1772,7 +1772,7 @@ class L4CXProfile(LFCliBase):
header_row.append('Timestamp milliseconds')
df = pd.DataFrame(full_test_data_list)
df["Timestamp milliseconds"] = (df["Timestamp"] - datetime.datetime(1970,1,1)).dt.total_seconds()*1000
df["Timestamp milliseconds"] = [self.get_milliseconds(x) for x in df["Timestamp"]]
#round entire column
df["Timestamp milliseconds"]=df["Timestamp milliseconds"].astype(int)
df["Timestamp"]=df["Timestamp"].apply(lambda x:x.strftime("%m/%d/%Y %I:%M:%S"))

View File

@@ -258,7 +258,7 @@ python3 ./test_ipv4_variable_time.py
optional_args.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
optional_args.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
optional_args.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="2m")
optional_args.add_argument('--col_names', help='Columns wished to be monitor',default=None)
optional_args.add_argument('--col_names', help='Columns wished to be monitor', default=None)
optional_args.add_argument('--compared_report',help='report path and file which is wished to be compared with new report', default=None)
args = parser.parse_args()
#['name','tx bytes', 'rx bytes','dropped']