test suite reviews and discussions
 help / color / Atom feed
* Re: [dts] [PATCH V1 0/1] power_telemetry: python3 support and script optimize
  2020-03-04  8:27 [dts] [PATCH V1 0/1] power_telemetry: python3 support and script optimize yufengmx
@ 2020-03-04  8:25 ` Mo, YufengX
  2020-03-04  8:27 ` [dts] [PATCH V1 1/1] tests/power_telemetry: " yufengmx
  1 sibling, 0 replies; 4+ messages in thread
From: Mo, YufengX @ 2020-03-04  8:25 UTC (permalink / raw)
  To: dts, Yao, Lei A

[-- Attachment #1: Type: text/plain, Size: 742 bytes --]

Tested-by:  yufengx.mo@intel.com

> -----Original Message-----
> From: Mo, YufengX
> Sent: Wednesday, March 4, 2020 4:28 PM
> To: dts@dpdk.org; Yao, Lei A <lei.a.yao@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V1 0/1] power_telemetry: python3 support and script optimize
> 
> 
> . python3 support.
> 
> . for dpdk use hard code, change core mask to hard code.
> 
> . set longer traffic duration for stability.
> 
> . use ^C to take the place of killall.
> 
> yufengmx (1):
>   tests/power_telemetry: python3 support and script optimize
> 
>  tests/TestSuite_power_telemetry.py | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> --
> 2.21.0


[-- Attachment #2: TestPowerTelemetry.log --]
[-- Type: application/octet-stream, Size: 53562 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V1 0/1] power_telemetry: python3 support and script optimize
@ 2020-03-04  8:27 yufengmx
  2020-03-04  8:25 ` Mo, YufengX
  2020-03-04  8:27 ` [dts] [PATCH V1 1/1] tests/power_telemetry: " yufengmx
  0 siblings, 2 replies; 4+ messages in thread
From: yufengmx @ 2020-03-04  8:27 UTC (permalink / raw)
  To: dts, lei.a.yao; +Cc: yufengmx


. python3 support. 

. for dpdk use hard code, change core mask to hard code. 

. set longer traffic duration for stability. 

. use ^C to take the place of killall. 

yufengmx (1):
  tests/power_telemetry: python3 support and script optimize

 tests/TestSuite_power_telemetry.py | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V1 1/1] tests/power_telemetry: python3 support and script optimize
  2020-03-04  8:27 [dts] [PATCH V1 0/1] power_telemetry: python3 support and script optimize yufengmx
  2020-03-04  8:25 ` Mo, YufengX
@ 2020-03-04  8:27 ` " yufengmx
  2020-03-13  6:29   ` Tu, Lijuan
  1 sibling, 1 reply; 4+ messages in thread
From: yufengmx @ 2020-03-04  8:27 UTC (permalink / raw)
  To: dts, lei.a.yao; +Cc: yufengmx


#. python3 support.
#. for dpdk use hard code, change core mask to hard code.
#. set longer traffic duration for stability.
#. use ^C to take the place of killall.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 tests/TestSuite_power_telemetry.py | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/tests/TestSuite_power_telemetry.py b/tests/TestSuite_power_telemetry.py
index 9c2bdbc..90404e3 100644
--- a/tests/TestSuite_power_telemetry.py
+++ b/tests/TestSuite_power_telemetry.py
@@ -63,16 +63,15 @@ class TestPowerTelemetry(TestCase):
         return target_dir
 
     def d_con(self, cmd):
-        _cmd = [cmd, '# ', 10] if isinstance(cmd, (str, unicode)) else cmd
+        _cmd = [cmd, '# ', 10] if isinstance(cmd, str) else cmd
         return self.dut.send_expect(*_cmd)
 
     def d_a_con(self, cmd):
-        _cmd = [cmd, '# ', 10] if isinstance(cmd, (str, unicode)) else cmd
+        _cmd = [cmd, '# ', 10] if isinstance(cmd, str) else cmd
         return self.dut.alt_session.send_expect(*_cmd)
 
     def get_pkt_len(self, pkt_type, frame_size=64):
-        headers_size = sum(map(lambda x: HEADER_SIZE[x],
-                               ['eth', 'ip', pkt_type]))
+        headers_size = sum([HEADER_SIZE[x] for x in ['eth', 'ip', pkt_type]])
         pktlen = frame_size - headers_size
         return pktlen
 
@@ -87,7 +86,7 @@ class TestPowerTelemetry(TestCase):
         pkt_type = values.get('type')
         pkt_layers = values.get('pkt_layers')
         pkt = Packet(pkt_type=pkt_type)
-        for layer in pkt_layers.keys():
+        for layer in list(pkt_layers.keys()):
             pkt.config_layer(layer, pkt_layers[layer])
         return pkt.pktgen.pkt
 
@@ -154,6 +153,7 @@ class TestPowerTelemetry(TestCase):
         self.l3fwd_power = self.prepare_binary('l3fwd-power')
 
     def start_l3fwd_power(self, core_config='1S/2C/1T'):
+        core_mask, core = '0x6', 2
         option = (' '
                   '-c {core_mask} '
                   '-n {mem_channel} '
@@ -162,9 +162,10 @@ class TestPowerTelemetry(TestCase):
                   '--telemetry '
                   '-p 0x1 '
                   '-P '
-                  '--config="(0,0,2)" '
+                  '--config="(0,0,{core})" '
                   ).format(**{
-                      'core_mask': self.get_cores_mask(core_config),
+                      'core_mask': core_mask,
+                      'core': core,
                       'mem_channel': self.dut.get_memory_channels(), })
         prompt = 'L3FWD_POWER: entering main telemetry loop'
         cmd = [' '.join([self.l3fwd_power, option]), prompt, 60]
@@ -174,8 +175,8 @@ class TestPowerTelemetry(TestCase):
     def close_l3fwd_power(self):
         if not self.is_l3fwd_on:
             return
-        cmd = 'killall ' + os.path.basename(self.l3fwd_power)
-        self.d_a_con(cmd)
+        cmd = "^C"
+        self.d_con(cmd)
 
     def create_query_script(self):
         '''
@@ -224,8 +225,8 @@ class TestPowerTelemetry(TestCase):
         """)
         fileName = 'query_tool.py'
         query_script = os.path.join(self.output_path, fileName)
-        with open(query_script, 'wb') as fp:
-            fp.write('#! /usr/bin/env python' + os.linesep + script_content)
+        with open(query_script, 'w') as fp:
+            fp.write('#! /usr/bin/env python' + os.linesep + str(script_content))
         self.dut.session.copy_file_to(query_script, self.target_dir)
         script_file = os.path.join(self.target_dir, fileName)
         cmd = 'chmod 777 {}'.format(script_file)
@@ -251,7 +252,7 @@ class TestPowerTelemetry(TestCase):
         pipe = '/var/run/some_client'
         cmd = "{0} -j {1} -f {2}".format(self.query_tool, json_file, pipe)
         output = self.d_a_con(cmd)
-        msg = 'faile to query metric data'
+        msg = 'failed to query metric data'
         self.verify("Get metrics done" in output, msg)
         dst_file = os.path.join(self.output_path, json_name)
         self.dut.session.copy_file_from(json_file, dst_file)
@@ -392,11 +393,12 @@ class TestPowerTelemetry(TestCase):
         except_content = None
         try:
             self.start_l3fwd_power()
+            duration = 20
             option = {
                 'traffic_opt': {
                     'method': 'throughput',
-                    'duration': 15,
-                    'interval': 10,
+                    'duration': duration,
+                    'interval': duration - 2,
                     'callback': self.telemetry_query_on_traffic, }}
             self.run_traffic(option)
             time.sleep(5)
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V1 1/1] tests/power_telemetry: python3 support and script optimize
  2020-03-04  8:27 ` [dts] [PATCH V1 1/1] tests/power_telemetry: " yufengmx
@ 2020-03-13  6:29   ` Tu, Lijuan
  0 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2020-03-13  6:29 UTC (permalink / raw)
  To: Mo, YufengX, dts, Yao, Lei A; +Cc: Mo, YufengX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx
> Sent: Wednesday, March 4, 2020 4:28 PM
> To: dts@dpdk.org; Yao, Lei A <lei.a.yao@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts] [PATCH V1 1/1] tests/power_telemetry: python3 support and
> script optimize
> 
> 
> #. python3 support.
> #. for dpdk use hard code, change core mask to hard code.
> #. set longer traffic duration for stability.
> #. use ^C to take the place of killall.
> 
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
>  tests/TestSuite_power_telemetry.py | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/TestSuite_power_telemetry.py
> b/tests/TestSuite_power_telemetry.py
> index 9c2bdbc..90404e3 100644
> --- a/tests/TestSuite_power_telemetry.py
> +++ b/tests/TestSuite_power_telemetry.py
> @@ -63,16 +63,15 @@ class TestPowerTelemetry(TestCase):
>          return target_dir
> 
>      def d_con(self, cmd):
> -        _cmd = [cmd, '# ', 10] if isinstance(cmd, (str, unicode)) else cmd
> +        _cmd = [cmd, '# ', 10] if isinstance(cmd, str) else cmd
>          return self.dut.send_expect(*_cmd)
> 
>      def d_a_con(self, cmd):
> -        _cmd = [cmd, '# ', 10] if isinstance(cmd, (str, unicode)) else cmd
> +        _cmd = [cmd, '# ', 10] if isinstance(cmd, str) else cmd
>          return self.dut.alt_session.send_expect(*_cmd)
> 
>      def get_pkt_len(self, pkt_type, frame_size=64):
> -        headers_size = sum(map(lambda x: HEADER_SIZE[x],
> -                               ['eth', 'ip', pkt_type]))
> +        headers_size = sum([HEADER_SIZE[x] for x in ['eth', 'ip',
> + pkt_type]])
>          pktlen = frame_size - headers_size
>          return pktlen
> 
> @@ -87,7 +86,7 @@ class TestPowerTelemetry(TestCase):
>          pkt_type = values.get('type')
>          pkt_layers = values.get('pkt_layers')
>          pkt = Packet(pkt_type=pkt_type)
> -        for layer in pkt_layers.keys():
> +        for layer in list(pkt_layers.keys()):
>              pkt.config_layer(layer, pkt_layers[layer])
>          return pkt.pktgen.pkt
> 
> @@ -154,6 +153,7 @@ class TestPowerTelemetry(TestCase):
>          self.l3fwd_power = self.prepare_binary('l3fwd-power')
> 
>      def start_l3fwd_power(self, core_config='1S/2C/1T'):
> +        core_mask, core = '0x6', 2
>          option = (' '
>                    '-c {core_mask} '
>                    '-n {mem_channel} '
> @@ -162,9 +162,10 @@ class TestPowerTelemetry(TestCase):
>                    '--telemetry '
>                    '-p 0x1 '
>                    '-P '
> -                  '--config="(0,0,2)" '
> +                  '--config="(0,0,{core})" '
>                    ).format(**{
> -                      'core_mask': self.get_cores_mask(core_config),
> +                      'core_mask': core_mask,
> +                      'core': core,
>                        'mem_channel': self.dut.get_memory_channels(), })
>          prompt = 'L3FWD_POWER: entering main telemetry loop'
>          cmd = [' '.join([self.l3fwd_power, option]), prompt, 60] @@ -174,8
> +175,8 @@ class TestPowerTelemetry(TestCase):
>      def close_l3fwd_power(self):
>          if not self.is_l3fwd_on:
>              return
> -        cmd = 'killall ' + os.path.basename(self.l3fwd_power)
> -        self.d_a_con(cmd)
> +        cmd = "^C"
> +        self.d_con(cmd)
> 
>      def create_query_script(self):
>          '''
> @@ -224,8 +225,8 @@ class TestPowerTelemetry(TestCase):
>          """)
>          fileName = 'query_tool.py'
>          query_script = os.path.join(self.output_path, fileName)
> -        with open(query_script, 'wb') as fp:
> -            fp.write('#! /usr/bin/env python' + os.linesep + script_content)
> +        with open(query_script, 'w') as fp:
> +            fp.write('#! /usr/bin/env python' + os.linesep +
> + str(script_content))
>          self.dut.session.copy_file_to(query_script, self.target_dir)
>          script_file = os.path.join(self.target_dir, fileName)
>          cmd = 'chmod 777 {}'.format(script_file) @@ -251,7 +252,7 @@ class
> TestPowerTelemetry(TestCase):
>          pipe = '/var/run/some_client'
>          cmd = "{0} -j {1} -f {2}".format(self.query_tool, json_file, pipe)
>          output = self.d_a_con(cmd)
> -        msg = 'faile to query metric data'
> +        msg = 'failed to query metric data'
>          self.verify("Get metrics done" in output, msg)
>          dst_file = os.path.join(self.output_path, json_name)
>          self.dut.session.copy_file_from(json_file, dst_file) @@ -392,11 +393,12
> @@ class TestPowerTelemetry(TestCase):
>          except_content = None
>          try:
>              self.start_l3fwd_power()
> +            duration = 20
>              option = {
>                  'traffic_opt': {
>                      'method': 'throughput',
> -                    'duration': 15,
> -                    'interval': 10,
> +                    'duration': duration,
> +                    'interval': duration - 2,
>                      'callback': self.telemetry_query_on_traffic, }}
>              self.run_traffic(option)
>              time.sleep(5)
> --
> 2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04  8:27 [dts] [PATCH V1 0/1] power_telemetry: python3 support and script optimize yufengmx
2020-03-04  8:25 ` Mo, YufengX
2020-03-04  8:27 ` [dts] [PATCH V1 1/1] tests/power_telemetry: " yufengmx
2020-03-13  6:29   ` Tu, Lijuan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox