File tree Expand file tree Collapse file tree
tools/ft-orchestration/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 Daemon ,
2020 ExecutableProcessError ,
2121)
22- from src .probe . mpstat import MpStat
22+ from src .stats . merged import MergedStats
2323from src .probe .probe_target import ProbeTarget
2424
2525SETTINGS_TO_ARGS : dict [str , str ] = {
@@ -141,7 +141,7 @@ def __init__(
141141 if self ._zero_copy :
142142 assert_tool_is_installed ("pf_ringcfg" , executor )
143143 self ._cmd = self ._prepare_cmd (target , protocols , settings )
144- self .host_statistics = MpStat (stats_executor , self ._cmd .split (" " , 1 )[0 ])
144+ self .host_statistics = MergedStats (stats_executor , self ._cmd .split (" " , 1 )[0 ])
145145
146146 self ._local_workdir = tempfile .mkdtemp ()
147147 self ._log_file = Path (self ._local_workdir , "cento.log" )
Original file line number Diff line number Diff line change 2525)
2626from lbr_testsuite .executable .rsync import RsyncException
2727from src .probe .interface import ProbeException , ProbeInterface
28- from src .probe . mpstat import MpStat
28+ from src .stats . merged import MergedStats
2929
3030FLOWMONEXP_BIN = "/usr/bin/flowmonexp5"
3131FLOWMONEXP_LOG = Path ("/data/components/flowmonexp/log" )
@@ -193,7 +193,9 @@ def __init__(
193193 else :
194194 stats_executor = LocalExecutor ()
195195
196- self .host_statistics = MpStat (stats_executor , os .path .basename (FLOWMONEXP_BIN ))
196+ self .host_statistics = MergedStats (
197+ stats_executor , os .path .basename (FLOWMONEXP_BIN )
198+ )
197199
198200 dpdk_is_active = Tool (
199201 "systemctl -q is-active dpdk-controller.service" ,
Original file line number Diff line number Diff line change 99"""
1010
1111from abc import ABC , abstractmethod
12- from os import PathLike
13- from lbr_testsuite .executable import Executor
14-
15-
16- class HostStats (ABC ):
17- """
18- Abstract class defining an interface for a program that reads statistics from a host.
19- """
20-
21- @abstractmethod
22- def __init__ (self , executor : Executor , watch_cmd : str ):
23- """
24- Constructor.
25-
26- Args:
27- executor (Executor): Executor object.
28- watch_cmd (str): Program name to watch statistics for.
29- """
30- pass
31-
32- @property
33- @abstractmethod
34- def cpus (self ) -> int :
35- """
36- Number of CPUs.
37- """
38- pass
39-
40- @property
41- @abstractmethod
42- def total_ram (self ) -> int :
43- """
44- Size of RAM in kB.
45- """
46- pass
47-
48- @property
49- @abstractmethod
50- def local_file (self ) -> PathLike :
51- """
52- Path to locally stored CSV file.
53- """
54- pass
55-
56- @abstractmethod
57- def start (self ):
58- """
59- Start collecting statistics.
60- """
61- pass
62-
63- @abstractmethod
64- def stop (self ):
65- """
66- Stop collecting statistics.
67- """
68- pass
69-
70- @abstractmethod
71- def cleanup (self ):
72- """
73- Remove temporary files.
74- """
75- pass
76-
77- @abstractmethod
78- def get_csv (self , output_dir : PathLike ):
79- """
80- Download the CSV file containing statistics to the output directory.
81-
82- Args:
83- output_dir (PathLike): Path where to copy CSV to.
84- """
85- pass
12+ from src .stats .interface import HostStats
8613
8714
8815class ProbeException (Exception ):
Original file line number Diff line number Diff line change 2828from src .common .utils import duplicate_executor
2929from src .config .common import InterfaceCfg
3030from src .probe .interface import ProbeException , ProbeInterface
31- from src .probe . mpstat import MpStat
31+ from src .stats . merged import MergedStats
3232from src .probe .probe_target import ProbeTarget
3333from lbr_testsuite .executable import ExecutableProcessError
3434
@@ -392,7 +392,7 @@ def __init__(
392392
393393 assert_tool_is_installed ("ipfixprobe" , executor )
394394 self ._cmd = self ._prepare_cmd (target , protocols , settings )
395- self .host_statistics = MpStat (stats_executor , self ._cmd .split (" " , 1 )[0 ])
395+ self .host_statistics = MergedStats (stats_executor , self ._cmd .split (" " , 1 )[0 ])
396396
397397 self ._local_workdir = tempfile .mkdtemp ()
398398 self ._log_file = Path (self ._local_workdir , "ipfixprobe.log" )
Original file line number Diff line number Diff line change 2222 Daemon ,
2323 ExecutableProcessError ,
2424)
25- from src .probe . mpstat import MpStat
25+ from src .stats . merged import MergedStats
2626from src .probe .probe_target import ProbeTarget
2727
2828SETTINGS_TO_ARGS : dict [str , str ] = {
@@ -150,7 +150,7 @@ def __init__(
150150 if self ._zero_copy :
151151 assert_tool_is_installed ("pf_ringcfg" , executor )
152152 self ._cmd = self ._prepare_cmd (target , protocols , settings )
153- self .host_statistics = MpStat (stats_executor , self ._cmd .split (" " , 1 )[0 ])
153+ self .host_statistics = MergedStats (stats_executor , self ._cmd .split (" " , 1 )[0 ])
154154
155155 self ._local_workdir = tempfile .mkdtemp ()
156156 self ._log_files = []
Original file line number Diff line number Diff line change 2020from src .common .utils import duplicate_executor
2121from src .config .common import InterfaceCfg
2222from src .probe .interface import ProbeException , ProbeInterface
23- from src .probe . mpstat import MpStat
23+ from src .stats . merged import MergedStats
2424from src .probe .probe_target import ProbeTarget
2525
2626
@@ -150,7 +150,7 @@ def __init__(
150150 self ._log_file = path .join (self ._local_workdir , f"{ self ._binary } .log" )
151151 self ._config_file = path .join (self ._local_workdir , "settings.conf" )
152152 self ._cmd = None
153- self .host_statistics = MpStat (stats_executor , self ._binary )
153+ self .host_statistics = MergedStats (stats_executor , self ._binary )
154154 self ._rsync = Rsync (executor )
155155 self ._rss_queues_pcap = rss_queues
156156
Original file line number Diff line number Diff line change 1919from src .common .utils import duplicate_executor
2020from src .config .common import InterfaceCfg
2121from src .probe .interface import ProbeException , ProbeInterface
22- from src .probe . mpstat import MpStat
22+ from src .stats . merged import MergedStats
2323from src .probe .probe_target import ProbeTarget
2424
2525
@@ -234,7 +234,7 @@ def __init__(
234234 self ._log_file = path .join (self ._local_workdir , "yaf.log" )
235235 self ._config_file = path .join (self ._local_workdir , "settings.conf" )
236236 self ._cmd = None
237- self .host_statistics = MpStat (stats_executor , "yaf" )
237+ self .host_statistics = MergedStats (stats_executor , "yaf" )
238238 self ._rsync = Rsync (executor )
239239 self ._rss_queues_pcap = rss_queues
240240
Original file line number Diff line number Diff line change 1+ from abc import ABC , abstractmethod
2+ from os import PathLike
3+ from lbr_testsuite .executable import Executor
4+
5+
6+ class HostStats (ABC ):
7+ """
8+ Abstract class defining an interface for a program that reads statistics from a host.
9+ """
10+
11+ @abstractmethod
12+ def __init__ (self , executor : Executor , watch_cmd : str ):
13+ """
14+ Constructor.
15+
16+ Args:
17+ executor (Executor): Executor object.
18+ watch_cmd (str): Program name to watch statistics for.
19+ """
20+ pass
21+
22+ @property
23+ @abstractmethod
24+ def cpus (self ) -> int :
25+ """
26+ Number of CPUs.
27+ """
28+ pass
29+
30+ @property
31+ @abstractmethod
32+ def total_ram (self ) -> int :
33+ """
34+ Size of RAM in kB.
35+ """
36+ pass
37+
38+ @property
39+ @abstractmethod
40+ def local_file (self ) -> PathLike :
41+ """
42+ Path to locally stored CSV file.
43+ """
44+ pass
45+
46+ @abstractmethod
47+ def start (self ):
48+ """
49+ Start collecting statistics.
50+ """
51+ pass
52+
53+ @abstractmethod
54+ def stop (self ):
55+ """
56+ Stop collecting statistics.
57+ """
58+ pass
59+
60+ @abstractmethod
61+ def cleanup (self ):
62+ """
63+ Remove temporary files.
64+ """
65+ pass
66+
67+ @abstractmethod
68+ def get_csv (self , output_dir : PathLike ):
69+ """
70+ Download the CSV file containing statistics to the output directory.
71+
72+ Args:
73+ output_dir (PathLike): Path where to copy CSV to.
74+ """
75+ pass
You can’t perform that action at this time.
0 commit comments