All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
To: fuego@lists.linuxfoundation.org
Subject: [Fuego] [PATCH 3/3] cyclictest: modify parsing and test measures
Date: Tue, 31 Oct 2017 17:31:55 +0900	[thread overview]
Message-ID: <1509438715-14039-4-git-send-email-daniel.sangorrin@toshiba.co.jp> (raw)
In-Reply-To: <1509438715-14039-1-git-send-email-daniel.sangorrin@toshiba.co.jp>

cyclictest can have more or less result lines depending on
how many threads are executed.

PROBLEM: Fuego currently does not support arrays of arbitrary
size that can be populated dynamically. The reason
is because we splitted reference.json from parser.py which
could have easily solved that.

For now, I have decided to calculate the global minimum,
average and maximum latency variables for all threads (1
thread per core in the new default spec).

TODO: I tried to write chart_config.json to only display the
maximum values but it didn't work as expected (all measures
are shown).

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
---
 .../tests/Benchmark.cyclictest/chart_config.json   |  4 ++-
 engine/tests/Benchmark.cyclictest/criteria.json    | 26 ++++++++++++++++
 engine/tests/Benchmark.cyclictest/parser.py        | 35 ++++++++++------------
 engine/tests/Benchmark.cyclictest/reference.json   | 26 ++++++++++++++++
 engine/tests/Benchmark.cyclictest/reference.log    | 17 -----------
 5 files changed, 71 insertions(+), 37 deletions(-)
 create mode 100644 engine/tests/Benchmark.cyclictest/criteria.json
 create mode 100644 engine/tests/Benchmark.cyclictest/reference.json
 delete mode 100644 engine/tests/Benchmark.cyclictest/reference.log

diff --git a/engine/tests/Benchmark.cyclictest/chart_config.json b/engine/tests/Benchmark.cyclictest/chart_config.json
index 101d5ac..31b0d37 100644
--- a/engine/tests/Benchmark.cyclictest/chart_config.json
+++ b/engine/tests/Benchmark.cyclictest/chart_config.json
@@ -1,3 +1,5 @@
 {
-        "cyclictest":["Thread0", "Thread1"]
+	"chart_type": "measure_plot",
+	"measures": ["latencies.max_latency"],
+	"test_sets": ["default"]
 }
diff --git a/engine/tests/Benchmark.cyclictest/criteria.json b/engine/tests/Benchmark.cyclictest/criteria.json
new file mode 100644
index 0000000..f137d55
--- /dev/null
+++ b/engine/tests/Benchmark.cyclictest/criteria.json
@@ -0,0 +1,26 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"default.latencies.max_latency",
+            "reference":{
+                "value":1000,
+                "operator":"le"
+            }
+        },
+        {
+            "tguid":"default.latencies.min_latency",
+            "reference":{
+                "value":1000,
+                "operator":"le"
+            }
+        },
+        {
+            "tguid":"default.latencies.avg_latency",
+            "reference":{
+                "value":1000,
+                "operator":"le"
+            }
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.cyclictest/parser.py b/engine/tests/Benchmark.cyclictest/parser.py
index 44425ea..3f4f05d 100755
--- a/engine/tests/Benchmark.cyclictest/parser.py
+++ b/engine/tests/Benchmark.cyclictest/parser.py
@@ -1,26 +1,23 @@
 #!/usr/bin/python
-# See common.py for description of command-line arguments
-
 import os, re, sys
 sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
 import common as plib
 
-ref_section_pat = "^\[[\w\d_ .]+.[gle]{2}\]"
-cur_search_pat = re.compile("^T:([\s\d]+)(.*)P:(.*)C:(.*)Min:([\s\d]+)Act:([\s\d]+)Avg:([\s\d]+)Max:([\s\d]+)",re.MULTILINE)
-
-res_dict = {}
-cur_dict = {}
-
-pat_result = plib.parse(cur_search_pat)
-if pat_result:
-	cur_dict["Thread0.Min"] = '%d' % int(pat_result[0][4])
-	cur_dict["Thread0.Act"] = '%d' % int(pat_result[0][5])
-	cur_dict["Thread0.Avg"] = '%d' % int(pat_result[0][6])
-	cur_dict["Thread0.Max"] = '%d' % int(pat_result[0][7])
-	cur_dict["Thread1.Min"] = '%d' % int(pat_result[1][4])
-	cur_dict["Thread1.Act"] = '%d' % int(pat_result[1][5])
-	cur_dict["Thread1.Avg"] = '%d' % int(pat_result[1][6])
-	cur_dict["Thread1.Max"] = '%d' % int(pat_result[1][7])
+regex_string = "^T:.*Min:\s+(\d+).*Avg:\s+(\d+) Max:\s+(\d+)"
+measurements = {}
+matches = plib.parse_log(regex_string)
 
+if matches:
+	min_latencies = []
+	avg_latencies = []
+	max_latencies = []
+	for thread in matches:
+		min_latencies.append(float(thread[0]))
+		avg_latencies.append(float(thread[1]))
+		max_latencies.append(float(thread[2]))
+	measurements['default.latencies'] = [
+		{"name": "max_latency", "measure" : max(max_latencies)},
+		{"name": "min_latency", "measure" : min(min_latencies)},
+		{"name": "avg_latency", "measure" : sum(avg_latencies)/len(avg_latencies)}]
 
-sys.exit(plib.process_data(ref_section_pat, cur_dict, 'm', 'usec'))
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Benchmark.cyclictest/reference.json b/engine/tests/Benchmark.cyclictest/reference.json
new file mode 100644
index 0000000..415a8dd
--- /dev/null
+++ b/engine/tests/Benchmark.cyclictest/reference.json
@@ -0,0 +1,26 @@
+{
+    "test_sets":[
+        {
+            "name":"default",
+            "test_cases":[
+                {
+                    "name":"latencies",
+                    "measurements":[
+                        {
+                            "name":"max_latency",
+                            "unit":"us"
+                        },
+                        {
+                            "name":"min_latency",
+                            "unit":"us"
+                        },
+                        {
+                            "name":"avg_latency",
+                            "unit":"us"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.cyclictest/reference.log b/engine/tests/Benchmark.cyclictest/reference.log
deleted file mode 100644
index 83a959d..0000000
--- a/engine/tests/Benchmark.cyclictest/reference.log
+++ /dev/null
@@ -1,17 +0,0 @@
-#sdfdsf
-[Thread0.Min|le]
-10000000
-[Thread0.Act|le]
-10000000
-[Thread0.Avg|le]
-10000000
-[Thread0.Max|le]
-10000000
-[Thread1.Min|le]
-10000000
-[Thread1.Act|le]
-10000000
-[Thread1.Avg|le]
-10000000
-[Thread1.Max|le]
-10000000
-- 
2.7.4



  parent reply	other threads:[~2017-10-31  8:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31  8:31 [Fuego] cyclictest patches Daniel Sangorrin
2017-10-31  8:31 ` [Fuego] [PATCH 1/3] cyclictest: update build function Daniel Sangorrin
2017-10-31 17:30   ` Bird, Timothy
2017-10-31 18:53     ` Bird, Timothy
2017-10-31 17:49   ` Bird, Timothy
2017-10-31  8:31 ` [Fuego] [PATCH 2/3] cyclictest: modify specs Daniel Sangorrin
2017-10-31 19:56   ` Bird, Timothy
2017-11-01  0:28     ` Daniel Sangorrin
2017-11-01 17:52       ` Bird, Timothy
2017-11-07  7:27         ` Daniel Sangorrin
2017-11-01 17:16   ` Bird, Timothy
2017-11-07  7:33     ` Daniel Sangorrin
2017-11-08  0:44       ` Bird, Timothy
2017-10-31  8:31 ` Daniel Sangorrin [this message]
2017-11-01  0:43   ` [Fuego] [PATCH 3/3] cyclictest: modify parsing and test measures Bird, Timothy
2017-11-01 17:11   ` Bird, Timothy
2017-10-31  8:39 ` [Fuego] cyclictest patches Daniel Sangorrin
2017-10-31 17:27   ` Bird, Timothy
2017-10-31 19:32     ` Bird, Timothy
2017-11-01  0:25     ` Daniel Sangorrin
2017-10-31 16:45 ` Bird, Timothy

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=1509438715-14039-4-git-send-email-daniel.sangorrin@toshiba.co.jp \
    --to=daniel.sangorrin@toshiba.co.jp \
    --cc=fuego@lists.linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.