summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authoritraviv <itraviv@cisco.com>2017-01-19 09:39:51 +0200
committeritraviv <itraviv@cisco.com>2017-01-19 09:40:04 +0200
commitc24dec0a24cfe9d016656035cd756cd5ed211639 (patch)
treed4ab85df06fd3ad116e3fd6859b1ab1bc1309dd4 /doc
parentcb80d2072257ba45c248833d7555e1b77c846aae (diff)
minor changes to time formats in TRexDataAnalysis Script: added the time format of a query to the query class
Signed-off-by: itraviv <itraviv@cisco.com>
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/TRexDataAnalysisV2.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/TRexDataAnalysisV2.py b/doc/TRexDataAnalysisV2.py
index e57b7017..19143199 100755
--- a/doc/TRexDataAnalysisV2.py
+++ b/doc/TRexDataAnalysisV2.py
@@ -28,14 +28,15 @@ This Module is structured to work with a raw data at the following JSON format:
["syn attack - 64 bytes, single CPU", "stl", "20161226", "01", "39", "9.631898", "9.5", "11.5", "54289"]
- it can be changed to support other formats of queries, simply change the enum class to support your desired structure
- the enums specify the indexes of the data within the query tuple
+ it can be changed to support other formats of queries, simply change the query class to support your desired structure
+ the query class specify the indexes of the data within the query tuple
"""
class TestQuery(object):
- QUERY_DATE = 2 # date format is yyyymmdd
+ query_dateformat = "%Y%m%d" # date format in the query
+ QUERY_DATE = 2
QUERY_HOUR = 3
QUERY_MINUTE = 4
QUERY_MPPS_RESULT = 5
@@ -61,7 +62,8 @@ class Test:
test_mins = set()
test_maxs = set()
for query in raw_test_data:
- date_formatted = time.strftime("%d-%m-%Y", time.strptime(query[int(TestQuery.QUERY_DATE)], "%Y%m%d"))
+ date_formatted = time.strftime("%d-%m-%Y",
+ time.strptime(query[int(TestQuery.QUERY_DATE)], TestQuery.query_dateformat))
time_of_res = date_formatted + '-' + query[int(TestQuery.QUERY_HOUR)] + ':' + query[
int(TestQuery.QUERY_MINUTE)]
test_dates.append(time_of_res)
@@ -133,14 +135,14 @@ class Setup:
for test in self.tests:
test_data = test.results_df[test.results_df.columns[2]].tolist()
test_time_stamps = test.results_df[test.results_df.columns[3]].tolist()
- test_time_stamps.append(self.end_date+'-23:59')
+ test_time_stamps.append(self.end_date + '-23:59')
test_data.append(test_data[-1])
float_test_time_stamps = []
for ts in test_time_stamps:
try:
- float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format1)))
+ float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format1)))
except:
- float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format2)))
+ float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format2)))
plt.plot_date(x=float_test_time_stamps, y=test_data, label=test.name, fmt='-', xdate=True)
plt.legend(fontsize='small', loc='best')
plt.ylabel('MPPS/Core (Norm)')