From: Patrick MacArthur <pmacarth@iol.unh.edu>
To: dts@dpdk.org
Cc: dpdklab@iol.unh.edu
Subject: [dts] [PATCH for-next v3 7/7] tests/TestSuite_nic_single_core_perf: Report the results in JSON format
Date: Thu, 29 Mar 2018 15:16:05 -0400 [thread overview]
Message-ID: <20180329191605.5404-8-pmacarth@iol.unh.edu> (raw)
In-Reply-To: <20180329191605.5404-1-pmacarth@iol.unh.edu>
Add a JSON report file in addition to the texttable report file, for
easier consumption by other automated tools. The JSON output produced
will look like:
{
"results": [
{
"parameters": { "frame_size": 64, "txd/rxd": 1024 },
"throughput": { "result": "PASS", "delta": -0.452, "unit": "Mpps" }
},
/* ... */
]
}
Each entry in the results list is essentially a table row. The
parameters "frame_size" and "txd/rxd" are the input parameters for
each given measurement. Each other element in the result dictionary
is an output measurement for the given measurement.
Signed-off-by: Patrick MacArthur <pmacarth@iol.unh.edu>
---
tests/TestSuite_nic_single_core_perf.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py
index 860fc29f607f..d1b88c3d0157 100644
--- a/tests/TestSuite_nic_single_core_perf.py
+++ b/tests/TestSuite_nic_single_core_perf.py
@@ -33,6 +33,7 @@ DPDK Test suite.
"""
import utils
+import json
import os
import re
import time
@@ -251,6 +252,28 @@ class TestNicSingleCorePerf(TestCase):
file_to_save.write(str(table))
file_to_save.close()
+ json_obj = dict()
+ json_obj['nic_type'] = self.nic
+ json_obj['results'] = list()
+ for frame_size in self.frame_sizes:
+ for descriptor in self.descriptors:
+ row_in = self.test_result[frame_size][descriptor]
+ row_dict = dict()
+ row_dict['parameters'] = dict()
+ row_dict['parameters']['frame_size'] = dict(
+ value=row_in['Frame Size'], unit='bytes')
+ row_dict['parameters']['txd/rxd'] = dict(
+ value=row_in['TXD/RXD'], unit='descriptors')
+ delta = (float(row_in['Throughput'].split()[0]) -
+ float(row_in['Expected Throughput'].split()[0]))
+ row_dict['throughput'] = dict(
+ delta=delta, unit=row_in['Throughput'].split()[1])
+ json_obj['results'].append(row_dict)
+ with open(os.path.join(rst.path2Result,
+ '{0:s}_single_core_perf.json'.format(
+ self.nic)), 'w') as fp:
+ json.dump(json_obj, fp)
+
def tear_down(self):
"""
Run after each test case.
--
2.14.1
next prev parent reply other threads:[~2018-03-29 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 19:15 [dts] [PATCH for-next v3 0/7] Fixes and modifications for T-Rex integration and nic_single_core_perf Patrick MacArthur
2018-03-29 19:15 ` [dts] [PATCH for-next v3 1/7] framework/texttable: Update to latest upstream version Patrick MacArthur
2018-03-29 19:16 ` [dts] [PATCH for-next v3 2/7] framework: Do not attempt ping6 on T-Rex ports Patrick MacArthur
2018-03-29 19:16 ` [dts] [PATCH for-next v3 3/7] tests/TestSuite_nic_single_core_perf: Fix config parsing Patrick MacArthur
2018-03-29 19:16 ` [dts] [PATCH for-next v3 4/7] tests/TestSuite_nic_single_core_perf: Use user-specified output dir Patrick MacArthur
2018-03-29 19:16 ` [dts] [PATCH for-next v3 5/7] framework/pktgen: Start T-Rex during prepare_generator() Patrick MacArthur
2018-03-29 19:16 ` [dts] [PATCH for-next v3 6/7] doc: Add T-Rex section to documentation Patrick MacArthur
2018-03-29 19:16 ` Patrick MacArthur [this message]
2018-03-30 8:17 ` [dts] [PATCH for-next v3 0/7] Fixes and modifications for T-Rex integration and nic_single_core_perf Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329191605.5404-8-pmacarth@iol.unh.edu \
--to=pmacarth@iol.unh.edu \
--cc=dpdklab@iol.unh.edu \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).